Option to set copy creator value to ACQ receiver
authorBill Erickson <berick@esilibrary.com>
Wed, 24 Aug 2011 17:57:11 +0000 (13:57 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 25 Aug 2011 00:14:16 +0000 (20:14 -0400)
YAOUS to support updating the asset.copy.creator value to match the
staff user that marked the ACQ-copy (acq.lineitem_detail) as received.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.acq-copy-creator-from-receiver.sql [new file with mode: 0644]

index 8dc31ab..7313cc1 100644 (file)
@@ -527,6 +527,8 @@ sub receive_lineitem_detail {
     $copy->status(OILS_COPY_STATUS_IN_PROCESS);
     $copy->edit_date('now');
     $copy->editor($e->requestor->id);
+    $copy->creator($e->requestor->id) if $U->ou_ancestor_setting_value(
+        $e->requestor->ws_ou, 'acq.copy_creator_uses_receiver', $e);
     $e->update_asset_copy($copy) or return 0;
 
     $mgr->add_lid;
index 44f0f21..5213ff9 100644 (file)
@@ -9692,3 +9692,20 @@ INSERT INTO authority.thesaurus (code, name, control_set) VALUES
     ('z', oils_i18n_gettext('z','Other','at','name'), 1),
     ('|', oils_i18n_gettext('|','No attempt to code','at','name'), 1);
 
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+    'acq.copy_creator_uses_receiver',
+    oils_i18n_gettext( 
+        'acq.copy_creator_uses_receiver',
+        'Acq: Set copy creator as receiver',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext( 
+        'acq.copy_creator_uses_receiver',
+        'When receiving a copy in acquisitions, set the copy "creator" to be the staff that received the copy',
+        'coust',
+        'label'
+    ),
+    'bool'
+);
+
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.acq-copy-creator-from-receiver.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.acq-copy-creator-from-receiver.sql
new file mode 100644 (file)
index 0000000..14b22d4
--- /dev/null
@@ -0,0 +1,24 @@
+-- Evergreen DB patch XXXX.data.acq-copy-creator-from-receiver.sql
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+INSERT INTO config.org_unit_setting_type ( name, label, description, datatype ) VALUES (
+    'acq.copy_creator_uses_receiver',
+    oils_i18n_gettext( 
+        'acq.copy_creator_uses_receiver',
+        'Acq: Set copy creator as receiver',
+        'coust',
+        'label'
+    ),
+    oils_i18n_gettext( 
+        'acq.copy_creator_uses_receiver',
+        'When receiving a copy in acquisitions, set the copy "creator" to be the staff that received the copy',
+        'coust',
+        'label'
+    ),
+    'bool'
+);
+
+COMMIT;