JBAS-1728 SCKO Fines receipt xacts with >0 balance
authorBill Erickson <berickxx@gmail.com>
Wed, 28 Jun 2017 18:15:19 +0000 (14:15 -0400)
committerBill Erickson <berickxx@gmail.com>
Thu, 21 Mar 2019 19:46:23 +0000 (15:46 -0400)
Only list open transactions with non-zero balances, specifically those
with positive balances.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
KCLS/sql/schema/deploy/selfcheck-email-receipts.sql

index 58965b6..9304804 100644 (file)
@@ -72,6 +72,37 @@ INSERT INTO action_trigger.environment (event_def, path) VALUES
     END IF;
 END $$;
 
+
+UPDATE action_trigger.event_definition SET template =
+$T$
+[%- USE date -%]
+[%- SET user = target -%]
+<div style="page-break-after:always">
+    <style> li { padding: 8px; margin 5px; }</style>
+    <div>[% date.format(date.now, '%m/%d/%Y') %]</div>
+    <br/>
+    [% user.first_given_name %]
+    <ol>
+    [% FOR xact IN user.open_billable_transactions_summary %]
+        [% NEXT 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 %]
+    </ol>
+</div>
+$T$ 
+WHERE hook = 'format.selfcheck.fines';
+
 COMMIT;