added some data to the acq lineitem worksheet. added distib formula link from lineit...
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Mar 2010 19:50:43 +0000 (19:50 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Mar 2010 19:50:43 +0000 (19:50 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@15960 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/examples/fm_IDL.xml
Open-ILS/src/sql/Pg/002.schema.config.sql
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/0208.data.titles_received_worksheet_tweaks.sql [new file with mode: 0644]

index d6844f0..1d5e262 100644 (file)
@@ -5261,6 +5261,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <field reporter:label="Descriptive Attributes" name="attributes" oils_persist:virtual="true" reporter:datatype="link" />
                        <field reporter:label="Line Item Details" name="lineitem_details" oils_persist:virtual="true" reporter:datatype="link" />
                        <field reporter:label="Line Item Notes" name="lineitem_notes" oils_persist:virtual="true" reporter:datatype="link" />
+                       <field reporter:label="Distribution Formulas" name="distribution_formulas" oils_persist:virtual="true" reporter:datatype="link" />
                </fields>
                <links>
                        <link field="selector" reltype="has_a" key="id" map="" class="au"/>
@@ -5274,6 +5275,7 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA
                        <link field="lineitem_details" reltype="has_many" key="lineitem" map="" class="acqlid"/>
                        <link field="lineitem_notes" reltype="has_many" key="lineitem" map="" class="acqlin"/>
                        <link field="cancel_reason" reltype="has_a" key="id" map="" class="acqcr"/>
+                       <link field="distribution_formulas" reltype="has_many" key="lineitem" map="" class="acqdfa"/>
                </links>
                <permacrud xmlns="http://open-ils.org/spec/opensrf/IDL/permacrud/v1">
             <retrieve permission="CREATE_PURCHASE_ORDER VIEW_PURCHASE_ORDER CREATE_PICKLIST VIEW_PICKLIST">
index c4820b9..8d51d8a 100644 (file)
@@ -59,7 +59,7 @@ CREATE TABLE config.upgrade_log (
     install_date    TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW()
 );
 
-INSERT INTO config.upgrade_log (version) VALUES ('0207'); -- Scott McKellar
+INSERT INTO config.upgrade_log (version) VALUES ('0208'); -- berick
 
 CREATE TABLE config.bib_source (
        id              SERIAL  PRIMARY KEY,
index ac29b8c..d60c09d 100644 (file)
@@ -3889,7 +3889,7 @@ INSERT INTO action_trigger.event_definition (id, active, owner, name, hook, vali
         14,
         TRUE,
         1,
-        'Titles Received Lineitem Worksheet',
+        'Lineitem Worksheet',
         'format.acqli.html',
         'NOOP_True',
         'ProcessTemplate',
@@ -3898,47 +3898,70 @@ $$
 [%- USE date -%]
 [%- SET li = target; -%]
 <div class="wrapper">
-    <div class="summary">
+    <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 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 %]
+
+        [% 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>Title</th>
-                <th>Recd.</th>
+                <th>Branch</th>
                 <th>Barcode</th>
                 <th>Call Number</th>
-                <th>Distribution</th>
+                <th>Fund</th>
+                <th>Recd.</th>
                 <th>Notes</th>
             </tr>
         </thead>
         <tbody>
-    [% FOREACH detail IN li.lineitem_details %]
+        [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
+            [% 
+                IF copy.eg_copy_id;
+                    SET copy = copy.eg_copy_id;
+                    SET cn_label = copy.call_number.label;
+                ELSE; 
+                    SET copy = detail; 
+                    SET cn_label = detail.cn_label;
+                END 
+            %]
             <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>
+                <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;'>[% IF detail.recv_time %]<span class="recv_time">[% detail.recv_time %]</span>[% END %]</td>
+                <td style='padding:5px;'>[% detail.note %]</td>
             </tr>
-    [% END %]
+        [% END %]
         </tbody>
     </table>
 </div>
diff --git a/Open-ILS/src/sql/Pg/upgrade/0208.data.titles_received_worksheet_tweaks.sql b/Open-ILS/src/sql/Pg/upgrade/0208.data.titles_received_worksheet_tweaks.sql
new file mode 100644 (file)
index 0000000..0c6e995
--- /dev/null
@@ -0,0 +1,92 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('0208'); 
+
+UPDATE action_trigger.event_definition SET 
+    name = 'Lineitem Worksheet',
+    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>
+
+        [% 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>Recd.</th>
+                <th>Notes</th>
+            </tr>
+        </thead>
+        <tbody>
+        [% FOREACH detail IN li.lineitem_details.sort('owning_lib') %]
+            [% 
+                IF copy.eg_copy_id;
+                    SET copy = copy.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;'>[% 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;
+
+
+INSERT INTO action_trigger.environment (event_def, path) VALUES
+    ( 14, 'lineitem_notes.alert_text' ),
+    ( 14, 'distribution_formulas.formula' ),
+    ( 14, 'lineitem_details.fund' ),
+    ( 14, 'lineitem_details.eg_copy_id' ),
+    ( 14, 'lineitem_details.eg_copy_id.call_number' )
+;
+
+COMMIT;
+