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 <tmccanna@georgialibraries.org>
Signed-off-by: Jennifer Pringle <jennifer.pringle@bc.libraries.coop>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
<div>[% date.format %]</div>
<br/>
+ Fines for:<br/>
[% user.family_name %], [% user.first_given_name %]
<ol>
[% FOR xact IN user.open_billable_transactions_summary %]
- <li>
- <div>Details:
- [% IF xact.xact_type == 'circulation' %]
- [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
- [% ELSE %]
- [%- xact.last_billing_type -%]
- [% END %]
- </div>
- <div>Total Billed: [% xact.total_owed %]</div>
- <div>Total Paid: [% xact.total_paid %]</div>
- <div>Balance Owed : [% xact.balance_owed %]</div>
- </li>
+ [% IF xact.balance_owed > 0 %]
+ <li>
+ <div>Details:
+ [% IF xact.xact_type == 'circulation' %]
+ [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
+ [% ELSE %]
+ [%- xact.last_billing_type -%]
+ [% END %]
+ </div>
+ <div>Total Billed: [% xact.total_owed %]</div>
+ <div>Total Paid: [% xact.total_paid %]</div>
+ <div>Balance Owed : [% xact.balance_owed %]</div>
+ </li>
+ [% END %]
[% END %]
</ol>
</div>
--- /dev/null
+BEGIN;
+
+SELECT evergreen.upgrade_deps_block_check('XXXX', :eg_version);
+
+UPDATE action_trigger.event_definition SET template =
+$$
+[%- USE date -%]
+[%- SET user = target -%]
+<div>
+ <style> li { padding: 8px; margin 5px; }</style>
+ <div>[% date.format %]</div>
+ <br/>
+ Fines for:<br/>
+ [% user.family_name %], [% user.first_given_name %]
+ <ol>
+ [% FOR xact IN user.open_billable_transactions_summary %]
+ [% IF xact.balance_owed > 0 %]
+ <li>
+ <div>Details:
+ [% IF xact.xact_type == 'circulation' %]
+ [%- helpers.get_copy_bib_basics(xact.circulation.target_copy).title -%]
+ [% ELSE %]
+ [%- xact.last_billing_type -%]
+ [% END %]
+ </div>
+ <div>Total Billed: [% xact.total_owed %]</div>
+ <div>Total Paid: [% xact.total_paid %]</div>
+ <div>Balance Owed : [% xact.balance_owed %]</div>
+ </li>
+ [% END %]
+ [% END %]
+ </ol>
+</div>
+$$ WHERE id=13;
+
+COMMIT;
\ No newline at end of file
}
/**
- * 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 = [
--- /dev/null
+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.