LP#1929741: update LI worksheet template
authorGalen Charlton <gmc@equinoxOLI.org>
Sat, 5 Feb 2022 17:33:30 +0000 (12:33 -0500)
committerJane Sandberg <js7389@princeton.edu>
Sun, 2 Oct 2022 15:02:49 +0000 (08:02 -0700)
This commit adds back various elements to better match the
Dojo version of the template.

This commmit also corrects some IDs in the upgrade script.

Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>
Signed-off-by: Ruth Frasur <rfrasur@library.in.gov>
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jane Sandberg <js7389@princeton.edu>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.picklist-po-angular.sql

index 95cda0b..7935ff9 100644 (file)
@@ -22281,6 +22281,7 @@ VALUES (
 $TEMPLATE$
 [%- 
   USE money=format('%.2f');
+  USE date;
   SET li = template_data.lineitem;
   SET title = '';
   SET author = '';
@@ -22295,13 +22296,88 @@ $TEMPLATE$
   END;
 -%]
 
-<div>Title: [% title.substr(0, 80) %][% IF title.length > 80 %]...[% END %]</div>
-<div>Author: [% author %]</div>
-<div>Item Count: [% li.lineitem_details.size %]</div>
-<div>Lineitem ID: [% li.id %]</div>
-<div>PO # : [% li.purchase_order%]</div>
-<div>Est. Price: [% money(li.estimated_unit_price) %]</div>
+<div class="wrapper">
+    <div class="summary" style='font-size:110%; font-weight:bold;'>
+        <div>Title: [% title.substr(0, 80) %][% IF title.length > 80 %]...[% END %]</div>
+        <div>Author: [% author %]</div>
+        <div>Item Count: [% li.lineitem_details.size %]</div>
+        <div>Lineitem ID: [% li.id %]</div>
+        <div>PO # : [% li.purchase_order %]</div>
+        <div>Est. Price: [% money(li.estimated_unit_price) %]</div>
+        <div>Open Holds: [% template_data.hold_count %]</div>
+        [% IF li.cancel_reason.label %]
+        <div>[% li.cancel_reason.label %]</div>
+        [% END %]
+
+        [% 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>
+                <th>Delayed / Canceled</th>
+            </tr>
+        </thead>
+        <tbody>
+        <!-- set detail.owning_lib from fm object to org name -->
+        [% FOREACH detail IN li.lineitem_details %]
+            [% detail.owning_lib = detail.owning_lib.shortname %]
+        [% END %]
 
+        [% 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 %]</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">[% date.format(helpers.format_date(detail.recv_time, staff_org_timezone), '%x %r', locale) %]</span>[% END %]</td>
+                <td style='padding:5px;'>[% detail.note %]</td>
+                <td style='padding:5px;'>[% detail.cancel_reason.label %]</td>
+            </tr>
+        [% END %]
+        </tbody>
+    </table>
+</div>
 $TEMPLATE$
 );
 
index 242da10..610adc3 100644 (file)
@@ -54,10 +54,11 @@ VALUES (
 INSERT INTO config.print_template
     (id, name, label, owner, active, locale, template)
 VALUES (
-    4, 'lineitem_worksheet', 'Lineitem Worksheet', 1, TRUE, 'en-US',
+    5, 'lineitem_worksheet', 'Lineitem Worksheet', 1, TRUE, 'en-US',
 $TEMPLATE$
 [%- 
   USE money=format('%.2f');
+  USE date;
   SET li = template_data.lineitem;
   SET title = '';
   SET author = '';
@@ -72,19 +73,94 @@ $TEMPLATE$
   END;
 -%]
 
-<div>Title: [% title.substr(0, 80) %][% IF title.length > 80 %]...[% END %]</div>
-<div>Author: [% author %]</div>
-<div>Item Count: [% li.lineitem_details.size %]</div>
-<div>Lineitem ID: [% li.id %]</div>
-<div>PO # : [% li.purchase_order%]</div>
-<div>Est. Price: [% money(li.estimated_unit_price) %]</div>
+<div class="wrapper">
+    <div class="summary" style='font-size:110%; font-weight:bold;'>
+        <div>Title: [% title.substr(0, 80) %][% IF title.length > 80 %]...[% END %]</div>
+        <div>Author: [% author %]</div>
+        <div>Item Count: [% li.lineitem_details.size %]</div>
+        <div>Lineitem ID: [% li.id %]</div>
+        <div>PO # : [% li.purchase_order %]</div>
+        <div>Est. Price: [% money(li.estimated_unit_price) %]</div>
+        <div>Open Holds: [% template_data.hold_count %]</div>
+        [% IF li.cancel_reason.label %]
+        <div>[% li.cancel_reason.label %]</div>
+        [% END %]
+
+        [% 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>
+                <th>Delayed / Canceled</th>
+            </tr>
+        </thead>
+        <tbody>
+        <!-- set detail.owning_lib from fm object to org name -->
+        [% FOREACH detail IN li.lineitem_details %]
+            [% detail.owning_lib = detail.owning_lib.shortname %]
+        [% END %]
 
+        [% 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 %]</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">[% date.format(helpers.format_date(detail.recv_time, staff_org_timezone), '%x %r', locale) %]</span>[% END %]</td>
+                <td style='padding:5px;'>[% detail.note %]</td>
+                <td style='padding:5px;'>[% detail.cancel_reason.label %]</td>
+            </tr>
+        [% END %]
+        </tbody>
+    </table>
+</div>
 $TEMPLATE$
 );
 
 INSERT INTO config.print_template
     (id, name, label, owner, active, locale, template)
-VALUES (5, 'purchase_order', 'Purchase Order', 1, TRUE, 'en-US', 
+VALUES (6, 'purchase_order', 'Purchase Order', 1, TRUE, 'en-US', 
 $TEMPLATE$
 
 [%-