Cleaned up action triggers a little bit. Added the editor param to the auto lost...
authorSteven Callender <stevecallender@esilibrary.com>
Tue, 2 Aug 2011 19:38:42 +0000 (19:38 +0000)
committerSteven Callender <stevecallender@esilibrary.com>
Tue, 2 Aug 2011 19:38:42 +0000 (19:38 +0000)
Also removed the using of simple_records in some of the notices and changed it to something more effecient.
Changed the using of total money owed, to balance owed.
Signed-off-by: Steven Callender <stevecallender@esilibrary.com>
Open-ILS/src/sql/Pg/1.4.0.5-1.6.0.0-upgrade-db.sql
Open-ILS/src/sql/Pg/1.6.1-2.0-upgrade-db.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql

index 6768baa..51ee675 100644 (file)
@@ -3318,18 +3318,22 @@ Dear [% user.family_name %], [% user.first_given_name %]
 Our records indicate the following items are overdue.
 
 [% FOR circ IN target %]
-    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
+    [%- copy_details = helpers.get_copy_bib_basics(circ.target_copy.id) -%]
+    Title: [% copy_details.title %]
+    Author: [% copy_details.author %]
+    Call Number: [% circ.target_copy.call_number.label %]
     Barcode: [% circ.target_copy.barcode %] 
     Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
-    Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
+    Total Owed For Transaction: [% circ.billable_transaction.summary.balance_owed %]
     Library: [% circ.circ_lib.name %]
 [% END %]
 
 $$);
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-    (1, 'target_copy.call_number.record.simple_record'),
+    (1, 'target_copy.call_number'),
+    (1, 'target_copy.location'), 
     (1, 'usr'),
     (1, 'billable_transaction.summary'),
     (1, 'circ_lib.billing_address');
@@ -3340,6 +3344,9 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field) 
     VALUES (2, 'f', 1, '90 Day Overdue Mark Lost', 'checkout.due', 'CircIsOverdue', 'MarkItemLost', '90 days', 'due_date');
 
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (2, 'editor', '\'1\'');
+
 -- Sample Auto Mark Lost Notice --
 
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, template) 
@@ -3355,11 +3362,14 @@ Dear [% user.family_name %], [% user.first_given_name %]
 The following items are 90 days overdue and have been marked LOST.
 
 [% FOR circ IN target %]
-    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
+    [%- copy_details = helpers.get_copy_bib_basics(circ.target_copy.id) -%]
+    Title: [% copy_details.title %], by [% copy_details.author %]
+    Call Number: [% circ.target_copy.call_number.label %]
+    Shelving Location: [% circ.target_copy.location.name %
     Barcode: [% circ.target_copy.barcode %] 
     Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
-    Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
+    Total Owed For Transaction: [% circ.billable_transaction.summary.balance_owed %]
     Library: [% circ.circ_lib.name %]
 [% END %]
 
@@ -3367,10 +3377,11 @@ $$);
 
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-    (3, 'target_copy.call_number.record.simple_record'),
+    (3, 'target_copy.call_number'),
     (3, 'usr'),
     (3, 'billable_transaction.summary'),
-    (3, 'circ_lib.billing_address');
+    (3, 'circ_lib.billing_address')
+    (3, 'target_copy.location');
 
 -- Sample Purchase Order HTML Template --
 
@@ -3495,8 +3506,9 @@ Dear [% user.family_name %], [% user.first_given_name %]
 The item(s) you requested are available for pickup from the Library.
 
 [% FOR hold IN target %]
-    Title: [% hold.current_copy.call_number.record.simple_record.title %]
-    Author: [% hold.current_copy.call_number.record.simple_record.author %]
+    [%- copy_details = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% helpers.escape_xml(copy_details.title) %]
+    Author: [% helpers.escape_xml(copy_details.author) %]
     Call Number: [% hold.current_copy.call_number.label %]
     Barcode: [% hold.current_copy.barcode %]
     Library: [% hold.pickup_lib.name %]
@@ -3505,7 +3517,7 @@ The item(s) you requested are available for pickup from the Library.
 $$);
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES
-    (5, 'current_copy.call_number.record.simple_record'),
+    (5, 'current_copy.call_number'),
     (5, 'usr'),
     (5, 'pickup_lib.billing_address');
 
index 1302226..cbdcc69 100644 (file)
@@ -2589,7 +2589,10 @@ Dear [% user.family_name %], [% user.first_given_name %]
 As a reminder, the following items are due in 3 days.
 
 [% FOR circ IN target %]
-    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
+    [%- copy_details = helpers.get_copy_bib_basics(circ.target_copy.id) -%]
+    Title: [% copy_details.title %]
+    Author: [% copy_details.author %]
+    Call Number: [% circ.target_copy.call_number.label %]
     Barcode: [% circ.target_copy.barcode %] 
     Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
@@ -2600,7 +2603,8 @@ As a reminder, the following items are due in 3 days.
 $$);
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-    (6, 'target_copy.call_number.record.simple_record'),
+    (6, 'target_copy.call_number'),
+    (6, 'target_copy.location'),
     (6, 'usr'),
     (6, 'circ_lib.billing_address');
 
@@ -2728,8 +2732,9 @@ length of time.  If you would still like to receive these items,
 no action is required.
 
 [% FOR hold IN target %]
-    Title: [% hold.bib_rec.bib_record.simple_record.title %]
-    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    [%- copy_details = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% helpers.escape_xml(copy_details.title) %]
+    Author: [% helpers.escape_xml(copy_details.author) %]
 [% END %]
 $$
 );
