[open-ils-commits] r15494 - in trunk/Open-ILS/src: perlmods/OpenILS/Application/Trigger sql/Pg sql/Pg/upgrade (erickson)

svn at svn.open-ils.org svn at svn.open-ils.org
Wed Feb 10 12:49:50 EST 2010


Author: erickson
Date: 2010-02-10 12:49:46 -0500 (Wed, 10 Feb 2010)
New Revision: 15494

Added:
   trunk/Open-ILS/src/sql/Pg/upgrade/0158.data.titles_received_worksheet.sql
Modified:
   trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
   trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
   trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
Log:
Patch from Joe Atzberger to add a line item 'worksheet' print template and a helper routine for extracting lineitem attributes

Modified: trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm
===================================================================
--- trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm	2010-02-10 17:48:17 UTC (rev 15493)
+++ trunk/Open-ILS/src/perlmods/OpenILS/Application/Trigger/Reactor.pm	2010-02-10 17:49:46 UTC (rev 15494)
@@ -15,7 +15,6 @@
 
 
 
-
 # helper functions inserted into the TT environment
 my $_TT_helpers = {
 
@@ -87,6 +86,18 @@
         my($org_id, $setting) = @_;
         return $U->ou_ancestor_setting_value($org_id, $setting);
     },
+
+    # returns matching line item attribute, or undef
+    get_li_attr => sub {
+        my ($name, $type, $attr) = @_;
+        # use Data::Dumper; $logger->warn("get_li_attr: " . Dumper($attr));
+        ($name and @$attr) or return;
+        foreach (@$attr) {
+            $_->attr_name eq $name or next;
+            return $_->attr_value if (! $type) or $type eq $_->attr_type;
+        }
+        return;
+    },
 };
 
 

Modified: trunk/Open-ILS/src/sql/Pg/002.schema.config.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-02-10 17:48:17 UTC (rev 15493)
+++ trunk/Open-ILS/src/sql/Pg/002.schema.config.sql	2010-02-10 17:49:46 UTC (rev 15494)
@@ -51,7 +51,7 @@
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0157'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0158'); -- atz
 
 CREATE TABLE config.bib_source (
 	id		SERIAL	PRIMARY KEY,

Modified: trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-02-10 17:48:17 UTC (rev 15493)
+++ trunk/Open-ILS/src/sql/Pg/950.data.seed-values.sql	2010-02-10 17:49:46 UTC (rev 15494)
@@ -3815,7 +3815,83 @@
 $$
 );
 
