Some libraries would like to show the amount of change given on print reciepts triggered by FinePaymentAutoPopup
so the patron can verify he or she has recieved the correct amount of change.
1) Apply this patch
2) Edit ACCOUNT_CREDIT slip and add "[% IF change_given %]<h1>CHANGE: [% change_given %]</h1>[% END %]" at the top
3) Enable FinePaymentAutoPopup
4) Make a payment
5) Note the change given is shown on the popup receipt
6) Note the change given is *not* shown on subsequent prints of the same receipt using the "print" button for the payment
Signed-off-by: Kyle Hall <kyle@bywatersolutions.com>
Signed-off-by: Hasina Akhte <hasinaa@pascolibraries.org>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
<script>
$(document).ready(function() {
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
- window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&change_given=[% change_given | html %]&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
[% END %]
var txtActivefilter = _("Filter paid transactions");
}
$(document).ready(function(){
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
- window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&change_given=[% change_given | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
[% END %]
$('#pay-fines-form').preventDoubleFormSubmit();
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
<input type="hidden" name="accountlines_id" id="accountlines_id" value="[% accountlines_id | html %]" />
<input type="hidden" name="title" id="title" value="[% title | html %]" />
+ <input type="hidden" name="change_given" id="change_given" />
<fieldset class="rows">
<legend>Pay an individual fine</legend>
<input type="hidden" name="payment_note" id="payment_note" value="[% payment_note | html %]" />
<input type="hidden" name="amountoutstanding" id="amountoutstanding" value="[% amountoutstanding | html %]" />
<input type="hidden" name="confirm_writeoff" id="confirm_writeoff" value="1" />
+ <input type="hidden" name="change_given" id="change_given" />
<table>
<thead><tr>
<th>Description</th>
<input type="hidden" name="selected_accts" id="selected_accts" value="[% selected_accts | html %]" />
<input type="hidden" name="total" id="total" value="[% total | html %]" />
<input type="hidden" name="type" value="[% type | html %]" />
+ <input type="hidden" name="change_given" id="change_given" />
<fieldset class="rows">
[% IF ( selected_accts ) %]
<script>
$(document).ready(function() {
[% IF payment_id && Koha.Preference('FinePaymentAutoPopup') %]
- window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
+ window.open('/cgi-bin/koha/members/printfeercpt.pl?action=print&accountlines_id=[% payment_id | html %]&change_given=[% change_given | html %]&borrowernumber=[% patron.borrowernumber | html %]', '_blank');
[% END %]
var forms = $('#payindivfine, #payfine');
change.innerHTML = Math.round(($('#collected')[0].value - $('#paid')[0].value) * 100) / 100;
if (change.innerHTML <= 0) {
change.innerHTML = "0.00";
+ $('input[name="change_given"]').val('0.00');
} else {
change.value = change.innerHTML;
moneyFormat(change);
change.innerHTML = change.value;
+ $('input[name="change_given"]').val(change.value);
}
$('#modal_change').html(change.innerHTML);
my $borrowernumber = $input->param('borrowernumber');
my $payment_id = $input->param('payment_id');
+my $change_given = $input->param('change_given');
my $action = $input->param('action') || '';
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
totalcredit => $totalcredit,
accounts => \@accountlines,
payment_id => $payment_id,
+ change_given => $change_given,
);
output_html_with_http_headers $input, $cookie, $template->output;
}
my $payment_id = $input->param('payment_id');
+our $change_given = $input->param('change_given');
# get borrower details
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
if ( $input->param('paycollect') ) {
print $input->redirect(
- "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber");
+ "/cgi-bin/koha/members/paycollect.pl?borrowernumber=$borrowernumber&change_given=$change_given");
}
elsif ( $input->param('payselected') ) {
payselected({ params => \@names });
. "&amountoutstanding=" . $accountline->amountoutstanding
. "&accounttype=" . $accountline->accounttype
. "&accountlines_id=" . $accountlines_id
+ . "&change_given=" . $change_given
. "&writeoff_individual=1"
. "&error_over=1" );
$template->param(
finesview => 1,
payment_id => $payment_id,
+ change_given => $change_given,
);
add_accounts_to_template();
$redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
$redirect .= q{&} . 'payment_note' . q{=} . uri_escape_utf8( scalar $input->param("payment_note_$line_no") );
$redirect .= '&remote_user=';
+ $redirect .= "change_given=$change_given";
$redirect .= $user;
return print $input->redirect($redirect);
}
my $payment_id = $input->param('payment_id');
my $writeoff_individual = $input->param('writeoff_individual');
+my $change_given = $input->param('change_given');
my $type = scalar $input->param('type') || 'payment';
my $updatecharges_permissions = ($writeoff_individual || $type eq 'writeoff') ? 'writeoff' : 'remaining_permissions';
}
);
print $input->redirect(
- "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
+ "/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber&payment_id=$payment_id&change_given=$change_given");
} else {
if ($select) {
if ( $select =~ /^([\d,]*).*/ ) {
);
}
- print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber&payment_id=$payment_id");
+ print $input->redirect("/cgi-bin/koha/members/boraccount.pl?borrowernumber=$borrowernumber&payment_id=$payment_id&change_given=$change_given");
}
}
} else {
my $borrowernumber=$input->param('borrowernumber');
my $action = $input->param('action') || '';
my $accountlines_id = $input->param('accountlines_id');
+my $change_given = $input->param('change_given');
my $logged_in_user = Koha::Patrons->find( $loggedinuser ) or die "Not logged in";
my $patron = Koha::Patrons->find( $borrowernumber );
total => $total,
totalcredit => $totalcredit,
accounts => [$accountline], # FIXME There is always only 1 row!
+
+ change_given => $change_given,
);
output_html_with_http_headers $input, $cookie, $template->output;