Bug 8054 - double clicking can cause duplicate payments/fines
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / pay.tt
1 [% INCLUDE 'doc-head-open.inc' %]
2 <title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname %] [% borrower.surname %]</title>
3 [% INCLUDE 'doc-head-close.inc' %]
4 <script type="text/javascript" src="[% themelang %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
5 <script type= "text/javascript">
6 //<![CDATA[
7     $(document).ready(function(){
8  $('#pay-fines-form').preventDoubleFormSubmit();
9         $("#woall").click(function(event){
10             var answer = confirm(_("Are you sure you want to write off [% total | format('%.2f') %] in outstanding fines? This cannot be undone!"));
11                 if (!answer){
12                     event.preventDefault();
13                 }
14         });
15         $('#CheckAll').click(function(){ $("#finest").checkCheckboxes(); return false;});
16         $('#CheckNone').click(function(){ $("#finest").unCheckCheckboxes(); return false;});
17     });
18 //]]>
19 </script>
20 </head>
21 <body id="pat_pay" class="pat">
22 [% INCLUDE 'header.inc' %]
23 [% INCLUDE 'patron-search.inc' %]
24
25 <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; Pay fines for [% borrower.firstname %] [% borrower.surname %]</div>
26
27 <div id="doc3" class="yui-t2">
28    
29    <div id="bd">
30         <div id="yui-main">
31         <div class="yui-b">
32 [% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
33
34 <!-- The manual invoice and credit buttons -->
35 <div class="statictabs">
36 <ul>
37         <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
38     <li class="active"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
39         <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a></li>
40         <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
41 </ul>
42 <div class="tabs-container">
43
44 [% IF ( accounts ) %]
45     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
46         <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
47 <p><span class="checkall"><a id="CheckAll" href="#">Select all</a></span> | <span class="clearall"><a id="CheckNone" href="#">Clear all</a></span></p>
48 <table id="finest">
49 <thead>
50 <tr>
51     <th>&nbsp;</th>
52     <th>Fines &amp; charges</th>
53         <th>Description</th>
54     <th>Account type</th>
55         <th>Notify id</th>
56         <th>Level</th>
57         <th>Amount</th>
58     <th>Amount outstanding</th>
59 </tr>
60 </thead>
61 <tfoot>
62 <tr>
63     <td class="total" colspan="7">Total Due:</td>
64     <td>[% total | format('%.2f') %]</td>
65 </tr>
66 </tfoot>
67 <tbody>
68 [% FOREACH account_grp IN accounts %]
69     [% FOREACH line IN account_grp.accountlines %]
70 <tr>
71     <td>
72     [% IF ( line.amountoutstanding > 0 ) %]
73         <input type="checkbox" checked="checked" name="incl_par_[% line.accountno %]" />
74     [% END %]
75     </td>
76     <td>
77     [% IF ( line.amountoutstanding > 0 ) %]
78         <input type="submit" name="pay_indiv_[% line.accountno %]" value="Pay" />
79         <input type="submit" name="wo_indiv_[% line.accountno %]" value="Write off" />
80     [% END %]
81     <input type="hidden" name="itemnumber[% line.accountno %]" value="[% line.itemnumber %]" />
82     <input type="hidden" name="description[% line.accountno %]" value="[% line.description %]" />
83     <input type="hidden" name="accounttype[% line.accountno %]" value="[% line.accounttype %]" />
84     <input type="hidden" name="amount[% line.accountno %]" value="[% line.amount %]" />
85     <input type="hidden" name="accountlines_id[% line.accountno %]" value="[% line.accountlines_id %]" />
86     <input type="hidden" name="amountoutstanding[% line.accountno %]" value="[% line.amountoutstanding %]" />
87     <input type="hidden" name="borrowernumber[% line.accountno %]" value="[% line.borrowernumber %]" />
88     <input type="hidden" name="accountno[% line.accountno %]" value="[% line.accountno %]" />
89     <input type="hidden" name="notify_id[% line.accountno %]" value="[% line.notify_id %]" />
90     <input type="hidden" name="notify_level[% line.accountno %]" value="[% line.notify_level %]" />
91     <input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
92     </td>
93     <td>[% line.description %] ([% line.title |html_entity %])</td>
94     <td>[% line.accounttype %]</td>
95     <td>[% line.notify_id %]</td>
96     <td>[% line.notify_level %]</td>
97     <td class="debit">[% line.amount | format('%.2f') %]</td>
98     <td class="debit">[% line.amountoutstanding | format('%.2f') %]</td>
99 </tr>
100 [% END %]
101 [% IF ( account_grp.total ) %]
102 <tr>
103
104     <td class="total" colspan="7">Sub total:</td>
105     <td>[% account_grp.total | format('%.2f') %]</td>
106 </tr>
107 [% END %]
108 [% END %]
109 </tbody>
110 </table>
111 <fieldset class="action">
112 <input type="submit" name="paycollect"  value="Pay amount" class="submit" />
113 <input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />
114 <input type="submit" name="payselected"  value="Pay selected" class="submit" />
115 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
116 </fieldset>
117 </form>
118 [% ELSE %]
119     <p>[% borrower.firstname %] [% borrower.surname %] has no outstanding fines.</p>
120 [% END %]
121 </div></div>
122
123 </div>
124 </div>
125
126 <div class="yui-b">
127 [% INCLUDE 'circ-menu.tt' %]
128 </div>
129 </div>
130 [% INCLUDE 'intranet-bottom.inc' %]