LP#1370694 Selfcheck: "Print List" for Holds view does not work
authorTerran McCanna <tmccanna@georgialibraries.org>
Tue, 1 Mar 2016 21:47:20 +0000 (16:47 -0500)
committerGalen Charlton <gmc@esilibrary.com>
Mon, 14 Mar 2016 21:05:31 +0000 (17:05 -0400)
Prior to this change, the holds data was not getting passed to the
print function. Now, it is being captured and passed to the print
function. Because of some sorting discrepancies between the order of
the information being passed from here to the action trigger and the
order that the information is presented when pulled directly out of the
database by the action trigger (which led to data mismatches between the
title/author and the hold status/pickup locations for each printed item),
I modified this script to pass all of the hold information together in the
desired order to the action trigger rather than relying on the template
to match the data coming from the script with the data from the database.

This change requires the action trigger printing template to be updated in
order to work. I've included an upgrade script as well as an update to the
seed data script.

Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Jennifer Pringle <jennifer.pringle@bc.libraries.coop>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_holds_printing.sql [new file with mode: 0644]
Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js
docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_holds.adoc [new file with mode: 0644]

index b69d9dc..eae5327 100644 (file)
@@ -10332,8 +10332,9 @@ $$
     <style> li { padding: 8px; margin 5px; }</style>
     <div>[% date.format %]</div>
     <br/>
     <style> li { padding: 8px; margin 5px; }</style>
     <div>[% date.format %]</div>
     <br/>
-
-    [% user.family_name %], [% user.first_given_name %]
+    Holds for:<br/>
+       [% user.family_name %], [% user.first_given_name %]
+       
     <ol>
     [% FOR hold IN target %]
         [%-
     <ol>
     [% FOR hold IN target %]
         [%-
@@ -10341,9 +10342,9 @@ $$
             SET udata =  user_data.$idx
         -%]
         <li>
             SET udata =  user_data.$idx
         -%]
         <li>
-            <div>Title: [% hold.bib_rec.bib_record.simple_record.title %]</div>
-            <div>Author: [% hold.bib_rec.bib_record.simple_record.author %]</div>
-            <div>Pickup Location: [% hold.pickup_lib.name %]</div>
+            <div>Title: [% udata.item_title %]</div>
+            <div>Author: [% udata.item_author %]</div>
+            <div>Pickup Location: [% udata.pickup_lib %]</b></div>
             <div>Status: 
                 [%- IF udata.ready -%]
                     Ready for pickup
             <div>Status: 
                 [%- IF udata.ready -%]
                     Ready for pickup
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_holds_printing.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_holds_printing.sql
new file mode 100644 (file)
index 0000000..9481302
--- /dev/null
@@ -0,0 +1,41 @@
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+UPDATE action_trigger.event_definition SET template = 
+$$
+[%- USE date -%]
+[%- SET user = target.0.usr -%]
+<div>
+    <style> li { padding: 8px; margin 5px; }</style>
+    <div>[% date.format %]</div>
+    <br/>
+    Holds for:<br/>
+       [% user.family_name %], [% user.first_given_name %]
+       
+    <ol>
+    [% FOR hold IN target %]
+        [%-
+            SET idx = loop.count - 1;
+            SET udata =  user_data.$idx;
+        -%]
+        <li>
+            <div>Title: [% udata.item_title %]</div>
+            <div>Author: [% udata.item_author %]</div>
+            <div>Pickup Location: [% udata.pickup_lib %]</b></div>
+            <div>Status: 
+                [%- IF udata.ready -%]
+                    Ready for pickup
+                [% ELSE %]
+                    #[% udata.queue_position %] of 
+                      [% udata.potential_copies %] copies.
+                [% END %]
+            </div>
+        </li>
+    [% END %]
+    </ol>
+</div>
+
+$$ WHERE id=12;
+
+COMMIT;
\ No newline at end of file
index 62f78d2..9fbd548 100644 (file)
@@ -100,6 +100,7 @@ function SelfCheckManager() {
 
     this.checkouts = [];
     this.itemsOut = [];
 
     this.checkouts = [];
     this.itemsOut = [];
+       this.holds = []; 
 
     // During renewals, keep track of the ID of the previous circulation. 
     // Previous circ is used for tracking failed renewals (for receipts).
 
     // During renewals, keep track of the ID of the previous circulation. 
     // Previous circ is used for tracking failed renewals (for receipts).
@@ -808,6 +809,10 @@ SelfCheckManager.prototype.drawHoldsPage = function() {
 }
 
 SelfCheckManager.prototype.insertHold = function(data) {
 }
 
 SelfCheckManager.prototype.insertHold = function(data) {
+       
+       // store hold data to pass along to receipt printing function
+    this.holds.push(data);     
+       
     var row = this.holdTemplate.cloneNode(true);
 
     if(data.mvr.isbn()) {
     var row = this.holdTemplate.cloneNode(true);
 
     if(data.mvr.isbn()) {
@@ -1427,7 +1432,7 @@ SelfCheckManager.prototype.printItemsOutReceipt = function(callback) {
 }
 
 /**
 }
 
 /**
- * Print a receipt for this user's items out
+ * Print a receipt for this user's holds
  */
 SelfCheckManager.prototype.printHoldsReceipt = function(callback) {
 
  */
 SelfCheckManager.prototype.printHoldsReceipt = function(callback) {
 
@@ -1441,12 +1446,24 @@ SelfCheckManager.prototype.printHoldsReceipt = function(callback) {
     dojo.forEach(this.holds,
         function(data) {
             holdIds.push(data.hold.id());
     dojo.forEach(this.holds,
         function(data) {
             holdIds.push(data.hold.id());
+
+                       //get pickup library info
+            var pu = fieldmapper.standardRequest(['open-ils.actor','open-ils.actor.org_unit.retrieve'],[null,data.hold.pickup_lib()]);
+                       
             if(data.status == 4) {
             if(data.status == 4) {
-                holdData.push({ready : true});
+                holdData.push({
+                                       ready : true,
+                    item_title : data.mvr.title(),
+                                       item_author : data.mvr.author(),
+                                       pickup_lib : pu.name()
+                               });
             } else {
                 holdData.push({
                     queue_position : data.queue_position, 
             } else {
                 holdData.push({
                     queue_position : data.queue_position, 
-                    potential_copies : data.potential_copies
+                    potential_copies : data.potential_copies,
+                    item_title : data.mvr.title(),
+                                       item_author : data.mvr.author(),
+                                       pickup_lib : pu.name()
                 });
             }
         }
                 });
             }
         }
diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_holds.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_holds.adoc
new file mode 100644 (file)
index 0000000..483a329
--- /dev/null
@@ -0,0 +1,5 @@
+Self-Check Printing
+^^^^^^^^^^^^^
+Corrections were made to the Self-Check Holds functionality to allow 
+printing. The change requires that the Self-Checkout Holds Receipt 
+action trigger template be updated in order to work properly.