LP#1965579: stop gap for negative bills in OPAC
authorJason Etheridge <jason@EquinoxOLI.org>
Wed, 20 Apr 2022 18:27:14 +0000 (14:27 -0400)
committerGalen Charlton <gmc@equinoxOLI.org>
Thu, 5 May 2022 18:39:39 +0000 (14:39 -0400)
(and zero bills).

If a patron has zero-dollar or negative bills present, the OPAC will
disallow payment and point the patron to their library to resolve.

Cribbed from Terran's rel_3_8_0_temp_fix_for_stripe_negative_bill_bug @ evergreen/pines.git

Signed-off-by: Jason Etheridge <jason@EquinoxOLI.org>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Signed-off-by: Galen Charlton <gmc@equinoxOLI.org>

Open-ILS/src/templates-bootstrap/opac/myopac/charges.tt2
Open-ILS/src/templates/opac/myopac/main.tt2
docs/RELEASE_NOTES_NEXT/miscellaneous.adoc

index efb7276..653740d 100755 (executable)
                 </tr>
             </thead>
             <tbody id='myopac_trans_tbody'>
-                [% c = 0; %]
+                [% c = 0; neg_or_zero = 0; %]
                 [% FOR f IN ctx.fines.grocery %]
                 <tr class ='myopac_trans_row'>
                 [% c = c + 1; %]
                             [% money(f.xact.balance_owed) %]
                         </strong>
                          <input type="hidden" class="fineAmount" value="[% f.xact.balance_owed %]" hidden />
+                        [% IF f.xact.balance_owed <= 0; neg_or_zero = neg_or_zero + 1; END %]
                     </td>
                     
                     <td>
     [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
     <div>[% l('You have no current fines.') %]</div>
     [% ELSIF myopac_cc_allowed %]
-   
-    <div class="my-3">
-        <button type="submit" value="[% l('Pay selected charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]" title="[% l('Pay selected charges') %]" class="btn btn-confirm my-1"
-            id="selectPay"> <i class='fas fa-money-bill-wave' aria-hidden="true"></i> [% l('Pay Selected Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
-    <button type="submit" class="btn btn-confirm my-1"><i class="fas fa-cash-register" aria-hidden="true"></i> [% l('Pay All Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
-    </div>
+        [% IF neg_or_zero > 0 %]
+            <div class="my-3">[% l('There are negative bills on your account that must be resolved before you are able to make a payment. Please contact your library for assistance.') %]
+        [% ELSE %]
+            <div class="my-3">
+                <button type="submit" value="[% l('Pay selected charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]" title="[% l('Pay selected charges') %]" class="btn btn-confirm my-1"
+                    id="selectPay"> <i class='fas fa-money-bill-wave' aria-hidden="true"></i> [% l('Pay Selected Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
+            <button type="submit" class="btn btn-confirm my-1"><i class="fas fa-cash-register" aria-hidden="true"></i> [% l('Pay All Charges') %] - [% money(ctx.user_stats.fines.balance_owed) %]</button>
+            </div>
+        [% END %]
     [% END %]
 [% IF myopac_cc_allowed %]
 </form>
index e6d7f13..87a3b3f 100644 (file)
                 </tr>
             </thead>
             <tbody id='myopac_trans_tbody'>
+                [% neg_or_zero = 0; %]
                 [% FOR f IN ctx.fines.grocery %]
                 <tr id='myopac_trans_row'>
                 
                         <strong>
                             [% money(f.xact.balance_owed) %]
                         </strong>
+                        [% IF f.xact.balance_owed <= 0; neg_or_zero = neg_or_zero + 1; END %]
                     </td>
                     
                     <td>[% f.xact.last_billing_type %]</td>
     [% UNLESS ctx.fines.grocery.size OR ctx.fines.circulation.size %]
     <div>[% l('You have no current fines.') %]</div>
     [% ELSIF myopac_cc_allowed %]
-    <div class="text-left pad-top-ten">
-        <input type="submit"
-            value="[% l('Pay selected charges') %]"
-            title="[% l('Pay selected charges') %]"
-            class="opac-button" />
-    </div>
+        [% IF neg_or_zero > 0 %]
+            <div class="text-left pad-top-ten">[% l('There are negative bills on your account that must be resolved before you are able to make a payment. Please contact your library for assistance.') %]
+        [% ELSE %]
+            <div class="text-left pad-top-ten">
+                <input type="submit"
+                    value="[% l('Pay selected charges') %]"
+                    title="[% l('Pay selected charges') %]"
+                    class="opac-button" />
+            </div>
+        [% END %]
     [% END %]
 [% IF myopac_cc_allowed %]
 </form>
index aca5104..55e809f 100644 (file)
@@ -2,3 +2,4 @@
   items out print templates.
 * The Notices / Action Triggers administration interface (under Local
   Administration) is ported to Angular.
+* Disallow payments via the OPAC if negative or zero billings are present.