Jonathan Druart
81431ee28a
Code and variables to deal with the update child feature are not centralized but copied/pasted in several scripts. Which leads to issues obsviously (bug 20805 for instance). Moreover the strings used by the templates are also in several template files (or .inc) To deal with that this patch introduces the idea to create 1 .inc file per .js file Here we have members-menu.inc for members-menu.js Test plan: - Remove all your adult categories (categories.category_type='A') - Create a patron with a child category - Try to update to adult category => The entry does no longer appears! (This is a change in the behaviour) - Create one adult category - Update to adult category => There is a JS confirmation message, if you accept the patron will be updated to the adult category - Create (at least) another adult category - Create another child - Update to adult category => No more confirmation message but a popup to select the adult category - Pick one => The patron has been updated to the adult category Signed-off-by: Owen Leonard <oleonard@myacpl.org> Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
315 lines
12 KiB
Text
315 lines
12 KiB
Text
[% USE Asset %]
|
|
[% USE Koha %]
|
|
[% USE Branches %]
|
|
[% USE AuthorisedValues %]
|
|
[% USE Price %]
|
|
[% SET footerjs = 1 %]
|
|
[% INCLUDE 'doc-head-open.inc' %]
|
|
<title>Koha › Patrons › Collect fine payment for [% patron.firstname %] [% patron.surname %]</title>
|
|
[% INCLUDE 'doc-head-close.inc' %]
|
|
</head>
|
|
|
|
<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> ›
|
|
<a href="/cgi-bin/koha/members/members-home.pl">Patrons</a> ›
|
|
<a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Pay fines for [% patron.firstname %] [% patron.surname %]</a> ›
|
|
[% IF ( pay_individual ) %]Pay an individual fine
|
|
[% ELSIF ( writeoff_individual ) %]Write off an individual fine
|
|
[% ELSE %]
|
|
[% IF ( selected_accts ) %]
|
|
[% IF type == 'writeoff' %]Write off an amount toward selected fines
|
|
[% ELSE %]Pay an amount toward selected fines
|
|
[% END %]
|
|
[% ELSE %]Pay an amount toward all fines
|
|
[% END %]
|
|
[% END %]
|
|
</div>
|
|
|
|
<div id="doc3" class="yui-t2">
|
|
|
|
<div id="bd">
|
|
<div id="yui-main">
|
|
<div class="yui-b">
|
|
[% INCLUDE 'members-toolbar.inc' borrowernumber=patron.borrowernumber %]
|
|
|
|
|
|
<!-- The manual invoice and credit buttons -->
|
|
<div class="statictabs">
|
|
<ul>
|
|
<li>
|
|
<a href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Account</a>
|
|
</li>
|
|
<li class="active">
|
|
<a href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]" >Pay fines</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/members/maninvoice.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual invoice</a>
|
|
</li>
|
|
<li>
|
|
<a href="/cgi-bin/koha/members/mancredit.pl?borrowernumber=[% patron.borrowernumber %]" >Create manual credit</a>
|
|
</li>
|
|
</ul>
|
|
<div class="tabs-container">
|
|
[% IF ( error_over ) %]
|
|
<div id="error_message" class="dialog alert">
|
|
You must pay a value less than or equal to [% total_due | format('%.2f') %].
|
|
</div>
|
|
[% END %]
|
|
|
|
[% IF ( pay_individual ) %]
|
|
<form name="payindivfine" id="payindivfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
|
|
<input type="hidden" name="csrf_token" value="[% csrf_token %]" />
|
|
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
|
|
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
|
|
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
|
|
<input type="hidden" name="description" id="description" value="[% description %]" />
|
|
<input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
|
|
<input type="hidden" name="amount" id="amount" value="[% amount %]" />
|
|
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
|
|
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
|
|
<input type="hidden" name="title" id="title" value="[% title %]" />
|
|
|
|
<fieldset class="rows">
|
|
<legend>Pay an individual fine</legend>
|
|
<input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
|
|
<table>
|
|
<thead><tr>
|
|
<th>Description</th>
|
|
<th>Account type</th>
|
|
<th>Amount</th>
|
|
<th>Amount outstanding</th>
|
|
</tr></thead>
|
|
<tfoot>
|
|
<td colspan="3">Total amount payable:</td><td>[% amountoutstanding | format('%.2f') %]</td>
|
|
</tfoot>
|
|
<tbody><tr>
|
|
<td>
|
|
[% individual_description %]
|
|
</td>
|
|
<td>[% accounttype %]</td>
|
|
<td class="debit">[% amount | format('%.2f') %]</td>
|
|
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
|
|
</tr></tbody>
|
|
</table>
|
|
|
|
<ol>
|
|
|
|
<li>
|
|
<label for="paid">Collect from patron: </label>
|
|
<!-- default to paying all -->
|
|
<input name="paid" id="paid" value="[% amountoutstanding %]" />
|
|
</li>
|
|
[% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
|
|
[% IF payment_types %]
|
|
<li>
|
|
<label for="payment_type">Payment type: </label>
|
|
<select name="payment_type" id="payment_type">
|
|
<option value=""></option>
|
|
[% FOREACH pt IN payment_types %]
|
|
<option value="[% pt.authorised_value %]">[% pt.lib %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
[% END %]
|
|
</ol>
|
|
</fieldset>
|
|
|
|
<div class="action"><input type="submit" name="submitbutton" value="Confirm" />
|
|
<a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a></div>
|
|
</form>
|
|
[% ELSIF ( writeoff_individual ) %]
|
|
<form name="woindivfine" id="woindivfine" action="/cgi-bin/koha/members/pay.pl" method="post" >
|
|
<input type="hidden" name="csrf_token" value="[% csrf_token %]" />
|
|
<fieldset class="rows">
|
|
<legend>Write off an individual fine</legend>
|
|
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
|
|
<input type="hidden" name="pay_individual" id="pay_individual" value="[% pay_individual %]" />
|
|
<input type="hidden" name="itemnumber" id="itemnumber" value="[% itemnumber %]" />
|
|
<input type="hidden" name="description" id="description" value="[% description %]" />
|
|
<input type="hidden" name="accounttype" id="accounttype" value="[% accounttype %]" />
|
|
<input type="hidden" name="amount" id="amount" value="[% amount %]" />
|
|
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id %]" />
|
|
<input type="hidden" name="title" id="title" value="[% title %]" />
|
|
<input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
|
|
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding %]" />
|
|
<input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
|
|
<table>
|
|
<thead><tr>
|
|
<th>Description</th>
|
|
<th>Account type</th>
|
|
<th>Amount</th>
|
|
<th>Amount outstanding</th>
|
|
</tr></thead>
|
|
<tfoot><td colspan="3">Total amount outstanding:</td><td>[% amountoutstanding | format('%.2f') %]</td></tfoot>
|
|
<tbody><tr>
|
|
<td>[% description %] [% title %]</td>
|
|
<td>[% accounttype %]</td>
|
|
<td class="debit">[% amount | format('%.2f') %]</td>
|
|
<td class="debit">[% amountoutstanding | format('%.2f') %]</td>
|
|
</tr></tbody>
|
|
</table>
|
|
|
|
<ol>
|
|
<li>
|
|
<label for="paid">Writeoff amount: </label>
|
|
<!-- default to writing off all -->
|
|
<input name="amountwrittenoff" id="amountwrittenoff" value="[% amountoutstanding | $Price on_editing => 1 %]" />
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<div class="action">
|
|
<input type="submit" value="Write off this charge" />
|
|
<a class="cancel" href="/cgi-bin/koha/members/pay.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
|
|
</div>
|
|
</form>
|
|
[% ELSE %]
|
|
|
|
<form name="payfine" id="payfine" method="post" action="/cgi-bin/koha/members/paycollect.pl">
|
|
<input type="hidden" name="csrf_token" value="[% csrf_token %]" />
|
|
<input type="hidden" name="borrowernumber" id="borrowernumber" value="[% patron.borrowernumber %]" />
|
|
<input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts %]" />
|
|
<input type="hidden" name="total" id="total" value="[% total %]" />
|
|
<input type="hidden" name="type" value="[% type %]" />
|
|
|
|
<fieldset class="rows">
|
|
[% IF ( selected_accts ) %]
|
|
[% IF type == 'writeoff' %]
|
|
<legend>Write off an amount toward selected fines</legend>
|
|
[% ELSE %]
|
|
<legend>Pay an amount toward selected fines</legend>
|
|
[% END %]
|
|
[% ELSE %]
|
|
<legend>Pay an amount toward all fines</legend>
|
|
[% END %]
|
|
|
|
<ol>
|
|
<li>
|
|
<span class="label">Total amount outstanding: </span>
|
|
<span class="debit">[% total | format('%.2f') %]</span>
|
|
</li>
|
|
<li>
|
|
[% IF type == 'writeoff' %]
|
|
<label for="paid">Writeoff amount: </label>
|
|
[% ELSE %]
|
|
<label for="paid">Collect from patron: </label>
|
|
[% END %]
|
|
<!-- default to paying all -->
|
|
<input name="paid" id="paid" value="[% total | format('%.2f') %]" />
|
|
</li>
|
|
[% SET payment_types = AuthorisedValues.GetAuthValueDropbox('PAYMENT_TYPE') %]
|
|
[% IF payment_types %]
|
|
<li>
|
|
<label for="payment_type">Payment type: </label>
|
|
<select name="payment_type" id="payment_type">
|
|
<option value=""></option>
|
|
[% FOREACH pt IN payment_types %]
|
|
<option value="[% pt.authorised_value %]">[% pt.lib %]</option>
|
|
[% END %]
|
|
</select>
|
|
</li>
|
|
[% END %]
|
|
<li>
|
|
<label for="selected_accts_notes">Note: </label>
|
|
<textarea name="selected_accts_notes" id="selected_accts_notes">[% selected_accts_notes %]</textarea>
|
|
</li>
|
|
</ol>
|
|
</fieldset>
|
|
<div class="action">
|
|
<input type="submit" name="submitbutton" value="Confirm" />
|
|
<a class="cancel" href="/cgi-bin/koha/members/boraccount.pl?borrowernumber=[% patron.borrowernumber %]">Cancel</a>
|
|
</div>
|
|
</form>
|
|
[% END %]
|
|
</div></div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="yui-b">
|
|
[% INCLUDE 'circ-menu.inc' %]
|
|
</div>
|
|
</div>
|
|
|
|
[% MACRO jsinclude BLOCK %]
|
|
[% INCLUDE 'str/members-menu.inc' %]
|
|
[% Asset.js("js/members-menu.js") %]
|
|
<script type= "text/javascript">
|
|
$(document).ready(function() {
|
|
$('#payindivfine, #payfine').preventDoubleFormSubmit();
|
|
$("#paid").on("change",function(){
|
|
moneyFormat( this );
|
|
});
|
|
});
|
|
|
|
prevent_default = 1;
|
|
$('#woindivfine').on('submit', function(e){
|
|
if ( prevent_default ) {
|
|
e.preventDefault();
|
|
|
|
let amount_outstanding = parseFloat( $('#amountoutstanding').attr('value') );
|
|
let amount_writeoff = parseFloat( $('#amountwrittenoff').attr('value') );
|
|
if ( amount_writeoff > amount_outstanding ) {
|
|
alert(_("You are attemping to writeoff more than the value of the fee."));
|
|
$('#woindivfine').beenSubmitted = false;
|
|
} else {
|
|
prevent_default = 0;
|
|
$('#woindivfine').preventDoubleFormSubmit();
|
|
$('#woindivfine').submit();
|
|
}
|
|
}
|
|
});
|
|
|
|
function moneyFormat(textObj) {
|
|
var newValue = textObj.value;
|
|
var decAmount = "";
|
|
var dolAmount = "";
|
|
var decFlag = false;
|
|
var aChar = "";
|
|
|
|
for(i=0; i < newValue.length; i++) {
|
|
aChar = newValue.substring(i, i+1);
|
|
if (aChar >= "0" && aChar <= "9") {
|
|
if(decFlag) {
|
|
decAmount = "" + decAmount + aChar;
|
|
}
|
|
else {
|
|
dolAmount = "" + dolAmount + aChar;
|
|
}
|
|
}
|
|
if (aChar == ".") {
|
|
if (decFlag) {
|
|
dolAmount = "";
|
|
break;
|
|
}
|
|
decFlag = true;
|
|
}
|
|
}
|
|
|
|
if (dolAmount == "") {
|
|
dolAmount = "0";
|
|
}
|
|
// Strip leading 0s
|
|
if (dolAmount.length > 1) {
|
|
while(dolAmount.length > 1 && dolAmount.substring(0,1) == "0") {
|
|
dolAmount = dolAmount.substring(1,dolAmount.length);
|
|
}
|
|
}
|
|
if (decAmount.length > 2) {
|
|
decAmount = decAmount.substring(0,2);
|
|
}
|
|
// Pad right side
|
|
if (decAmount.length == 1) {
|
|
decAmount = decAmount + "0";
|
|
}
|
|
if (decAmount.length == 0) {
|
|
decAmount = decAmount + "00";
|
|
}
|
|
|
|
textObj.value = dolAmount + "." + decAmount;
|
|
}
|
|
</script>
|
|
[% END %]
|
|
|
|
[% INCLUDE 'intranet-bottom.inc' %]
|