Web Staff Client: Duplicate bill payments with double-click

Bug #1749992 reported by Terran McCanna
22
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Evergreen
Fix Released
High
Unassigned
2.12
Fix Released
High
Unassigned
3.0
Fix Released
High
Unassigned

Bug Description

In 3.0.2:

Double-clicking on the Apply Payment button on the patron bills screen applies two payments.

(This problem did not occur in the xul client.)

Changed in evergreen:
milestone: none → 3.1-beta
status: New → Confirmed
importance: Undecided → Medium
Revision history for this message
Jason Stephenson (jstephenson) wrote :

I have confirmed this behavior on test vms running both master and Evergreen 3.0.3.

To reproduce it with concerto data, you can retrieve the patron with barcode 99999355250 and go to the bills tab. This patron should owe $300. Enter $300 into the Payment Received field and then double click on the Apply Payment button as if you were double clicking a desktop icon to open it. If your server/client/connection is slow enough, the payment will get applied twice. This creates 12 payment of $50.00 each instead of only 6. You'll note that there are two payments on each of the patron's transactions.

Revision history for this message
Terran McCanna (tmccanna) wrote :

This bug is also triggered with partial payments, and will also create negative balances.

Example: Create a bill for $1.00 on a test account. Create a payment of .75. Double click - the payment is applied twice, creating a negative balance of $0.50.

Revision history for this message
Jason Stephenson (jstephenson) wrote :

I have been able to confirm this bug on a system running 2.12.8 also.

Changed in evergreen:
assignee: nobody → Jason Stephenson (jstephenson)
Changed in evergreen:
assignee: Jason Stephenson (jstephenson) → nobody
Revision history for this message
Jason Stephenson (jstephenson) wrote :

For the sake of maybe saving someone else some time.

I first tried adding a standard JavaScript handler on the button to disable the button and return true. This did not prevent double clicking from submitting twice.

I also tried setting a ng-dblclick handler on the button to return false, but that didn't work, either.

There very well may be a race condition between double-clicking the button, the submission of the form, and any handler deactivating the button.

I leave this for now to those who are more versed in AngularJS than I.

Changed in evergreen:
importance: Medium → High
Dan Wells (dbw2)
Changed in evergreen:
assignee: nobody → Dan Wells (dbw2)
Revision history for this message
Dan Wells (dbw2) wrote :

Took a stab at this, branch is here:
http://git.evergreen-ils.org/?p=working/Evergreen.git;a=shortlog;h=refs/heads/collab/dbwells/lp1749992_prevent_payment_double_submit

working/collab/dbwells/lp1749992_prevent_payment_double_submit

Changed in evergreen:
assignee: Dan Wells (dbw2) → nobody
tags: added: pullrequest
Revision history for this message
Jason Stephenson (jstephenson) wrote :

Thanks, Dan! That works great!

I signed off and pushed to master, rel_3_0, and rel_2_12. The latter required a little rearrangement during the back port, but I tested on a VM with 2.12 so I know it works and is OK.

Changed in evergreen:
status: Confirmed → Fix Committed
Changed in evergreen:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.