Add "parts" to Print Full Pull List and Print Full Pull List (Alternate strategy)
authorJason Etheridge <jason@esilibrary.com>
Wed, 6 Jul 2011 16:05:58 +0000 (12:05 -0400)
committerBill Erickson <berick@esilibrary.com>
Thu, 7 Jul 2011 18:25:15 +0000 (14:25 -0400)
Signed-off-by: Jason Etheridge <jason@esilibrary.com>
Signed-off-by: Bill Erickson <berick@esilibrary.com>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Holds.pm
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql [new file with mode: 0644]
Open-ILS/web/opac/extras/circ/alt_holds_print.html
Open-ILS/web/opac/extras/circ/alt_holds_print.js

index 651e9b5..0a056ac 100644 (file)
@@ -1560,7 +1560,7 @@ sub print_hold_pull_list_stream {
                 "flesh_fields" => {
                     "ahr" => ["usr", "current_copy"],
                     "au"  => ["card"],
-                    "acp" => ["location", "call_number"],
+                    "acp" => ["location", "call_number", "parts"],
                     "acn" => ["record","prefix","suffix"]
                 }
             }
index c7372ed..c739b95 100644 (file)
@@ -8407,11 +8407,11 @@ INSERT INTO action_trigger.event_definition (
 $$
 [%- USE date -%]
 <style>
-    table { border-collapse: collapse; } 
-    td { padding: 5px; border-bottom: 1px solid #888; } 
+    table { border-collapse: collapse; }
+    td { padding: 5px; border-bottom: 1px solid #888; }
     th { font-weight: bold; }
 </style>
-[% 
+[%
     # Sort the holds into copy-location buckets
     # In the main print loop, sort each bucket by callnumber before printing
     SET holds_list = [];
@@ -8438,14 +8438,14 @@ $$
             <th>Author</th>
             <th>Shelving Location</th>
             <th>Call Number</th>
-            <th>Barcode</th>
+            <th>Barcode/Part</th>
             <th>Patron</th>
         </tr>
     </thead>
     <tbody>
     [% FOR loc_data IN holds_list  %]
         [% FOR hold_data IN loc_data.sort('callnumber') %]
-            [% 
+            [%
                 SET hold = hold_data.hold;
                 SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
             %]
@@ -8454,7 +8454,11 @@ $$
                 <td>[% copy_data.author | truncate %]</td>
                 <td>[% hold.current_copy.location.name %]</td>
                 <td>[% hold.current_copy.call_number.label %]</td>
-                <td>[% hold.current_copy.barcode %]</td>
+                <td>[% hold.current_copy.barcode %]
+                    [% FOR part IN hold.current_copy.parts %]
+                       [% part.part.label %]
+                    [% END %]
+                </td>
                 <td>[% hold.usr.card.barcode %]</td>
             </tr>
         [% END %]
@@ -8471,7 +8475,9 @@ INSERT INTO action_trigger.environment (
         (35, 'current_copy.location'),
         (35, 'current_copy.call_number'),
         (35, 'usr.card'),
-        (35, 'pickup_lib')
+        (35, 'pickup_lib'),
+        (35, 'current_copy.parts'),
+        (35, 'current_copy.parts.part')
 ;
 
 -- 0386.data.org-setting-patron-clone-copy-addr.sql
diff --git a/Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql b/Open-ILS/src/sql/Pg/upgrade/xxx.data.hold_pull_list_template.sql
new file mode 100644 (file)
index 0000000..32c9460
--- /dev/null
@@ -0,0 +1,79 @@
+BEGIN;
+
+INSERT INTO config.upgrade_log (version) VALUES ('xxxx');
+
+UPDATE action_trigger.event_definition SET template =
+$$
+[%- USE date -%]
+<style>
+    table { border-collapse: collapse; }
+    td { padding: 5px; border-bottom: 1px solid #888; }
+    th { font-weight: bold; }
+</style>
+[%
+    # Sort the holds into copy-location buckets
+    # In the main print loop, sort each bucket by callnumber before printing
+    SET holds_list = [];
+    SET loc_data = [];
+    SET current_location = target.0.current_copy.location.id;
+    FOR hold IN target;
+        IF current_location != hold.current_copy.location.id;
+            SET current_location = hold.current_copy.location.id;
+            holds_list.push(loc_data);
+            SET loc_data = [];
+        END;
+        SET hold_data = {
+            'hold' => hold,
+            'callnumber' => hold.current_copy.call_number.label
+        };
+        loc_data.push(hold_data);
+    END;
+    holds_list.push(loc_data)
+%]
+<table>
+    <thead>
+        <tr>
+            <th>Title</th>
+            <th>Author</th>
+            <th>Shelving Location</th>
+            <th>Call Number</th>
+            <th>Barcode/Part</th>
+            <th>Patron</th>
+        </tr>
+    </thead>
+    <tbody>
+    [% FOR loc_data IN holds_list  %]
+        [% FOR hold_data IN loc_data.sort('callnumber') %]
+            [%
+                SET hold = hold_data.hold;
+                SET copy_data = helpers.get_copy_bib_basics(hold.current_copy.id);
+            %]
+            <tr>
+                <td>[% copy_data.title | truncate %]</td>
+                <td>[% copy_data.author | truncate %]</td>
+                <td>[% hold.current_copy.location.name %]</td>
+                <td>[% hold.current_copy.call_number.label %]</td>
+                <td>[% hold.current_copy.barcode %]
+                    [% FOR part IN hold.current_copy.parts %]
+                       [% part.part.label %]
+                    [% END %]
+                </td>
+                <td>[% hold.usr.card.barcode %]</td>
+            </tr>
+        [% END %]
+    [% END %]
+    <tbody>
+</table>
+$$
+    WHERE id = 35;
+
+INSERT INTO action_trigger.environment (
+        event_def,
+        path
+    ) VALUES
+        (35, 'current_copy.parts'),
+        (35, 'current_copy.parts.part')
+;
+
+COMMIT;
+
index 5801df2..a7a1619 100644 (file)
@@ -81,7 +81,7 @@
                     <th>Author</th>
                     <th>Shelving Location</th>
                     <th>Call Number</th>
-                    <th>Barcode</th>
+                    <th>Barcode/Part</th>
                 </tr>
             </thead>
             <tbody id='target'>
@@ -94,7 +94,7 @@
                     <td type='opac/slot-data' query='datafield[tag^=1]' limit='1'> </td>
                     <td>${current_copy.location.name}</td>
                     <td>${current_copy.call_number.prefix.label} ${current_copy.call_number.label} ${current_copy.call_number.suffix.label}</td>
-                    <td>${current_copy.barcode}</td>
+                    <td>${current_copy.barcode} ${current_copy.parts_stringified}</td>
                 </tr>
             </tbody>
         </table>
index a3f0378..724e4e7 100644 (file)
@@ -37,6 +37,11 @@ function do_pull_list() {
                 hold.current_copy.call_number.record = hold_fm.current_copy().call_number().record().toHash(true);
                 hold.current_copy.call_number.prefix = hold_fm.current_copy().call_number().prefix().toHash(true);
                 hold.current_copy.call_number.suffix = hold_fm.current_copy().call_number().suffix().toHash(true);
+                hold.current_copy.parts_stringified = '';
+                dojo.forEach( hold_fm.current_copy().parts(), function(part) {
+                    hold.current_copy.parts_stringified += ' ' + part.label();
+                });
+
 
                 // clone the template's html
                 var tr = dojo.clone(