]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0112.data.selfcheck-fines-receipt-template.sql
LP#1117808: Stamping upgrade scripts for extend use of merge profiles
[Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0112.data.selfcheck-fines-receipt-template.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0112');
4
5 INSERT INTO action_trigger.hook (key, core_type, description, passive) 
6     VALUES (
7         'format.selfcheck.fines',
8         'au',
9         'Formats fines for self-checkout receipt',
10         TRUE
11     );
12
13 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template )
14     VALUES (
15         13,
16         TRUE,
17         1,
18         'Self-Checkout Fines Receipt',
19         'format.selfcheck.fines',
20         'NOOP_True',
21         'ProcessTemplate',
22         'print-on-demand',
23 $$
24 [%- USE date -%]
25 [%- SET user = target -%]
26 <div>
27     <style> li { padding: 8px; margin 5px; }</style>
28     <div>[% date.format %]</div>
29     <br/>
30
31     [% user.family_name %], [% user.first_given_name %]
32     <ol>
33     [% FOR xact IN user.open_billable_transactions_summary %]
34         <li>
35             <div>Details: 
36                 [% IF xact.xact_type == 'circulation' %]
37                     [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
38                 [% ELSE %]
39                     [%- xact.last_billing_type -%]
40                 [% END %]
41             </div>
42             <div>Total Billed: [% xact.total_owed %]</div>
43             <div>Total Paid: [% xact.total_paid %]</div>
44             <div>Balance Owed : [% xact.balance_owed %]</div>
45         </li>
46     [% END %]
47     </ol>
48 </div>
49 $$
50 );
51
52
53 INSERT INTO action_trigger.environment ( event_def, path) VALUES
54     ( 13, 'open_billable_transactions_summary.circulation' );
55
56 COMMIT;