Notify CSV additions
authorBill Erickson <berick@esilibrary.com>
Thu, 6 Dec 2012 20:41:10 +0000 (15:41 -0500)
committerBill Erickson <berick@esilibrary.com>
Thu, 6 Dec 2012 20:41:10 +0000 (15:41 -0500)
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/sql/Pg/notify-csv-action-trigger.sql

index 925c471..934fc5a 100644 (file)
@@ -110,8 +110,125 @@ INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
 (currval('action_trigger.event_definition_id_seq'), 'notify_type', '''RESERVE''')
 ;
 
-UPDATE action_trigger.event_definition SET template = 
-$$
+---------------------------------------------------
+-- hold expires on shelf soon
+INSERT INTO action_trigger.event_definition (active, name, owner, hook, 
+    validator, reactor, delay, delay_field, group_field, template, granularity)
+VALUES (
+    'f', 'Hold Expires On Shelf Soon CSV', 1, 
+    'hold_request.shelf_expires_soon',
+    'HoldIsAvailable', 'ProcessTemplate', '-1 days', 
+    'shelf_expire_time', 'usr', '', 'notify-csv'
+);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+(currval('action_trigger.event_definition_id_seq'), 'pickup_lib'), 
+(currval('action_trigger.event_definition_id_seq'), 'current_copy'), 
+(currval('action_trigger.event_definition_id_seq'), 'usr.card')
+;
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+(currval('action_trigger.event_definition_id_seq'), 'notify_media', '''V'''),
+(currval('action_trigger.event_definition_id_seq'), 'notify_level', '2'),
+(currval('action_trigger.event_definition_id_seq'), 'notify_type', '''PRERESERVE''')
+;
+
+---------------------------------------------------
+-- hold expired on shelf
+INSERT INTO action_trigger.event_definition (active, name, owner, hook, 
+    validator, reactor, delay, delay_field, group_field, template, granularity)
+VALUES (
+    'f', 'Hold Expired On Shelf CSV', 1, 
+    'hold_request.cancel.expire_holds_shelf',
+    'HoldIsCancelled', 'ProcessTemplate', '30 minutes', 
+    'cancel_time', 'usr', '', 'notify-csv'
+);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+(currval('action_trigger.event_definition_id_seq'), 'pickup_lib'), 
+(currval('action_trigger.event_definition_id_seq'), 'current_copy'),
+(currval('action_trigger.event_definition_id_seq'), 'usr.card')
+;
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+(currval('action_trigger.event_definition_id_seq'), 'notify_media', '''V'''),
+(currval('action_trigger.event_definition_id_seq'), 'notify_level', '1'),
+(currval('action_trigger.event_definition_id_seq'), 'notify_type', '''RESERVEEXPIRE''')
+;
+
+---------------------------------------------------
+-- hold cancelled
+-- see also hooks hold_request.cancel.staff and
+-- hold_request.cancel.patron
+INSERT INTO action_trigger.event_definition (active, name, owner, hook, 
+    validator, reactor, delay, delay_field, group_field, template, granularity)
+VALUES (
+    'f', 'Hold Cancelled (no target) CSV', 1, 
+    'hold_request.cancel.expire_no_target',
+    'HoldIsCancelled', 'ProcessTemplate', '30 minutes', 
+    'cancel_time', 'usr', '', 'notify-csv'
+);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+(currval('action_trigger.event_definition_id_seq'), 'pickup_lib'), 
+(currval('action_trigger.event_definition_id_seq'), 'current_copy'),
+(currval('action_trigger.event_definition_id_seq'), 'usr.card')
+;
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+(currval('action_trigger.event_definition_id_seq'), 'notify_media', '''V'''),
+(currval('action_trigger.event_definition_id_seq'), 'notify_level', '1'),
+(currval('action_trigger.event_definition_id_seq'), 'notify_type', '''RESERVECANCEL''')
+;
+
+---------------------------------------------------
+-- recall
+INSERT INTO action_trigger.event_definition (active, name, owner, hook, 
+    validator, reactor, delay, delay_field, group_field, template, granularity)
+VALUES (
+    'f', 'Copy Recall CSV', 1, 
+    'circ.recall.target',
+    'NOOP_True', 'ProcessTemplate', DEFAULT,
+    NULL, 'usr', '', 'notify-csv'
+);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+(currval('action_trigger.event_definition_id_seq'), 'circ_lib'), 
+(currval('action_trigger.event_definition_id_seq'), 'target_copy'), 
+(currval('action_trigger.event_definition_id_seq'), 'usr.card')
+;
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+(currval('action_trigger.event_definition_id_seq'), 'notify_media', '''V'''),
+(currval('action_trigger.event_definition_id_seq'), 'notify_level', '1'),
+(currval('action_trigger.event_definition_id_seq'), 'notify_type', '''RECALL''')
+;
+
+---------------------------------------------------
+-- patron exceeds fines threshold
+INSERT INTO action_trigger.event_definition (active, name, owner, hook, 
+    validator, reactor, delay, delay_field, group_field, template, granularity)
+VALUES (
+    'f', 'Patron Exceeds Fines CSV', 1, 
+    'penalty.PATRON_EXCEEDS_FINES',
+    'NOOP_True', 'ProcessTemplate', DEFAULT,
+    NULL, 'usr', '', 'notify-csv'
+);
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES 
+(currval('action_trigger.event_definition_id_seq'), 'org_unit'),
+(currval('action_trigger.event_definition_id_seq'), 'usr.card')
+;
+
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+(currval('action_trigger.event_definition_id_seq'), 'notify_media', '''V'''),
+(currval('action_trigger.event_definition_id_seq'), 'notify_level', '1'),
+(currval('action_trigger.event_definition_id_seq'), 'notify_type', '''FINES''')
+;
+
+---------------------------------------------------
+-- apply the generic CVS template to all event defs
+UPDATE action_trigger.event_definition SET template = $$
 [%
     USE date;