From 42337b3be4c5b0a7ef785111912584440ad29917 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 24 Aug 2011 14:24:54 -0400 Subject: [PATCH] Column to track ACQ copy (lineitem_detail) receiver Creates acq.lineitem_detail.receiver column, set to the staff that marked the copy as received. Signed-off-by: Bill Erickson Signed-off-by: Mike Rylander --- Open-ILS/examples/fm_IDL.xml | 2 ++ Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm | 2 ++ Open-ILS/src/sql/Pg/200.schema.acq.sql | 1 + .../Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql | 11 +++++++++++ 4 files changed, 16 insertions(+) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql diff --git a/Open-ILS/examples/fm_IDL.xml b/Open-ILS/examples/fm_IDL.xml index 052631f517..cabc99ca17 100644 --- a/Open-ILS/examples/fm_IDL.xml +++ b/Open-ILS/examples/fm_IDL.xml @@ -6966,6 +6966,7 @@ SELECT usr, + @@ -6986,6 +6987,7 @@ SELECT usr, + diff --git a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm index 8530709363..8dc31ab30a 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/Application/Acq/Order.pm @@ -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; diff --git a/Open-ILS/src/sql/Pg/200.schema.acq.sql b/Open-ILS/src/sql/Pg/200.schema.acq.sql index e8869a33c5..b566ff58f6 100644 --- a/Open-ILS/src/sql/Pg/200.schema.acq.sql +++ b/Open-ILS/src/sql/Pg/200.schema.acq.sql @@ -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 index 0000000000..8a604f9169 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.schema.acq-lineitem-detail-receiver.sql @@ -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; -- 2.11.0