From 56cf747be3e804b3741423b679c56d6ecbb0cdcd Mon Sep 17 00:00:00 2001 From: dbs Date: Sat, 26 Sep 2009 02:39:02 +0000 Subject: [PATCH] Commit substantive changes from Joe Atzberger's patch to add a renewal hook, and create a DB upgrade script The substantive changes are: * $ses->request('open-ils.trigger.event.autocreate', 'renewal', $self->circ, $self->circ_lib) if $self->is_renewal; * 1; added at the end of module, * SQL line added for renewal hook. Note: also corrected typos in the SQL for another hook git-svn-id: svn://svn.open-ils.org/ILS/trunk@14169 dcc99617-32d9-48b4-a31d-7c20da2025e4 --- .../perlmods/OpenILS/Application/Circ/Circulate.pm | 4 +++- Open-ILS/src/sql/Pg/400.schema.action_trigger.sql | 8 +++++--- .../upgrade/0023.data.trigger-for-renewing-circs.sql | 12 ++++++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql diff --git a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm index 8320ed826f..39d1bece86 100644 --- a/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm +++ b/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm @@ -2674,6 +2674,8 @@ sub make_trigger_events { my $ses = OpenSRF::AppSession->create('open-ils.trigger'); $ses->request('open-ils.trigger.event.autocreate', 'checkout', $self->circ, $self->circ_lib) if $self->is_checkout; $ses->request('open-ils.trigger.event.autocreate', 'checkin', $self->circ, $self->circ_lib) if $self->is_checkin; + $ses->request('open-ils.trigger.event.autocreate', 'renewal', $self->circ, $self->circ_lib) if $self->is_renewal; + # ignore response } @@ -2739,4 +2741,4 @@ sub checkin_handle_lost_now_found_restore_od { } } - +1; diff --git a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql index 1e6d579ef9..df7fddc3b7 100644 --- a/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql +++ b/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql @@ -37,8 +37,8 @@ INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('missing','a INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('missing.found','acp','Missing Item checked in'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('transit.start','acp','An Item is placed into transit'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('transit.finish','acp','An Item is received from a transit'); -INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold_request.success','ahr','A hold is succefully placed'); -INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold_request.failure','ahr','A hold is attempted by not succefully placed'); +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold_request.success','ahr','A hold is successfully placed'); +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold_request.failure','ahr','A hold is attempted but not successfully placed'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold.capture','ahr','A targeted Item is captured for a hold'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold.available','ahr','A held item is ready for pickup'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('hold_transit.start','ahtc','A hold-captured Item is placed into transit'); @@ -53,6 +53,8 @@ INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES ('for INSERT INTO action_trigger.hook (key,core_type,description,passive) VALUES ('format.po.pdf','acqpo','Formats a Purchase Order as a PDF document',TRUE); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('damaged','acp','Item marked damaged'); INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('checkout.damaged','circ','A circulating item is marked damaged and the patron is fined'); +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('renewal','circ','Item renewed to user'); + -- and much more, I'm sure -- Specialized collection modules. Given an FM object, gather some info and return a scalar or ref. @@ -89,7 +91,7 @@ INSERT INTO action_trigger.reactor (module,description) VALUES ('MarkItemLost',' INSERT INTO action_trigger.reactor (module,description) VALUES ('ApplyCircFee','Applies a billing with a pre-defined amount to a circulation'); INSERT INTO action_trigger.reactor (module,description) VALUES ('ProcessTemplate', 'Processes the configured template'); --- After an event is reacted to (either succes or failure) a cleanup module is run against the resulting environment +-- After an event is reacted to (either success or failure) a cleanup module is run against the resulting environment CREATE TABLE action_trigger.cleanup ( module TEXT PRIMARY KEY, -- All live under the OpenILS::Trigger::Cleanup:: namespace description TEXT diff --git a/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql b/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql new file mode 100644 index 0000000000..b9a7df4e3b --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql @@ -0,0 +1,12 @@ +BEGIN; + +INSERT INTO config.upgrade_log (version) VALUES ('0023'); + +-- Fix typos in descriptions +UPDATE action_trigger.hook SET description = 'A hold is successfully placed' WHERE key = 'hold_request.success'; +UPDATE action_trigger.hook SET description = 'A hold is attempted but not successfully placed' WHERE key = 'hold_request.failure'; + +-- Add a hook for renewals +INSERT INTO action_trigger.hook (key,core_type,description) VALUES ('renewal','circ','Item renewed to user'); + +COMMIT; -- 2.43.2