Bug 8054 - double clicking can cause duplicate payments/fines
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / paycollect.tt
index b38fc01..f38d20c 100644 (file)
@@ -1,8 +1,15 @@
 [% INCLUDE 'doc-head-open.inc' %]
-<title>Koha &rsaquo; Patrons &rsaquo; Collect Fine Payment for  [% borrower.firstname %] [% borrower.surname %]</title>
+<title>Koha &rsaquo; Patrons &rsaquo; Collect fine payment for  [% borrower.firstname %] [% borrower.surname %]</title>
 [% 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 = "";
@@ -57,7 +64,7 @@ function moneyFormat(textObj) {
 <body id="pat_paycollect" class="pat">
 [% INCLUDE 'header.inc' %]
 [% INCLUDE 'patron-search.inc' %]
-<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Pay Fines for [% borrower.firstname %] [% borrower.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
+<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/members/members-home.pl">Patrons</a>  &rsaquo; <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]">Pay fines for [% borrower.firstname %] [% borrower.surname %]</a> &rsaquo; [% IF ( pay_individual ) %]Pay an individual fine[% ELSIF ( writeoff_individual ) %]Write off an individual fine[% ELSE %][% IF ( selected_accts ) %]Pay an amount toward selected fines[% ELSE %]Pay an amount toward all fines[% END %][% END %]</div>
 
 <div id="doc3" class="yui-t2">
 
@@ -68,12 +75,12 @@ function moneyFormat(textObj) {
 
 
 <!-- The manual invoice and credit buttons -->
-<div class="toptabs">
-<ul class="ui-tabs-nav">
+<div class="statictabs">
+<ul>
     <li>
     <a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a>
     </li>
-    <li class="ui-tabs-selected">
+    <li class="active">
     <a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a>
     </li>
     <li>
@@ -84,14 +91,14 @@ function moneyFormat(textObj) {
     </li>
 </ul>
 <div class="tabs-container">
-[% IF ( error ) %]
+[% IF ( error_over ) %]
     <div id="error_message" class="dialog alert">
-    [% error %]
+    You must pay a value less than or equal to [% total_due | format('%.2f') %].
     </div>
 [% 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 %]" />
@@ -102,6 +109,7 @@ function moneyFormat(textObj) {
     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
     <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
     <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
+    <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
     <input type="hidden" name="title" id="title" value="[% title %]" />
 
 <fieldset class="rows">
@@ -109,11 +117,11 @@ function moneyFormat(textObj) {
     <table>
     <thead><tr>
             <th>Description</th>
-            <th>Account Type</th>
+            <th>Account type</th>
             <th>Notify id</th>
             <th>Level</th>
             <th>Amount</th>
-            <th>Amount Outstanding</th>
+            <th>Amount outstanding</th>
         </tr></thead>
     <tfoot>
         <td colspan="5">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
@@ -144,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 %]" />
@@ -157,15 +165,16 @@ function moneyFormat(textObj) {
     <input type="hidden" name="amount" id="amount" value="[% amount %]" />
     <input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
     <input type="hidden" name="accountno" id="accountno" value="[% accountno %]" />
+    <input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
     <input type="hidden" name="title" id="title" value="[% title %]" />
     <table>
     <thead><tr>
             <th>Description</th>
-            <th>Account Type</th>
+            <th>Account type</th>
             <th>Notify id</th>
             <th>Level</th>
             <th>Amount</th>
-            <th>Amount Outstanding</th>
+            <th>Amount outstanding</th>
         </tr></thead>
     <tfoot><td colspan="5">Total amount to be written off:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
     <tbody><tr>
@@ -183,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 %]" />