From 4e05b430f652de9368160745a319dce675833803 Mon Sep 17 00:00:00 2001 From: Terran McCanna Date: Tue, 1 Mar 2016 17:35:28 -0500 Subject: [PATCH] LP#1551447 Selfcheck: Printing Fines Prints All Open Transactions This corrects the behavior of the selfcheck fines receipt print template. Prior to this, it printed all open billable transactions (eg, every item that the patron had checked out) regardless of whether or not it had bills associated with it. This adds a small bit of logic to the template to check for a balance due. It also updates the javascript to check for a balance on the account before launching the print function to prevent the system from taking unnecessary action. This includes a SQL upgrade script to update the Self-Checked Fines Receipt template for systems that are already in production, as well as including an update to the seed data. 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 | 27 +++++++------- .../XXXX.data.selfcheck_fines_printing.sql | 36 +++++++++++++++++++ .../js/ui/default/circ/selfcheck/selfcheck.js | 3 +- .../Circulation/selfcheck_printing_fines.adoc | 6 ++++ 4 files changed, 59 insertions(+), 13 deletions(-) create mode 100644 Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_fines_printing.sql create mode 100644 docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_fines.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 9e9e09a991..b69d9dc6be 100644 --- a/Open-ILS/src/sql/Pg/950.data.seed-values.sql +++ b/Open-ILS/src/sql/Pg/950.data.seed-values.sql @@ -10392,21 +10392,24 @@ $$
[% date.format %]

+ Fines for:
[% user.family_name %], [% user.first_given_name %]
    [% FOR xact IN user.open_billable_transactions_summary %] -
  1. -
    Details: - [% IF xact.xact_type == 'circulation' %] - [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] - [% ELSE %] - [%- xact.last_billing_type -%] - [% END %] -
    -
    Total Billed: [% xact.total_owed %]
    -
    Total Paid: [% xact.total_paid %]
    -
    Balance Owed : [% xact.balance_owed %]
    -
  2. + [% IF xact.balance_owed > 0 %] +
  3. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  4. + [% END %] [% END %]
diff --git a/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_fines_printing.sql b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_fines_printing.sql new file mode 100644 index 0000000000..84837be499 --- /dev/null +++ b/Open-ILS/src/sql/Pg/upgrade/XXXX.data.selfcheck_fines_printing.sql @@ -0,0 +1,36 @@ +BEGIN; + +SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version); + +UPDATE action_trigger.event_definition SET template = +$$ +[%- USE date -%] +[%- SET user = target -%] +
+ +
[% date.format %]
+
+ Fines for:
+ [% user.family_name %], [% user.first_given_name %] +
    + [% FOR xact IN user.open_billable_transactions_summary %] + [% IF xact.balance_owed > 0 %] +
  1. +
    Details: + [% IF xact.xact_type == 'circulation' %] + [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%] + [% ELSE %] + [%- xact.last_billing_type -%] + [% END %] +
    +
    Total Billed: [% xact.total_owed %]
    +
    Total Paid: [% xact.total_paid %]
    +
    Balance Owed : [% xact.balance_owed %]
    +
  2. + [% END %] + [% END %] +
+
+$$ WHERE id=13; + +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 27745f6c33..62f78d2325 100644 --- a/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js +++ b/Open-ILS/web/js/ui/default/circ/selfcheck/selfcheck.js @@ -1518,10 +1518,11 @@ SelfCheckManager.prototype.printPaymentReceipt = function(response, callback) { } /** - * Print a receipt for this user's items out + * Print a receipt for this user's fines */ SelfCheckManager.prototype.printFinesReceipt = function(callback) { + if(!this.creditPayableBalance.length) return; progressDialog.show(true); var params = [ diff --git a/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_fines.adoc b/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_fines.adoc new file mode 100644 index 0000000000..8093e269ef --- /dev/null +++ b/docs/RELEASE_NOTES_NEXT/Circulation/selfcheck_printing_fines.adoc @@ -0,0 +1,6 @@ +Self-Check Printing +^^^^^^^^^^^^^ +Corrections were made to the Self-Check Fines printing functionality +to prevent open transactions with no balance on them from printing. +The change requires that the Self-Checkout Fines Receipt action +trigger template be updated in order to work properly. -- 2.43.2