[open-ils-commits] r14169 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Circ sql/Pg sql/Pg/upgrade (dbs)

svn at svn.open-ils.org svn at svn.open-ils.org
Fri Sep 25 22:39:04 EDT 2009


Author: dbs
Date: 2009-09-25 22:39:02 -0400 (Fri, 25 Sep 2009)
New Revision: 14169

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql
Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
   trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
Log:
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


Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-09-25 01:20:01 UTC (rev 14168)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Circ/Circulate.pm	2009-09-26 02:39:02 UTC (rev 14169)
@@ -2674,6 +2674,8 @@
     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 @@
     }
 }
 
-
+1;

Modified: trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql	2009-09-25 01:20:01 UTC (rev 14168)
+++ trunk/Open-ILS/src/sql/Pg/400.schema.action_trigger.sql	2009-09-26 02:39:02 UTC (rev 14169)
@@ -37,8 +37,8 @@
 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 ('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 ('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    

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0023.data.trigger-for-renewing-circs.sql	2009-09-26 02:39:02 UTC (rev 14169)
@@ -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;



More information about the open-ils-commits mailing list