BEFORE INSERT OR UPDATE ON config.db_patch_dependencies
FOR EACH ROW EXECUTE PROCEDURE evergreen.array_overlap_check ('deprecates');
-INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0641', :eg_version); -- tsbere/phasefx
+INSERT INTO config.upgrade_log (version, applied_to) VALUES ('0642', :eg_version); -- berick/senator
CREATE TABLE config.bib_source (
id SERIAL PRIMARY KEY,
--- /dev/null
+-- Evergreen DB patch 0642.data.acq-worksheet-hold-count.sql
+BEGIN;
+
+-- check whether patch can be applied
+SELECT evergreen.upgrade_deps_block_check('0642', :eg_version);
+
+UPDATE action_trigger.event_definition SET template =
+$$
+[%- USE date -%]
+[%- SET li = target; -%]
+<div class="wrapper">
+ <div class="summary" style='font-size:110%; font-weight:bold;'>
+
+ <div>Title: [% helpers.get_li_attr("title", "", li.attributes) %]</div>
+ <div>Author: [% helpers.get_li_attr("author", "", li.attributes) %]</div>
+ <div class="count">Item Count: [% li.lineitem_details.size %]</div>
+ <div class="lineid">Lineitem ID: [% li.id %]</div>
+ <div>Open Holds: [% helpers.bre_open_hold_count(li.eg_bib_id) %]</div>
+
+ [% IF li.distribution_formulas.size > 0 %]
+ [% SET forms = [] %]
+ [% FOREACH form IN li.distribution_formulas; forms.push(form.formula.name); END %]
+ <div>Distribution Formulas: [% forms.join(',') %]</div>
+ [% END %]
+
+ [% IF li.lineitem_notes.size > 0 %]
+ Lineitem Notes:
+ <ul>
+ [%- FOR note IN li.lineitem_notes -%]
+ <li>
+ [% IF note.alert_text %]
+ [% note.alert_text.code -%]
+ [% IF note.value -%]
+ : [% note.value %]
+ [% END %]
+ [% ELSE %]
+ [% note.value -%]
+ [% END %]
+ </li>
+ [% END %]
+ </ul>
+ [% END %]
+ </div>
+ <br/>
+ <table>
+ <thead>
+ <tr>
+ <th>Branch</th>
+ <th>Barcode</th>
+ <th>Call Number</th>
+ <th>Fund</th>
+ <th>Shelving Location</th>
+ <th>Recd.</th>
+ <th>Notes</th>
+ </tr>
+ </thead>
+ <tbody>
+ [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
+ [%
+ IF detail.eg_copy_id;
+ SET copy = detail.eg_copy_id;
+ SET cn_label = copy.call_number.label;
+ ELSE;
+ SET copy = detail;
+ SET cn_label = detail.cn_label;
+ END
+ %]
+ <tr>
+ <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
+ <td style='padding:5px;'>[% detail.owning_lib.shortname %]</td>
+ <td style='padding:5px;'>[% IF copy.barcode %]<span class="barcode" >[% detail.barcode %]</span>[% END %]</td>
+ <td style='padding:5px;'>[% IF cn_label %]<span class="cn_label" >[% cn_label %]</span>[% END %]</td>
+ <td style='padding:5px;'>[% IF detail.fund %]<span class="fund">[% detail.fund.code %] ([% detail.fund.year %])</span>[% END %]</td>
+ <td style='padding:5px;'>[% copy.location.name %]</td>
+ <td style='padding:5px;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
+ <td style='padding:5px;'>[% detail.note %]</td>
+ </tr>
+ [% END %]
+ </tbody>
+ </table>
+</div>
+$$
+WHERE id = 14;
+
+COMMIT;