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>
Signed-off-by: Jared Camins-Esakov <jcamins@cpbibliography.com>
This commit is contained in:
Liz Rea 2012-12-27 16:10:26 +13:00 committed by Jared Camins-Esakov
parent 415af04cd7
commit 6c6fe37ced
4 changed files with 16 additions and 6 deletions

View file

@ -5,6 +5,7 @@
//<![CDATA[
$(document).ready(function(){
$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
$('#mancredit').preventDoubleFormSubmit();
});
//]]>
</script>
@ -32,7 +33,7 @@ $(document).ready(function(){
</ul>
<div class="tabs-container">
<form action="/cgi-bin/koha/members/mancredit.pl" method="post">
<form action="/cgi-bin/koha/members/mancredit.pl" method="post" id="mancredit">
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
<fieldset class="rows">

View file

@ -5,6 +5,7 @@
//<![CDATA[
$(document).ready(function(){
$("fieldset.rows input").keydown(function(e){ return checkEnter(e); });
$('#maninvoice').preventDoubleFormSubmit();
});
//]]>
</script>
@ -37,7 +38,7 @@ $(document).ready(function(){
ERROR an invalid itemnumber was entered, please hit back and try again
[% END %]
[% ELSE %]
<form action="/cgi-bin/koha/members/maninvoice.pl" method="post"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
<form action="/cgi-bin/koha/members/maninvoice.pl" method="post" id="maninvoice"><input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrowernumber %]" />
<fieldset class="rows">
<legend>Manual Invoice</legend>
<ol>

View file

@ -5,6 +5,7 @@
<script type= "text/javascript">
//<![CDATA[
$(document).ready(function(){
$('#pay-fines-form').preventDoubleFormSubmit();
$("#woall").click(function(event){
var answer = confirm(_("Are you sure you want to write off [% total | format('%.2f') %] in outstanding fines? This cannot be undone!"));
if (!answer){
@ -41,7 +42,7 @@
<div class="tabs-container">
[% IF ( accounts ) %]
<form action="/cgi-bin/koha/members/pay.pl" method="post">
<form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
<p><span class="checkall"><a id="CheckAll" href="#">Select all</a></span> | <span class="clearall"><a id="CheckNone" href="#">Clear all</a></span></p>
<table id="finest">

View file

@ -3,6 +3,13 @@
[% INCLUDE 'doc-head-close.inc' %]
<script type= "text/javascript">
//<![CDATA[
$(document).ready(function() {
$('#payindivfine, #woindivfine, #payfine').preventDoubleFormSubmit();
});
//]]>
</script>
<script type= "text/javascript">
//<![CDATA[
function moneyFormat(textObj) {
var newValue = textObj.value;
var decAmount = "";
@ -91,7 +98,7 @@ function moneyFormat(textObj) {
[% END %]
[% IF ( pay_individual ) %]
<form name="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
<form name="payindivfine" id="payindivfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
@ -145,7 +152,7 @@ function moneyFormat(textObj) {
<a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a></div>
</form>
[% ELSIF ( writeoff_individual ) %]
<form name="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
<form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
<fieldset class="rows">
<legend>Write off an individual fine</legend>
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
@ -185,7 +192,7 @@ function moneyFormat(textObj) {
</form>
[% ELSE %]
<form name="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
<form name="payfine" id="payfine" onsubmit="return validatePayment(this);" method="post" action="/cgi-bin/koha/members/paycollect.pl">
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
<input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
<input type="hidden" name="total" id="total" value="[% total %]" />