4 -- Update ACQ cancel reason names, but only those that
5 -- have not already been locally modified from stock values.
7 UPDATE acq.cancel_reason
8 SET label = oils_i18n_gettext(1,'Canceled: Invalid ISBN', 'acqcr', 'label')
9 WHERE id = 1 AND label = 'invalid_isbn';
11 UPDATE acq.cancel_reason
12 SET label = oils_i18n_gettext(1,'Canceled: Postpone', 'acqcr', 'label')
13 WHERE id = 2 AND label = 'postpone';
15 UPDATE acq.cancel_reason
16 SET label = oils_i18n_gettext(1,'Delayed: Delivered but Lost', 'acqcr', 'label')
17 WHERE id = 3 AND label = 'delivered_but_lost';
19 UPDATE acq.cancel_reason
20 SET label = oils_i18n_gettext(1,'Canceled: Deleted', 'acqcr', 'label')
21 WHERE id = 1002 AND label = 'Deleted';
23 UPDATE acq.cancel_reason
24 SET label = oils_i18n_gettext(1,'Delayed: Changed', 'acqcr', 'label')
25 WHERE id = 1003 AND label = 'Changed';
27 UPDATE acq.cancel_reason
28 SET label = oils_i18n_gettext(1,'Delayed: No Action', 'acqcr', 'label')
29 WHERE id = 1004 AND label = 'No action';
31 UPDATE acq.cancel_reason
32 SET label = oils_i18n_gettext(1,'Delayed: Accepted without amendment', 'acqcr', 'label')
33 WHERE id = 1005 AND label = 'Accepted without amendment';
35 UPDATE acq.cancel_reason
36 SET label = oils_i18n_gettext(1,'Canceled: Not Accepted', 'acqcr', 'label')
37 WHERE id = 1007 AND label = 'Not accepted';
39 UPDATE acq.cancel_reason
40 SET label = oils_i18n_gettext(1,'Canceled: Not Found', 'acqcr', 'label')
41 WHERE id = 1010 AND label = 'Not found';
43 UPDATE acq.cancel_reason
44 SET label = oils_i18n_gettext(1,'Delayed: Accepted with amendment', 'acqcr', 'label')
45 WHERE id = 1024 AND label = 'Accepted with amendment, no confirmation required';
47 UPDATE acq.cancel_reason
48 SET label = oils_i18n_gettext(1,'Delayed: Split Quantity', 'acqcr', 'label')
49 WHERE id = 1211 AND label = 'Split quantity';
51 UPDATE acq.cancel_reason
52 SET label = oils_i18n_gettext(1,'Delayed: Ordered Quantity', 'acqcr', 'label')
53 WHERE id = 1221 AND label = 'Ordered quantity';
55 UPDATE acq.cancel_reason
56 SET label = oils_i18n_gettext(1,'Delayed: Pieces Delivered', 'acqcr', 'label')
57 WHERE id = 1246 AND label = 'Pieces delivered';
59 UPDATE acq.cancel_reason
60 SET label = oils_i18n_gettext(1,'Delayed: Backorder', 'acqcr', 'label')
61 WHERE id = 1283 AND label = 'Backorder quantity';
63 -- action/trigger additions
64 -- All following changes are only applied where the source data matches
65 -- the stock data. IOW, if a template has been locally modified,
66 -- it's left unchanged.
70 -- avoid collisions by testing for the presence of the
71 -- desired environment addition.
73 PERFORM 1 FROM action_trigger.environment
74 WHERE event_def = 4 AND path = 'lineitems.cancel_reason';
76 INSERT INTO action_trigger.environment (event_def, path)
77 VALUES (4, 'lineitems.cancel_reason');
80 PERFORM 1 FROM action_trigger.environment
81 WHERE event_def = 14 AND path = 'cancel_reason';
83 INSERT INTO action_trigger.environment (event_def, path)
84 VALUES ( 14, 'cancel_reason' );
87 PERFORM 1 FROM action_trigger.environment
88 WHERE event_def = 14 AND path = 'lineitem_details.cancel_reason';
90 INSERT INTO action_trigger.environment (event_def, path)
91 VALUES ( 14, 'lineitem_details.cancel_reason' );
95 UPDATE action_trigger.event_definition SET template =
99 # find a lineitem attribute by name and optional type
101 FOR attr IN li.attributes;
102 IF attr.attr_name == attr_name;
103 IF !attr_type OR attr_type == attr.attr_type;
112 <h2>Purchase Order: [% target.name %] ([% target.id %])</h2>
114 date <b>[% date.format(date.now, '%Y%m%d') %]</b>
118 table td { padding:5px; border:1px solid #aaa;}
119 table { width:95%; border-collapse:collapse; }
120 #vendor-notes { padding:5px; border:1px solid #aaa; }
122 <table id='vendor-table'>
124 <td valign='top'>Vendor</td>
126 <div>[% target.provider.name %]</div>
127 <div>[% target.provider.addresses.0.street1 %]</div>
128 <div>[% target.provider.addresses.0.street2 %]</div>
129 <div>[% target.provider.addresses.0.city %]</div>
130 <div>[% target.provider.addresses.0.state %]</div>
131 <div>[% target.provider.addresses.0.country %]</div>
132 <div>[% target.provider.addresses.0.post_code %]</div>
134 <td valign='top'>Ship to / Bill to</td>
136 <div>[% target.ordering_agency.name %]</div>
137 <div>[% target.ordering_agency.billing_address.street1 %]</div>
138 <div>[% target.ordering_agency.billing_address.street2 %]</div>
139 <div>[% target.ordering_agency.billing_address.city %]</div>
140 <div>[% target.ordering_agency.billing_address.state %]</div>
141 <div>[% target.ordering_agency.billing_address.country %]</div>
142 <div>[% target.ordering_agency.billing_address.post_code %]</div>
148 <fieldset id='vendor-notes'>
149 <legend>Notes to the Vendor</legend>
151 [% FOR note IN target.notes %]
152 [% IF note.vendor_public == 't' %]
153 <li>[% note.value %]</li>
164 <th>ISBN or Item #</th>
169 <th>Delayed / Canceled</th>
176 [% FOR li IN target.lineitems %]
179 [% count = li.lineitem_details.size %]
180 [% price = li.estimated_unit_price %]
181 [% litotal = (price * count) %]
182 [% subtotal = subtotal + litotal %]
184 ident_attr = helpers.get_li_order_ident(li.attributes);
185 SET ident_value = ident_attr.attr_value IF ident_attr;
187 <td>[% target.id %]</td>
188 <td>[% ident_value %]</td>
189 <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
192 <td>[% litotal %]</td>
193 <td>[% li.cancel_reason.label %]</td>
196 [% FOR note IN li.lineitem_notes %]
197 [% IF note.vendor_public == 't' %]
198 <li>[% note.value %]</li>
208 <td>[% subtotal %]</td>
215 Total Line Item Count: [% target.lineitems.size %]
217 WHERE id = 4 AND template =
221 # find a lineitem attribute by name and optional type
223 FOR attr IN li.attributes;
224 IF attr.attr_name == attr_name;
225 IF !attr_type OR attr_type == attr.attr_type;
234 <h2>Purchase Order: [% target.name %] ([% target.id %])</h2>
236 date <b>[% date.format(date.now, '%Y%m%d') %]</b>
240 table td { padding:5px; border:1px solid #aaa;}
241 table { width:95%; border-collapse:collapse; }
242 #vendor-notes { padding:5px; border:1px solid #aaa; }
244 <table id='vendor-table'>
246 <td valign='top'>Vendor</td>
248 <div>[% target.provider.name %]</div>
249 <div>[% target.provider.addresses.0.street1 %]</div>
250 <div>[% target.provider.addresses.0.street2 %]</div>
251 <div>[% target.provider.addresses.0.city %]</div>
252 <div>[% target.provider.addresses.0.state %]</div>
253 <div>[% target.provider.addresses.0.country %]</div>
254 <div>[% target.provider.addresses.0.post_code %]</div>
256 <td valign='top'>Ship to / Bill to</td>
258 <div>[% target.ordering_agency.name %]</div>
259 <div>[% target.ordering_agency.billing_address.street1 %]</div>
260 <div>[% target.ordering_agency.billing_address.street2 %]</div>
261 <div>[% target.ordering_agency.billing_address.city %]</div>
262 <div>[% target.ordering_agency.billing_address.state %]</div>
263 <div>[% target.ordering_agency.billing_address.country %]</div>
264 <div>[% target.ordering_agency.billing_address.post_code %]</div>
270 <fieldset id='vendor-notes'>
271 <legend>Notes to the Vendor</legend>
273 [% FOR note IN target.notes %]
274 [% IF note.vendor_public == 't' %]
275 <li>[% note.value %]</li>
286 <th>ISBN or Item #</th>
297 [% FOR li IN target.lineitems %]
300 [% count = li.lineitem_details.size %]
301 [% price = li.estimated_unit_price %]
302 [% litotal = (price * count) %]
303 [% subtotal = subtotal + litotal %]
305 ident_attr = helpers.get_li_order_ident(li.attributes);
306 SET ident_value = ident_attr.attr_value IF ident_attr;
308 <td>[% target.id %]</td>
309 <td>[% ident_value %]</td>
310 <td>[% PROCESS get_li_attr attr_name = 'title' %]</td>
313 <td>[% litotal %]</td>
316 [% FOR note IN li.lineitem_notes %]
317 [% IF note.vendor_public == 't' %]
318 <li>[% note.value %]</li>
328 <td>[% subtotal %]</td>
335 Total Line Item Count: [% target.lineitems.size %]
338 -- lineitem worksheet
339 UPDATE action_trigger.event_definition SET template =
342 [%- SET li = target; -%]
343 <div class="wrapper">
344 <div class="summary" style='font-size:110%; font-weight:bold;'>
346 <div>Title: [% helpers.get_li_attr("title", "", li.attributes) %]</div>
347 <div>Author: [% helpers.get_li_attr("author", "", li.attributes) %]</div>
348 <div class="count">Item Count: [% li.lineitem_details.size %]</div>
349 <div class="lineid">Lineitem ID: [% li.id %]</div>
350 <div>Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]</div>
351 [% IF li.cancel_reason.label %]
352 <div>[% li.cancel_reason.label %]</div>
355 [% IF li.distribution_formulas.size > 0 %]
357 [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
358 <div>Distribution Formulas: [% forms.join(',') %]</div>
361 [% IF li.lineitem_notes.size > 0 %]
364 [%- FOR note IN li.lineitem_notes -%]
366 [% IF note.alert_text %]
367 [% note.alert_text.code -%]
387 <th>Shelving Location</th>
390 <th>Delayed / Canceled</th>
394 <!-- set detail.owning_lib from fm object to org name -->
395 [% FOREACH detail IN li.lineitem_details %]
396 [% detail.owning_lib = detail.owning_lib.shortname %]
399 [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
401 IF detail.eg_copy_id;
402 SET copy = detail.eg_copy_id;
403 SET cn_label = copy.call_number.label;
406 SET cn_label = detail.cn_label;
410 <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
411 <td style='padding:5px;'>[% detail.owning_lib %]</td>
412 <td style='padding:5px;'>[% IF copy.barcode %]<span class="barcode" >[% detail.barcode %]</span>[% END %]</td>
413 <td style='padding:5px;'>[% IF cn_label %]<span class="cn_label" >[% cn_label %]</span>[% END %]</td>
414 <td style='padding:5px;'>[% IF detail.fund %]<span class="fund">[% detail.fund.code %] ([% detail.fund.year %])</span>[% END %]</td>
415 <td style='padding:5px;'>[% copy.location.name %]</td>
416 <td style='padding:5px;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
417 <td style='padding:5px;'>[% detail.note %]</td>
418 <td style='padding:5px;'>[% detail.cancel_reason.label %]</td>
425 WHERE id = 14 AND template =
428 [%- SET li = target; -%]
429 <div class="wrapper">
430 <div class="summary" style='font-size:110%; font-weight:bold;'>
432 <div>Title: [% helpers.get_li_attr("title", "", li.attributes) %]</div>
433 <div>Author: [% helpers.get_li_attr("author", "", li.attributes) %]</div>
434 <div class="count">Item Count: [% li.lineitem_details.size %]</div>
435 <div class="lineid">Lineitem ID: [% li.id %]</div>
436 <div>Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]</div>
438 [% IF li.distribution_formulas.size > 0 %]
440 [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
441 <div>Distribution Formulas: [% forms.join(',') %]</div>
444 [% IF li.lineitem_notes.size > 0 %]
447 [%- FOR note IN li.lineitem_notes -%]
449 [% IF note.alert_text %]
450 [% note.alert_text.code -%]
470 <th>Shelving Location</th>
476 <!-- set detail.owning_lib from fm object to org name -->
477 [% FOREACH detail IN li.lineitem_details %]
478 [% detail.owning_lib = detail.owning_lib.shortname %]
481 [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
483 IF detail.eg_copy_id;
484 SET copy = detail.eg_copy_id;
485 SET cn_label = copy.call_number.label;
488 SET cn_label = detail.cn_label;
492 <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
493 <td style='padding:5px;'>[% detail.owning_lib %]</td>
494 <td style='padding:5px;'>[% IF copy.barcode %]<span class="barcode" >[% detail.barcode %]</span>[% END %]</td>
495 <td style='padding:5px;'>[% IF cn_label %]<span class="cn_label" >[% cn_label %]</span>[% END %]</td>
496 <td style='padding:5px;'>[% IF detail.fund %]<span class="fund">[% detail.fund.code %] ([% detail.fund.year %])</span>[% END %]</td>
497 <td style='padding:5px;'>[% copy.location.name %]</td>
498 <td style='padding:5px;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
499 <td style='padding:5px;'>[% detail.note %]</td>