Column to track ACQ copy (lineitem_detail) receiver
authorBill Erickson <berick@esilibrary.com>
Wed, 24 Aug 2011 18:24:54 +0000 (14:24 -0400)
committerMike Rylander <mrylander@gmail.com>
Thu, 25 Aug 2011 00:06:27 +0000 (20:06 -0400)
Creates acq.lineitem_detail.receiver column, set to the staff that
marked the copy as received.

Signed-off-by: Bill Erickson <berick@esilibrary.com>
Signed-off-by: Mike Rylander <mrylander@gmail.com>
Open-ILS/examples/fm_IDL.xml
Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm
Open-ILS/src/sql/Pg/200.schema.acq.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql [new file with mode: 0644]

index 052631f..cabc99c 100644 (file)
@@ -6966,6 +6966,7 @@ SELECT  usr,
                        <field reporter:label="Barcode" name="barcode" reporter:datatype="text" />
                        <field reporter:label="Call Number Label" name="cn_label" reporter:datatype="text" />
                        <field reporter:label="Actual Receive Date" name="recv_time" reporter:datatype="timestamp" />
+                       <field reporter:label="Receiving User" name="receiver" reporter:datatype="link" />
                        <field reporter:label="Fund" name="fund" reporter:datatype="link" />
                        <field reporter:label="Fund Debit" name="fund_debit" reporter:datatype="link" />
                        <field reporter:label="Owning Library" name="owning_lib" reporter:datatype="org_unit" />
@@ -6986,6 +6987,7 @@ SELECT  usr,
                        <link field="circ_modifier" reltype="has_a" key="code" map="" class="ccm"/>
                        <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/>
                        <link field="claims" reltype="has_many" key="lineitem_detail" map="" class="acqcl"/>
+                       <link field="receiver" reltype="has_a" key="id" map="" class="au"/>
                </links>
        </class>
 
index 8530709..8dc31ab 100644 (file)
@@ -519,6 +519,7 @@ sub receive_lineitem_detail {
 
     return 1 if $lid->recv_time;
 
+    $lid->receiver($e->requestor->id);
     $lid->recv_time('now');
     $e->update_acq_lineitem_detail($lid) or return 0;
 
@@ -554,6 +555,7 @@ sub rollback_receive_lineitem_detail {
 
     return 1 unless $lid->recv_time;
 
+    $lid->clear_receiver;
     $lid->clear_recv_time;
     $e->update_acq_lineitem_detail($lid) or return 0;
 
index e8869a3..b566ff5 100644 (file)
@@ -534,6 +534,7 @@ CREATE TABLE acq.lineitem_detail (
     owning_lib  INT         REFERENCES actor.org_unit (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
     location    INT         REFERENCES asset.copy_location (id) ON DELETE SET NULL DEFERRABLE INITIALLY DEFERRED,
     recv_time   TIMESTAMP WITH TIME ZONE,
+       receiver                INT         REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED,
        cancel_reason   INT     REFERENCES acq.cancel_reason( id ) DEFERRABLE INITIALLY DEFERRED
 );
 
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql
new file mode 100644 (file)
index 0000000..8a604f9
--- /dev/null
@@ -0,0 +1,11 @@
+-- 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);
+
+ALTER TABLE acq.lineitem_detail 
+    ADD COLUMN receiver        INT REFERENCES actor.usr (id) DEFERRABLE INITIALLY DEFERRED;
+
+
+COMMIT;