]> git.evergreen-ils.org Git - Evergreen.git/blob - Open-ILS/src/sql/Pg/version-upgrade/2.8.6-2.8.7-upgrade-db.sql
LP 2061136 follow-up: ng lint --fix
[Evergreen.git] / Open-ILS / src / sql / Pg / version-upgrade / 2.8.6-2.8.7-upgrade-db.sql
1 --Upgrade Script for 2.8.6 to 2.8.7
2 \set eg_version '''2.8.7'''
3 BEGIN;
4 INSERT INTO config.upgrade_log (version, applied_to) VALUES ('2.8.7', :eg_version);
5
6 SELECT evergreen.upgrade_deps_block_check('0959', :eg_version);
7
8 CREATE OR REPLACE VIEW money.transaction_billing_summary AS
9     SELECT id as xact,
10         last_billing_type,
11         last_billing_note,
12         last_billing_ts,
13         total_owed
14       FROM money.materialized_billable_xact_summary;
15
16
17 SELECT evergreen.upgrade_deps_block_check('0972', :eg_version); -- jstompro/gmcharlt
18
19 -- LP#1550495 - Add Baker&Taylor EDI Quantity Cancel Code
20 -- Insert EDI Cancel Reason 85 (1200 + 85 = 1285) if it doesn't already exist
21 INSERT INTO acq.cancel_reason 
22    (org_unit, keep_debits, id, label, description)
23    SELECT 
24      1, 'f',( 85+1200),
25      oils_i18n_gettext(1285, 'Canceled: By Vendor', 'acqcr', 'label'),
26      oils_i18n_gettext(1285, 'Line item canceled by vendor', 'acqcr', 'description')
27    WHERE NOT EXISTS (
28     SELECT 1 FROM acq.cancel_reason where id=(85+1200)
29    );
30
31
32
33 SELECT evergreen.upgrade_deps_block_check('0973', :eg_version); -- tmccanna/gmcharlt
34
35 UPDATE action_trigger.event_definition SET template = 
36 $$
37 [%- USE date -%]
38 [%- SET user = target -%]
39 <div>
40     <style> li { padding: 8px; margin 5px; }</style>
41     <div>[% date.format %]</div>
42     <br/>   
43         Fines for:<br/>
44     [% user.family_name %], [% user.first_given_name %]
45     <ol>
46     [% FOR xact IN user.open_billable_transactions_summary %]
47         [% IF xact.balance_owed > 0 %]
48             <li>
49                 <div>Details: 
50                     [% IF xact.xact_type == 'circulation' %]
51                         [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
52                     [% ELSE %]
53                         [%- xact.last_billing_type -%]
54                     [% END %]
55                 </div>
56                 <div>Total Billed: [% xact.total_owed %]</div>
57                 <div>Total Paid: [% xact.total_paid %]</div>
58                 <div>Balance Owed : [% xact.balance_owed %]</div>
59             </li>
60         [% END %]
61     [% END %]
62     </ol>
63 </div>
64 $$ WHERE id=13
65 AND template = 
66 $$
67 [%- USE date -%]
68 [%- SET user = target -%]
69 <div>
70     <style> li { padding: 8px; margin 5px; }</style>
71     <div>[% date.format %]</div>
72     <br/>
73
74     [% user.family_name %], [% user.first_given_name %]
75     <ol>
76     [% FOR xact IN user.open_billable_transactions_summary %]
77         <li>
78             <div>Details: 
79                 [% IF xact.xact_type == 'circulation' %]
80                     [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
81                 [% ELSE %]
82                     [%- xact.last_billing_type -%]
83                 [% END %]
84             </div>
85             <div>Total Billed: [% xact.total_owed %]</div>
86             <div>Total Paid: [% xact.total_paid %]</div>
87             <div>Balance Owed : [% xact.balance_owed %]</div>
88         </li>
89     [% END %]
90     </ol>
91 </div>
92 $$
93 ;
94
95
96 SELECT evergreen.upgrade_deps_block_check('0974', :eg_version); -- tmccanna/gmcharlt
97
98 UPDATE action_trigger.event_definition SET template = 
99 $$
100 [%- USE date -%]
101 [%- SET user = target.0.usr -%]
102 <div>
103     <style> li { padding: 8px; margin 5px; }</style>
104     <div>[% date.format %]</div>
105     <br/>
106     Holds for:<br/>
107         [% user.family_name %], [% user.first_given_name %]
108         
109     <ol>
110     [% FOR hold IN target %]
111         [%-
112             SET idx = loop.count - 1;
113             SET udata =  user_data.$idx;
114         -%]
115         <li>
116             <div>Title: [% udata.item_title %]</div>
117             <div>Author: [% udata.item_author %]</div>
118             <div>Pickup Location: [% udata.pickup_lib %]</b></div>
119             <div>Status: 
120                 [%- IF udata.ready -%]
121                     Ready for pickup
122                 [% ELSE %]
123                     #[% udata.queue_position %] of 
124                       [% udata.potential_copies %] copies.
125                 [% END %]
126             </div>
127         </li>
128     [% END %]
129     </ol>
130 </div>
131
132 $$ WHERE id=12
133 AND template = 
134 $$
135 [%- USE date -%]
136 [%- SET user = target.0.usr -%]
137 <div>
138     <style> li { padding: 8px; margin 5px; }</style>
139     <div>[% date.format %]</div>
140     <br/>
141
142     [% user.family_name %], [% user.first_given_name %]
143     <ol>
144     [% FOR hold IN target %]
145         [%-
146             SET idx = loop.count - 1;
147             SET udata =  user_data.$idx
148         -%]
149         <li>
150             <div>Title: [% hold.bib_rec.bib_record.simple_record.title %]</div>
151             <div>Author: [% hold.bib_rec.bib_record.simple_record.author %]</div>
152             <div>Pickup Location: [% hold.pickup_lib.name %]</div>
153             <div>Status: 
154                 [%- IF udata.ready -%]
155                     Ready for pickup
156                 [% ELSE %]
157                     #[% udata.queue_position %] of [% udata.potential_copies %] copies.
158                 [% END %]
159             </div>
160         </li>
161     [% END %]
162     </ol>
163 </div>
164 $$
165 ;
166
167 COMMIT;