Bug 8054

Summary: can hit submit twice when paying fines
Product: Koha Reporter: Nicole C. Engard <nengard>
Component: CirculationAssignee: Liz Rea <liz>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P5 - low CC: chris, gmcharlt, kyle, liz, m.de.rooy
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 8054 - double clicking can cause duplicate payments/fines
Bug 8054 - double clicking can cause duplicate payments/fines
Bug 8054 - double clicking can cause duplicate payments/fines

Description Nicole C. Engard 2012-05-07 15:00:53 UTC
Is there any way to make it so that you can't accidentally double click on the submit/pay button when dealing with fines?  Sometimes it happens and right now when you try to reverse payments it gets way ugly (another bug report coming) but really it would make the most sense to try and prevent double clicking if at all possible.
Comment 1 Liz Rea 2012-12-27 02:57:38 UTC
kyle has a bit of code for this, I'll try to find it and whack it in on the fines page.
Comment 2 Liz Rea 2012-12-27 03:13:30 UTC
Actually I need to know exactly what I am replicating so I can verify if the fix works - can you give me some concrete steps to follow so I can 1. see the problem and 2. make sure the fix works as we expect?

Thanks!

Liz
Comment 3 Liz Rea 2012-12-27 21:28:05 UTC Comment hidden (obsolete)
Comment 4 Nicole C. Engard 2012-12-28 14:41:27 UTC
I was testing and it did prevent me from being able to submit 100 times :) but when I clicked the 'Pay' button next to one line it instead acted like the 'Pay Amount' button and showed me all that was due.
Comment 5 Liz Rea 2013-01-03 22:41:53 UTC
are you sure that behavior doesn't manifest on master already? Because I didn't change anything that has to do with what you are describing.
Comment 6 Liz Rea 2013-01-03 22:45:06 UTC
I just tested that - it behaves correctly for me.
Comment 7 Liz Rea 2013-01-03 23:03:43 UTC
were you testing this on a patron where you had multiple fines created with the mad clicking? I wonder if the mad clicking duplicate fines are why you see this.

(do note I haven't tested that theory)
Comment 8 Liz Rea 2013-01-03 23:23:35 UTC
I cannot, under any condition I can think of, replicate your problem with this patch (or on master, either).
Comment 9 Kyle M Hall 2013-01-04 17:59:17 UTC Comment hidden (obsolete)
Comment 10 Marcel de Rooy 2013-03-08 11:24:06 UTC
Created attachment 15971 [details] [review]
Bug 8054 - double clicking can cause duplicate payments/fines

Uses preventDoubleForSubmit() to prevent double form submissions in the fines module.

To test:

Create a manual invoice/fine
Create some manual fines, click save like mad - you should get only one fine (without, you will get several if you click madly enough)

Click Pay fines
Pay some fines, clicking save like mad on each. You should only get one payment. (without, you will get several payments)

Create a manual credit
Create a credit, click save like mad. You should only get one credit. (without you will get several if you click madly enough)

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 11 Marcel de Rooy 2013-03-08 11:24:53 UTC
Seems to work fine although I may not be that good in madly clicking..
Comment 12 Marcel de Rooy 2013-03-08 11:26:29 UTC
QA Comment:
Small changes. Using existing jquery to prevent double submission. Improving usability (foolproof..)

Passed QA
Comment 13 Marcel de Rooy 2013-03-08 11:26:52 UTC
QA Comment:
Small changes. Using existing jquery to prevent double submission. Improving usability (foolproof..)

Passed QA
Comment 14 Marcel de Rooy 2013-03-08 11:27:26 UTC
Better in midair collisions :)
Comment 15 Jared Camins-Esakov 2013-03-11 12:14:38 UTC
This patch has been pushed to master.
Comment 16 Chris Cormack 2013-03-16 20:33:42 UTC
Pushed to 3.8.x and 3.10.x will be in 3.8.11 and 3.10.4
Comment 17 Chris Cormack 2013-03-16 20:37:46 UTC
Pushed to 3.10.x and 3.8.x will be in 3.10.4 and 3.8.11