+INSERT INTO action_trigger.hook (key, core_type, description, passive) 
+    VALUES (
+        'format.acqli.html',
+        'jub',
+        'Formats lineitem worksheet for titles received',
+        TRUE
+    );
 
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template)
+    VALUES (
+        14,
+        TRUE,
+        1,
+        'Titles Received Lineitem Worksheet',
+        'format.acqli.html',
+        'NOOP_True',
+        'ProcessTemplate',
+        'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET li = target; -%]
+<div class="wrapper">
+    <div class="summary">
+        <div class="lineid">Lineitem ID: [% li.id %]</div>
+        <div class="count"><span id="countno">[% li.lineitem_details.size %]</span> items</div>
+        [% IF detail.recv_time %]<div class="dateformat">Expected: [% li.expected_recv_time %]</div>[% END %]
+    </div>
+    <table>
+        <thead>
+            <tr>
+                <th>Title</th>
+                <th>Recd.</th>
+                <th>Barcode</th>
+                <th>Call Number</th>
+                <th>Distribution</th>
+                <th>Notes</th>
+            </tr>
+        </thead>
+        <tbody>
+    [% FOREACH detail IN li.lineitem_details %]
+            <tr>
+                [% IF loop.first %]
+                <td rowspan='[% li.lineitem_details.size %]'>
+                 [%- helpers.get_li_attr("title", "", li.attributes) -%]
+                </td>
+                [% END %]
+                <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
+                <td>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
+                <td>[% IF detail.barcode   %]<span class="barcode"  >[% detail.barcode   %]</span>[% END %]</td>
+                <td>[% IF detail.cn_label  %]<span class="cn_label" >[% detail.cn_label  %]</span>[% END %]</td>
+                <td>
+                    ==&gt; [% detail.owning_lib.shortname %] ([% detail.owning_lib.name %])
+                    [% IF detail.note %]( [% detail.note %] )[% END %]
+                </td>
+                <td>
+                    [%- SET notelist = []             -%]
+                    [%- FOR note IN li.lineitem_notes -%]
+                    [%-     notelist.push(note.value) -%]
+                    [%- END                           -%]
+                    [%- notelist.join('<br/>')        -%]
+                </td>
+            </tr>
+    [% END %]
+        </tbody>
+    </table>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    ( 14, 'attributes' ),
+    ( 14, 'lineitem_details' ),
+    ( 14, 'lineitem_details.owning_lib' ),
+    ( 14, 'lineitem_notes' )
+;
+
 INSERT INTO action_trigger.environment ( event_def, path) VALUES
     ( 13, 'open_billable_transactions_summary.circulation' );
 

Added: trunk/Open-ILS/src/sql/Pg/upgrade/0158.data.titles_received_worksheet.sql
===================================================================
--- trunk/Open-ILS/src/sql/Pg/upgrade/0158.data.titles_received_worksheet.sql	                        (rev 0)
+++ trunk/Open-ILS/src/sql/Pg/upgrade/0158.data.titles_received_worksheet.sql	2010-02-10 17:49:46 UTC (rev 15494)
@@ -0,0 +1,83 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0158');  -- atz
+
+INSERT INTO action_trigger.hook (key, core_type, description, passive) 
+    VALUES (
+        'format.acqli.html',
+        'jub',
+        'Formats lineitem worksheet for titles received',
+        TRUE
+    );
+
+INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, validator, reactor, granularity, template)
+    VALUES (
+        14,
+        TRUE,
+        1,
+        'Titles Received Lineitem Worksheet',
+        'format.acqli.html',
+        'NOOP_True',
+        'ProcessTemplate',
+        'print-on-demand',
+$$
+[%- USE date -%]
+[%- SET li = target; -%]
+<div class="wrapper">
+    <div class="summary">
+        <div class="lineid">Lineitem ID: [% li.id %]</div>
+        <div class="count"><span id="countno">[% li.lineitem_details.size %]</span> items</div>
+        [% IF detail.recv_time %]<div class="dateformat">Expected: [% li.expected_recv_time %]</div>[% END %]
+    </div>
+    <table>
+        <thead>
+            <tr>
+                <th>Title</th>
+                <th>Recd.</th>
+                <th>Barcode</th>
+                <th>Call Number</th>
+                <th>Distribution</th>
+                <th>Notes</th>
+            </tr>
+        </thead>
+        <tbody>
+    [% FOREACH detail IN li.lineitem_details %]
+            <tr>
+                [% IF loop.first %]
+                <td rowspan='[% li.lineitem_details.size %]'>
+                 [%- helpers.get_li_attr("title", "", li.attributes) -%]
+                </td>
+                [% END %]
+                <!-- acq.lineitem_detail.id = [%- detail.id -%] -->
+                <td>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
+                <td>[% IF detail.barcode   %]<span class="barcode"  >[% detail.barcode   %]</span>[% END %]</td>
+                <td>[% IF detail.cn_label  %]<span class="cn_label" >[% detail.cn_label  %]</span>[% END %]</td>
+                <td>
+                    ==&gt; [% detail.owning_lib.shortname %] ([% detail.owning_lib.name %])
+                    [% IF detail.note %]( [% detail.note %] )[% END %]
+                </td>
+                <td>
+                    [%- SET notelist = []             -%]
+                    [%- FOR note IN li.lineitem_notes -%]
+                    [%-     notelist.push(note.value) -%]
+                    [%- END                           -%]
+                    [%- notelist.join('<br/>')        -%]
+                </td>
+            </tr>
+    [% END %]
+        </tbody>
+    </table>
+</div>
+$$
+);
+
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    ( 14, 'attributes' ),
+    ( 14, 'lineitem_details' ),
+    ( 14, 'lineitem_details.owning_lib' ),
+    ( 14, 'lineitem_notes' )
+;
+
+COMMIT;
+



More information about the open-ils-commits mailing list