@@ -2740,7 +2745,7 @@ INSERT INTO action_trigger.environment (
     ) VALUES
     (9, 'pickup_lib'),
     (9, 'usr'),
-    (9, 'bib_rec.bib_record.simple_record');
+    (9, 'current_copy.call_number');
 
 INSERT INTO action_trigger.hook (key, core_type, description, passive) 
     VALUES (
index e4e7607..7939743 100644 (file)
@@ -4804,18 +4804,23 @@ Dear [% user.family_name %], [% user.first_given_name %]
 Our records indicate the following items are overdue.
 
 [% FOR circ IN target %]
-    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
-    Barcode: [% circ.target_copy.barcode %] 
+    [%- copy_details = helpers.get_copy_bib_basics(circ.target_copy.id) -%]
+    Title: [% copy_details.title %]
+    Author: [% copy_details.author %]
+    Call Number: [% circ.target_copy.call_number.label %]
+    Barcode: [% circ.target_copy.barcode %]
     Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
-    Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
+    Total Owed For Transaction: [% circ.billable_transaction.summary.balance_owed %]
     Library: [% circ.circ_lib.name %]
+
 [% END %]
 
 $$);
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-    (1, 'target_copy.call_number.record.simple_record'),
+    (1, 'target_copy.call_number'),
+    (1, 'target_copy.location'),
     (1, 'usr'),
     (1, 'billable_transaction.summary'),
     (1, 'circ_lib.billing_address');
@@ -4825,6 +4830,9 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, delay, delay_field) 
     VALUES (2, 'f', 1, '90 Day Overdue Mark Lost', 'checkout.due', 'CircIsOverdue', 'MarkItemLost', '90 days', 'due_date');
 
+INSERT INTO action_trigger.event_params (event_def, param, value) VALUES
+    (2, 'editor', '\'1\'');
+
 -- Sample Auto Mark Lost Notice --
 
 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, group_field, template) 
@@ -4840,11 +4848,14 @@ Dear [% user.family_name %], [% user.first_given_name %]
 The following items are 90 days overdue and have been marked LOST.
 
 [% FOR circ IN target %]
-    Title: [% circ.target_copy.call_number.record.simple_record.title %] 
-    Barcode: [% circ.target_copy.barcode %] 
+    [%- copy_details = helpers.get_copy_bib_basics(circ.target_copy.id) -%]
+    Title: [% copy_details.title %], by [% copy_details.author %]
+    Call Number: [% circ.target_copy.call_number.label %]
+    Shelving Location: [% circ.target_copy.location.name %
+    Barcode: [% circ.target_copy.barcode %]
     Due: [% date.format(helpers.format_date(circ.due_date), '%Y-%m-%d') %]
     Item Cost: [% helpers.get_copy_price(circ.target_copy) %]
-    Total Owed For Transaction: [% circ.billable_transaction.summary.total_owed %]
+    Total Owed For Transaction: [% circ.billable_transaction.summary.balance_owed %]
     Library: [% circ.circ_lib.name %]
 [% END %]
 
@@ -4852,10 +4863,12 @@ $$);
 
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES 
-    (3, 'target_copy.call_number.record.simple_record'),
+    (3, 'target_copy.call_number'),
     (3, 'usr'),
     (3, 'billable_transaction.summary'),
-    (3, 'circ_lib.billing_address');
+    (3, 'circ_lib.billing_address')
+    (3, 'target_copy.location');
+
 
 -- Sample Purchase Order HTML Template --
 
@@ -5005,8 +5018,9 @@ Dear [% user.family_name %], [% user.first_given_name %]
 The item(s) you requested are available for pickup from the Library.
 
 [% FOR hold IN target %]
-    Title: [% hold.current_copy.call_number.record.simple_record.title %]
-    Author: [% hold.current_copy.call_number.record.simple_record.author %]
+    [%- copy_details = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% helpers.escape_xml(copy_details.title) %]
+    Author: [% helpers.escape_xml(copy_details.author) %]
     Call Number: [% hold.current_copy.call_number.label %]
     Barcode: [% hold.current_copy.barcode %]
     Library: [% hold.pickup_lib.name %]
@@ -5028,7 +5042,7 @@ INSERT INTO action_trigger.hook (
     );
 
 INSERT INTO action_trigger.environment (event_def, path) VALUES
-    (5, 'current_copy.call_number.record.simple_record'),
+    (5, 'current_copy.call_number'),
     (5, 'usr'),
     (5, 'pickup_lib.billing_address');
 
@@ -5137,17 +5151,18 @@ length of time.  If you would still like to receive these items,
 no action is required.
 
 [% FOR hold IN target %]
-    Title: [% hold.bib_rec.bib_record.simple_record.title %]
-    Author: [% hold.bib_rec.bib_record.simple_record.author %]
+    [%- copy_details = helpers.get_copy_bib_basics(hold.current_copy.id) -%]
+    Title: [% helpers.escape_xml(copy_details.title) %]
+    Author: [% helpers.escape_xml(copy_details.author) %]
 [% END %]
 $$
 );
 
 INSERT INTO action_trigger.environment (event_def, path)
     VALUES
-        (9, 'pickup_lib'),
-        (9, 'usr'),
-        (9, 'bib_rec.bib_record.simple_record');
+    (9, 'pickup_lib'),
+    (9, 'usr'),
+    (9, 'current_copy.call_number');
 
 -- trigger data related to acq user requests