3 -- check whether patch can be applied
4 SELECT evergreen.upgrade_deps_block_check('0889', :eg_version);
6 -- Update ACQ cancel reason names, but only those that
7 -- have not already been locally modified from stock values.
9 UPDATE acq.cancel_reason
10 SET label = oils_i18n_gettext(1,'Canceled: Invalid ISBN', 'acqcr', 'label')
11 WHERE id = 1 AND label = 'invalid_isbn';
13 UPDATE acq.cancel_reason
14 SET label = oils_i18n_gettext(1,'Canceled: Postpone', 'acqcr', 'label')
15 WHERE id = 2 AND label = 'postpone';
17 UPDATE acq.cancel_reason
18 SET label = oils_i18n_gettext(1,'Delayed: Delivered but Lost', 'acqcr', 'label')
19 WHERE id = 3 AND label = 'delivered_but_lost';
21 UPDATE acq.cancel_reason
22 SET label = oils_i18n_gettext(1,'Canceled: Deleted', 'acqcr', 'label')
23 WHERE id = 1002 AND label = 'Deleted';
25 UPDATE acq.cancel_reason
26 SET label = oils_i18n_gettext(1,'Delayed: Changed', 'acqcr', 'label')
27 WHERE id = 1003 AND label = 'Changed';
29 UPDATE acq.cancel_reason
30 SET label = oils_i18n_gettext(1,'Delayed: No Action', 'acqcr', 'label')
31 WHERE id = 1004 AND label = 'No action';
33 UPDATE acq.cancel_reason
34 SET label = oils_i18n_gettext(1,'Delayed: Accepted without amendment', 'acqcr', 'label')
35 WHERE id = 1005 AND label = 'Accepted without amendment';
37 UPDATE acq.cancel_reason
38 SET label = oils_i18n_gettext(1,'Canceled: Not Accepted', 'acqcr', 'label')
39 WHERE id = 1007 AND label = 'Not accepted';
41 UPDATE acq.cancel_reason
42 SET label = oils_i18n_gettext(1,'Canceled: Not Found', 'acqcr', 'label')
43 WHERE id = 1010 AND label = 'Not found';
45 UPDATE acq.cancel_reason
46 SET label = oils_i18n_gettext(1,'Delayed: Accepted with amendment', 'acqcr', 'label')
47 WHERE id = 1024 AND label = 'Accepted with amendment, no confirmation required';
49 UPDATE acq.cancel_reason
50 SET label = oils_i18n_gettext(1,'Delayed: Split Quantity', 'acqcr', 'label')
51 WHERE id = 1211 AND label = 'Split quantity';
53 UPDATE acq.cancel_reason
54 SET label = oils_i18n_gettext(1,'Delayed: Ordered Quantity', 'acqcr', 'label')
55 WHERE id = 1221 AND label = 'Ordered quantity';
57 UPDATE acq.cancel_reason
58 SET label = oils_i18n_gettext(1,'Delayed: Pieces Delivered', 'acqcr', 'label')
59 WHERE id = 1246 AND label = 'Pieces delivered';
61 UPDATE acq.cancel_reason
62 SET label = oils_i18n_gettext(1,'Delayed: Backorder', 'acqcr', 'label')
63 WHERE id = 1283 AND label = 'Backorder quantity';
65 -- action/trigger additions
66 -- All following changes are only applied where the source data matches
67 -- the stock data. IOW, if a template has been locally modified,
68 -- it's left unchanged.
72 -- avoid collisions by testing for the presence of the
73 -- desired environment addition.
75 PERFORM 1 FROM action_trigger.environment
76 WHERE event_def = 4 AND path = 'lineitems.cancel_reason';
78 INSERT INTO action_trigger.environment (event_def, path)
79 VALUES (4, 'lineitems.cancel_reason');
82 PERFORM 1 FROM action_trigger.environment
83 WHERE event_def = 14 AND path = 'cancel_reason';
85 INSERT INTO action_trigger.environment (event_def, path)
86 VALUES ( 14, 'cancel_reason' );
89 PERFORM 1 FROM action_trigger.environment
90 WHERE event_def = 14 AND path = 'lineitem_details.cancel_reason';
92 INSERT INTO action_trigger.environment (event_def, path)
93 VALUES ( 14, 'lineitem_details.cancel_reason' );
97 UPDATE action_trigger.event_definition SET template =
101 # find a lineitem attribute by name and optional type
103 FOR attr IN li.attributes;
104 IF attr.attr_name == attr_name;
105 IF !attr_type OR attr_type == attr.attr_type;
114 <h2>Purchase Order: [% target.name %] ([% target.id %])</h2>
116 date <b>[% date.format(date.now, '%Y%m%d') %]</b>
120 table td { padding:5px; border:1px solid #aaa;}
121 table { width:95%; border-collapse:collapse; }
122 #vendor-notes { padding:5px; border:1px solid #aaa; }
124 <table id='vendor-table'>
126 <td valign='top'>Vendor</td>
128 <div>[% target.provider.name %]</div>
129 <div>[% target.provider.addresses.0.street1 %]</div>
130 <div>[% target.provider.addresses.0.street2 %]</div>
131 <div>[% target.provider.addresses.0.city %]</div>
132 <div>[% target.provider.addresses.0.state %]</div>
133 <div>[% target.provider.addresses.0.country %]</div>
134 <div>[% target.provider.addresses.0.post_code %]</div>
136 <td valign='top'>Ship to / Bill to</td>
138 <div>[% target.ordering_agency.name %]</div>
139 <div>[% target.ordering_agency.billing_address.street1 %]</div>
140 <div>[% target.ordering_agency.billing_address.street2 %]</div>
141 <div>[% target.ordering_agency.billing_address.city %]</div>
142 <div>[% target.ordering_agency.billing_address.state %]</div>
143 <div>[% target.ordering_agency.billing_address.country %]</div>
144 <div>[% target.ordering_agency.billing_address.post_code %]</div>
150 <fieldset id='vendor-notes'>
151 <legend>Notes to the Vendor</legend>
153 [% FOR note IN target.notes %]
154 [% IF note.vendor_public == 't' %]
155 <li>[% note.value %]</li>
166 <th>ISBN or Item #</th>
171 <th>Delayed / Canceled</th>
178 [% FOR li IN target.lineitems %]
181 [% count = li.lineitem_details.size %]
182 [% price = li.estimated_unit_price %]
183 [% litotal = (price * count) %]
184 [% subtotal = subtotal + litotal %]
186 ident_attr = helpers.get_li_order_ident(li.attributes);
187 SET ident_value = ident_attr.attr_value IF ident_attr;
189 <td>[% target.id %]</td>
190 <td>[% ident_value %]</td>
191 <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
194 <td>[% litotal %]</td>
195 <td>[% li.cancel_reason.label %]</td>
198 [% FOR note IN li.lineitem_notes %]
199 [% IF note.vendor_public == 't' %]
200 <li>[% note.value %]</li>
210 <td>[% subtotal %]</td>
217 Total Line Item Count: [% target.lineitems.size %]
219 WHERE id = 4 AND template =
223 # find a lineitem attribute by name and optional type
225 FOR attr IN li.attributes;
226 IF attr.attr_name == attr_name;
227 IF !attr_type OR attr_type == attr.attr_type;
236 <h2>Purchase Order: [% target.name %] ([% target.id %])</h2>
238 date <b>[% date.format(date.now, '%Y%m%d') %]</b>
242 table td { padding:5px; border:1px solid #aaa;}
243 table { width:95%; border-collapse:collapse; }
244 #vendor-notes { padding:5px; border:1px solid #aaa; }
246 <table id='vendor-table'>
248 <td valign='top'>Vendor</td>
250 <div>[% target.provider.name %]</div>
251 <div>[% target.provider.addresses.0.street1 %]</div>
252 <div>[% target.provider.addresses.0.street2 %]</div>
253 <div>[% target.provider.addresses.0.city %]</div>
254 <div>[% target.provider.addresses.0.state %]</div>
255 <div>[% target.provider.addresses.0.country %]</div>
256 <div>[% target.provider.addresses.0.post_code %]</div>
258 <td valign='top'>Ship to / Bill to</td>
260 <div>[% target.ordering_agency.name %]</div>
261 <div>[% target.ordering_agency.billing_address.street1 %]</div>
262 <div>[% target.ordering_agency.billing_address.street2 %]</div>
263 <div>[% target.ordering_agency.billing_address.city %]</div>
264 <div>[% target.ordering_agency.billing_address.state %]</div>
265 <div>[% target.ordering_agency.billing_address.country %]</div>
266 <div>[% target.ordering_agency.billing_address.post_code %]</div>
272 <fieldset id='vendor-notes'>
273 <legend>Notes to the Vendor</legend>
275 [% FOR note IN target.notes %]
276 [% IF note.vendor_public == 't' %]
277 <li>[% note.value %]</li>
288 <th>ISBN or Item #</th>
299 [% FOR li IN target.lineitems %]
302 [% count = li.lineitem_details.size %]
303 [% price = li.estimated_unit_price %]
304 [% litotal = (price * count) %]
305 [% subtotal = subtotal + litotal %]
307 ident_attr = helpers.get_li_order_ident(li.attributes);
308 SET ident_value = ident_attr.attr_value IF ident_attr;
310 <td>[% target.id %]</td>
311 <td>[% ident_value %]</td>
312 <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
315 <td>[% litotal %]</td>
318 [% FOR note IN li.lineitem_notes %]
319 [% IF note.vendor_public == 't' %]
320 <li>[% note.value %]</li>
330 <td>[% subtotal %]</td>
337 Total Line Item Count: [% target.lineitems.size %]
340 -- lineitem worksheet
341 UPDATE action_trigger.event_definition SET template =
344 [%- SET li = target; -%]
345 <div class="wrapper">
346 <div class="summary" style='font-size:110%; font-weight:bold;'>
348 <div>Title: [% helpers.get_li_attr("title", "", li.attributes) %]</div>
349 <div>Author: [% helpers.get_li_attr("author", "", li.attributes) %]</div>
350 <div class="count">Item Count: [% li.lineitem_details.size %]</div>
351 <div class="lineid">Lineitem ID: [% li.id %]</div>
352 <div>Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]</div>
353 [% IF li.cancel_reason.label %]
354 <div>[% li.cancel_reason.label %]</div>
357 [% IF li.distribution_formulas.size > 0 %]
359 [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
360 <div>Distribution Formulas: [% forms.join(',') %]</div>
363 [% IF li.lineitem_notes.size > 0 %]
366 [%- FOR note IN li.lineitem_notes -%]
368 [% IF note.alert_text %]
369 [% note.alert_text.code -%]
389 <th>Shelving Location</th>
392 <th>Delayed / Canceled</th>
396 <!-- set detail.owning_lib from fm object to org name -->
397 [% FOREACH detail IN li.lineitem_details %]
398 [% detail.owning_lib = detail.owning_lib.shortname %]
401 [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
403 IF detail.eg_copy_id;
404 SET copy = detail.eg_copy_id;
405 SET cn_label = copy.call_number.label;
408 SET cn_label = detail.cn_label;
412 <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
413 <td style='padding:5px;'>[% detail.owning_lib %]</td>
414 <td style='padding:5px;'>[% IF copy.barcode %]<span class="barcode" >[% detail.barcode %]</span>[% END %]</td>
415 <td style='padding:5px;'>[% IF cn_label %]<span class="cn_label" >[% cn_label %]</span>[% END %]</td>
416 <td style='padding:5px;'>[% IF detail.fund %]<span class="fund">[% detail.fund.code %] ([% detail.fund.year %])</span>[% END %]</td>
417 <td style='padding:5px;'>[% copy.location.name %]</td>
418 <td style='padding:5px;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
419 <td style='padding:5px;'>[% detail.note %]</td>
420 <td style='padding:5px;'>[% detail.cancel_reason.label %]</td>
427 WHERE id = 14 AND template =
430 [%- SET li = target; -%]
431 <div class="wrapper">
432 <div class="summary" style='font-size:110%; font-weight:bold;'>
434 <div>Title: [% helpers.get_li_attr("title", "", li.attributes) %]</div>
435 <div>Author: [% helpers.get_li_attr("author", "", li.attributes) %]</div>
436 <div class="count">Item Count: [% li.lineitem_details.size %]</div>
437 <div class="lineid">Lineitem ID: [% li.id %]</div>
438 <div>Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]</div>
440 [% IF li.distribution_formulas.size > 0 %]
442 [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
443 <div>Distribution Formulas: [% forms.join(',') %]</div>
446 [% IF li.lineitem_notes.size > 0 %]
449 [%- FOR note IN li.lineitem_notes -%]
451 [% IF note.alert_text %]
452 [% note.alert_text.code -%]
472 <th>Shelving Location</th>
478 <!-- set detail.owning_lib from fm object to org name -->
479 [% FOREACH detail IN li.lineitem_details %]
480 [% detail.owning_lib = detail.owning_lib.shortname %]
483 [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
485 IF detail.eg_copy_id;
486 SET copy = detail.eg_copy_id;
487 SET cn_label = copy.call_number.label;
490 SET cn_label = detail.cn_label;
494 <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
495 <td style='padding:5px;'>[% detail.owning_lib %]</td>
496 <td style='padding:5px;'>[% IF copy.barcode %]<span class="barcode" >[% detail.barcode %]</span>[% END %]</td>
497 <td style='padding:5px;'>[% IF cn_label %]<span class="cn_label" >[% cn_label %]</span>[% END %]</td>
498 <td style='padding:5px;'>[% IF detail.fund %]<span class="fund">[% detail.fund.code %] ([% detail.fund.year %])</span>[% END %]</td>
499 <td style='padding:5px;'>[% copy.location.name %]</td>
500 <td style='padding:5px;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
501 <td style='padding:5px;'>[% detail.note %]</td>