Bug 19614: Fix XSS in members/pay.pl
[koha.git] / koha-tmpl / intranet-tmpl / prog / en / modules / members / pay.tt
1 [% USE Koha %]
2 [% USE AuthorisedValues %]
3 [% USE Branches %]
4 [% USE Price %]
5 [% INCLUDE 'doc-head-open.inc' %]
6 <title>Koha &rsaquo; Patrons &rsaquo; Pay Fines for  [% borrower.firstname |html %] [% borrower.surname |html %]</title>
7 [% INCLUDE 'doc-head-close.inc' %]
8 <script type="text/javascript" src="[% interface %]/lib/jquery/plugins/jquery.checkboxes.min.js"></script>
9 <script type= "text/javascript">
10 //<![CDATA[
11 function enableCheckboxActions(){
12     // Enable/disable controls if checkboxes are checked
13     var checkedBoxes = $("input.cb:checked");
14     if ($(checkedBoxes).size()) {
15       $("#payselected").prop("disabled",false);
16     } else {
17       $("#payselected").prop("disabled",true);
18     }
19 }
20     $(document).ready(function(){
21  $('#pay-fines-form').preventDoubleFormSubmit();
22         $("#woall").click(function(event){
23             var msg = _("Are you sure you want to write off %s in outstanding fines? This cannot be undone!").format( "[% total | $Price %]" );
24             var answer = confirm(msg);
25                 if (!answer){
26                     event.preventDefault();
27                 }
28         });
29         $('#CheckAll').click(function(){
30             $("#finest").checkCheckboxes();
31             enableCheckboxActions();
32             return false;
33         });
34         $('#CheckNone').click(function(){
35             $("#finest").unCheckCheckboxes();
36             enableCheckboxActions();
37             return false;
38         });
39         $(".cb").change(function(){
40             enableCheckboxActions();
41         });
42         enableCheckboxActions();
43     });
44 //]]>
45 </script>
46 </head>
47 <body id="pat_pay" class="pat">
48 [% INCLUDE 'header.inc' %]
49 [% INCLUDE 'patron-search.inc' %]
50
51 <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 |html %] [% borrower.surname |html %]</div>
52
53 <div id="doc3" class="yui-t2">
54    
55    <div id="bd">
56         <div id="yui-main">
57         <div class="yui-b">
58 [% INCLUDE 'members-toolbar.inc' borrowernumber=borrower.borrowernumber %]
59
60 <!-- The manual invoice and credit buttons -->
61 <div class="statictabs">
62 <ul>
63         <li><a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Account</a></li>
64     <li class="active"><a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% borrower.borrowernumber %]" >Pay fines</a></li>
65         <li><a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual invoice</a></li>
66         <li><a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% borrower.borrowernumber %]" >Create manual credit</a></li>
67 </ul>
68 <div class="tabs-container">
69
70 [% IF ( accounts ) %]
71     <form action="/cgi-bin/koha/members/pay.pl" method="post" id="pay-fines-form">
72         <input type="hidden" name="borrowernumber" id="borrowernumber" value="[% borrower.borrowernumber %]" />
73 <p><span class="checkall"><a id="CheckAll" href="#"><i class="fa fa-check"></i> Select all</a></span> | <span class="clearall"><a id="CheckNone" href="#"><i class="fa fa-remove"></i> Clear all</a></span></p>
74 <table id="finest">
75 <thead>
76 <tr>
77     <th>&nbsp;</th>
78     <th>Fines &amp; charges</th>
79     <th>Description</th>
80     <th>Payment note</th>
81     <th>Account type</th>
82     <th>Notify id</th>
83     <th>Level</th>
84     <th>Amount</th>
85     <th>Amount outstanding</th>
86 </tr>
87 </thead>
88 <tfoot>
89 <tr>
90     <td class="total" colspan="8">Total due:</td>
91     <td style="text-align: right;">[% total | $Price %]</td>
92 </tr>
93 </tfoot>
94 <tbody>
95 [% FOREACH account_grp IN accounts %]
96     [% FOREACH line IN account_grp.accountlines %]
97 <tr>
98     <td>
99     [% IF ( line.amountoutstanding > 0 ) %]
100         <input class="cb" type="checkbox" checked="checked" name="incl_par_[% line.accountlines_id %]" />
101     [% END %]
102     </td>
103     <td>
104     [% IF ( line.amountoutstanding > 0 ) %]
105         <input type="submit" name="pay_indiv_[% line.accountlines_id %]" value="Pay" />
106         [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="wo_indiv_[% line.accountlines_id %]" value="Write off" />[% END %]
107     [% END %]
108     <input type="hidden" name="itemnumber[% line.accountlines_id %]" value="[% line.itemnumber %]" />
109     <input type="hidden" name="description[% line.accountlines_id %]" value="[% line.description %]" />
110     <input type="hidden" name="accounttype[% line.accountlines_id %]" value="[% line.accounttype %]" />
111     <input type="hidden" name="amount[% line.accountlines_id %]" value="[% line.amount %]" />
112     <input type="hidden" name="accountlines_id[% line.accountlines_id %]" value="[% line.accountlines_id %]" />
113     <input type="hidden" name="amountoutstanding[% line.accountlines_id %]" value="[% line.amountoutstanding %]" />
114     <input type="hidden" name="borrowernumber[% line.accountlines_id %]" value="[% line.borrowernumber %]" />
115     <input type="hidden" name="notify_id[% line.accountlines_id %]" value="[% line.notify_id %]" />
116     <input type="hidden" name="notify_level[% line.accountlines_id %]" value="[% line.notify_level %]" />
117     <input type="hidden" name="totals[% line.accountlines_id %]" value="[% line.totals %]" />
118     </td>
119     <td>
120         [% SWITCH line.accounttype %]
121           [% CASE 'Pay' %]Payment, thanks
122           [% CASE 'Pay00' %]Payment, thanks (cash via SIP2)
123           [% CASE 'Pay01' %]Payment, thanks (VISA via SIP2)
124           [% CASE 'Pay02' %]Payment, thanks (credit card via SIP2)
125           [% CASE 'N' %]New card
126           [% CASE 'F' %]Fine
127           [% CASE 'A' %]Account management fee
128           [% CASE 'M' %]Sundry
129           [% CASE 'L' %]Lost item
130           [% CASE 'W' %]Writeoff
131           [% CASE 'FU' %]Accruing fine
132           [% CASE 'HE' %]Hold waiting too long
133           [% CASE 'Rent' %]Rental fee
134           [% CASE 'FOR' %]Forgiven
135           [% CASE 'LR' %]Lost item fee refund
136           [% CASE 'PAY' %]Payment
137           [% CASE 'WO' %]Writeoff
138           [% CASE 'C' %]Credit
139           [% CASE 'CR' %]Credit
140           [% CASE %][% line.accounttype %]
141         [%- END -%]
142         [%- IF line.description %], [% line.description %][% END %]
143         [% IF line.title %]([% line.title %])[% END %]
144     </td>
145     <td><input type="text" name="payment_note_[% line.accountlines_id %]" /></td>
146     <td>[% line.accounttype %]</td>
147     <td>[% line.notify_id %]</td>
148     <td>[% line.notify_level %]</td>
149     <td class="debit" style="text-align: right;">[% line.amount | $Price %]</td>
150     <td class="debit" style="text-align: right;">[% line.amountoutstanding | $Price %]</td>
151 </tr>
152 [% END %]
153 [% IF ( account_grp.total ) %]
154 <tr>
155
156     <td class="total" colspan="8" style="text-align: right;">Sub total:</td>
157     <td style="text-align: right;">[% account_grp.total | $Price %]</td>
158 </tr>
159 [% END %]
160 [% END %]
161 </tbody>
162 </table>
163 <fieldset class="action">
164 <input type="submit" id="paycollect" name="paycollect"  value="Pay amount" class="submit" />
165 [% IF CAN_user_updatecharges_writeoff %]<input type="submit" name="woall"  id="woall" value="Write off all" class="submit" />[% END %]
166 <input type="submit" id="payselected" name="payselected"  value="Pay selected" class="submit" />
167 <a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% borrower.borrowernumber %]">Cancel</a>
168 </fieldset>
169 </form>
170 [% ELSE %]
171     <p>[% borrower.firstname |html %] [% borrower.surname |html %] has no outstanding fines.</p>
172 [% END %]
173 </div></div>
174
175 </div>
176 </div>
177 <div class="yui-b">
178 [% INCLUDE 'circ-menu.inc' %]
179 </div>
180 </div>
181 [% INCLUDE 'intranet-bottom.inc' %]