]> git.evergreen-ils.org Git - working/Evergreen.git/blob - Open-ILS/src/sql/Pg/upgrade/0158.data.titles_received_worksheet.sql
Stamping upgrade scripts for Vandelay default match set, with minor adjustments
[working/Evergreen.git] / Open-ILS / src / sql / Pg / upgrade / 0158.data.titles_received_worksheet.sql
1 BEGIN;
2
3 INSERT INTO config.upgrade_log (version) VALUES ('0158');  -- atz
4
5 INSERT INTO action_trigger.hook (key, core_type, description, passive) 
6     VALUES (
7         'format.acqli.html',
8         'jub',
9         'Formats lineitem worksheet for titles received',
10         TRUE
11     );
12
13 INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template)
14     VALUES (
15         14,
16         TRUE,
17         1,
18         'Titles Received Lineitem Worksheet',
19         'format.acqli.html',
20         'NOOP_True',
21         'ProcessTemplate',
22         'print-on-demand',
23 $$
24 [%- USE date -%]
25 [%- SET li = target; -%]
26 <div class="wrapper">
27     <div class="summary">
28         <div class="lineid">Lineitem ID: [% li.id %]</div>
29         <div class="count"><span id="countno">[% li.lineitem_details.size %]</span> items</div>
30         [% IF detail.recv_time %]<div class="dateformat">Expected: [% li.expected_recv_time %]</div>[% END %]
31     </div>
32     <table>
33         <thead>
34             <tr>
35                 <th>Title</th>
36                 <th>Recd.</th>
37                 <th>Barcode</th>
38                 <th>Call Number</th>
39                 <th>Distribution</th>
40                 <th>Notes</th>
41             </tr>
42         </thead>
43         <tbody>
44     [% FOREACH detail IN li.lineitem_details %]
45             <tr>
46                 [% IF loop.first %]
47                 <td rowspan='[% li.lineitem_details.size %]'>
48                  [%- helpers.get_li_attr("title", "", li.attributes) -%]
49                 </td>
50                 [% END %]
51                 <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
52                 <td>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
53                 <td>[% IF detail.barcode   %]<span class="barcode"  >[% detail.barcode   %]</span>[% END %]</td>
54                 <td>[% IF detail.cn_label  %]<span class="cn_label" >[% detail.cn_label  %]</span>[% END %]</td>
55                 <td>
56                     ==&gt; [% detail.owning_lib.shortname %] ([% detail.owning_lib.name %])
57                     [% IF detail.note %]( [% detail.note %] )[% END %]
58                 </td>
59                 <td>
60                     [%- SET notelist = []             -%]
61                     [%- FOR note IN li.lineitem_notes -%]
62                     [%-     notelist.push(note.value) -%]
63                     [%- END                           -%]
64                     [%- notelist.join('<br/>')        -%]
65                 </td>
66             </tr>
67     [% END %]
68         </tbody>
69     </table>
70 </div>
71 $$
72 );
73
74
75 INSERT INTO action_trigger.environment (event_def, path) VALUES
76     ( 14, 'attributes' ),
77     ( 14, 'lineitem_details' ),
78     ( 14, 'lineitem_details.owning_lib' ),
79     ( 14, 'lineitem_notes' )
80 ;
81
82 COMMIT;
83