From 107eac51aa2378515eb92da6c8604466bf045608 Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Tue, 1 Mar 2016 16:47:20 -0500 Subject: [PATCH] LP#1370694 Selfcheck: "Print List" for Holds view does not work 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 Signed-off-by: Jennifer Pringle Signed-off-by: Galen Charlton --- Open-ILS/src/sql/Pg/950.data.seed-values.sql | 11 ++--- .../XXXX.data.selfcheck_holds_printing.sql | 41 +++++++++++++++++++ .../js/ui/default/circ/selfcheck/selfcheck.js | 23 +++++++++-- .../Circulation/selfcheck_printing_holds.adoc | 5 +++ 4 files changed, 72 insertions(+), 8 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_holds_printing.sql create mode 100644 docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_holds.adoc diff --git a/Open-ILS/src/sql/Pg/950.data.seed-values.sql b/Open-ILS/src/sql/Pg/950.data.seed-values.sql index 00a5721e2d..104c4ef3ff 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -8912,8 +8912,9 @@ $$
[% date.format %]

- - [% user.family_name %], [% user.first_given_name %] + Holds for:
+ [% user.family_name %], [% user.first_given_name %] +
    [% FOR hold IN target %] [%- @@ -8921,9 +8922,9 @@ $$ SET udata = user_data.$idx -%]
  1. -
    Title: [% hold.bib_rec.bib_record.simple_record.title %]
    -
    Author: [% hold.bib_rec.bib_record.simple_record.author %]
    -
    Pickup Location: [% hold.pickup_lib.name %]
    +
    Title: [% udata.item_title %]
    +
    Author: [% udata.item_author %]
    +
    Pickup Location: [% udata.pickup_lib %]
    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 index 0000000000..9481302399 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_holds_printing.sql @@ -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 -%] +
    + +
    [% date.format %]
    +
    + Holds for:
    + [% user.family_name %], [% user.first_given_name %] + +
      + [% FOR hold IN target %] + [%- + SET idx = loop.count - 1; + SET udata = user_data.$idx; + -%] +
    1. +
      Title: [% udata.item_title %]
      +
      Author: [% udata.item_author %]
      +
      Pickup Location: [% udata.pickup_lib %]
      +
      Status: + [%- IF udata.ready -%] + Ready for pickup + [% ELSE %] + #[% udata.queue_position %] of + [% udata.potential_copies %] copies. + [% END %] +
      +
    2. + [% END %] +
    +
    + +$$ WHERE id=12; + +COMMIT; \ No newline at end of file diff --git a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js index 9a02abe1fe..41acf7cd73 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -100,6 +100,7 @@ function SelfCheckManager() { 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). @@ -807,6 +808,10 @@ SelfCheckManager.prototype.drawHoldsPage = function() { } 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()) { @@ -1426,7 +1431,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) { @@ -1440,12 +1445,24 @@ SelfCheckManager.prototype.printHoldsReceipt = function(callback) { 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) { - 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, - 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 index 0000000000..483a329ec6 --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_holds.adoc @@ -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. -- 2.43.2