Code will also respect notes when using the "Writeoff All" button but WILL NOT when using either the "Pay Amount" or "Pay Selected" buttons Fixed uri encoding of arguments
Signed-off-by: Nicole C. Engard <nengard@bywatersolutions.com>
Signed-off-by: Paul Poulain <paul.poulain@biblibre.com>
Signed-off-by: Galen Charlton <gmc@esilibrary.com>
#here we update both the accountoffsets and the account lines
#updated to check, if they are paying off a lost item, we return the item
# from their card, and put a note on the item record
#here we update both the accountoffsets and the account lines
#updated to check, if they are paying off a lost item, we return the item
# from their card, and put a note on the item record
- my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
+ my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_;
my $dbh = C4::Context->dbh;
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
my $dbh = C4::Context->dbh;
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
$udp->finish;
# create new line
$udp->finish;
# create new line
- $payment = 0 - $amount;
+ my $payment = 0 - $amount;
+ $payment_note //= "";
my $ins =
$dbh->prepare(
"INSERT
my $ins =
$dbh->prepare(
"INSERT
- INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id)
- VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?)"
+ INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note)
+ VALUES ( ?, ?, now(), ?, ?, 'Payment,thanks', 'Pay', 0, ?, ?)"
- $ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id);
+ $ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note);
# makepayment needs to be fixed to handle partials till then this separate subroutine
# fills in
sub makepartialpayment {
# makepayment needs to be fixed to handle partials till then this separate subroutine
# fills in
sub makepartialpayment {
- my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch ) = @_;
+ my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_;
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
if (!$amount || $amount < 0) {
return;
}
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
if (!$amount || $amount < 0) {
return;
}
my $dbh = C4::Context->dbh;
my $nextaccntno = getnextacctno($borrowernumber);
my $dbh = C4::Context->dbh;
my $nextaccntno = getnextacctno($borrowernumber);
# create new line
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, '
# create new line
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, '
- . 'description, accounttype, amountoutstanding, itemnumber, manager_id) '
- . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?)';
+ . 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) '
+ . ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)';
- $dbh->do( $insert, undef, $borrowernumber, $nextaccntno, 0 - $amount,
- "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id);
+ $dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount,
+ "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno );
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno );
- WriteOff( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch );
+ WriteOffFee( $borrowernumber, $accountline_id, $itemnum, $accounttype, $amount, $branch, $payment_note );
Write off a fine for a patron.
C<$borrowernumber> is the patron's borrower number.
Write off a fine for a patron.
C<$borrowernumber> is the patron's borrower number.
C<$accounttype> is the account type of the fine being written off.
C<$amount> is a floating-point number, giving the amount that is being written off.
C<$branch> is the branchcode of the library where the writeoff occurred.
C<$accounttype> is the account type of the fine being written off.
C<$amount> is a floating-point number, giving the amount that is being written off.
C<$branch> is the branchcode of the library where the writeoff occurred.
+C<$payment_note> is the note to attach to this payment
- my ( $borrowernumber, $accountlines_id, $itemnum, $accounttype, $amount, $branch ) = @_;
+ my ( $borrowernumber, $accountlines_id, $itemnum, $accounttype, $amount, $branch, $payment_note ) = @_;
+ $payment_note //= "";
$branch ||= C4::Context->userenv->{branch};
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
$branch ||= C4::Context->userenv->{branch};
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
$query ="
INSERT INTO accountlines
$query ="
INSERT INTO accountlines
- ( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id )
- VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ? )
+ ( borrowernumber, accountno, itemnumber, date, amount, description, accounttype, manager_id, note )
+ VALUES ( ?, ?, ?, NOW(), ?, 'Writeoff', 'W', ?, ? )
";
$sth = $dbh->prepare( $query );
my $acct = getnextacctno($borrowernumber);
";
$sth = $dbh->prepare( $query );
my $acct = getnextacctno($borrowernumber);
- $sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id );
+ $sth->execute( $borrowernumber, $acct, $itemnum, $amount, $manager_id, $payment_note );
if ( C4::Context->preference("FinesLog") ) {
logaction("FINES", 'CREATE',$borrowernumber,Dumper({
if ( C4::Context->preference("FinesLog") ) {
logaction("FINES", 'CREATE',$borrowernumber,Dumper({
<th> </th>
<th>Fines & charges</th>
<th>Description</th>
<th> </th>
<th>Fines & charges</th>
<th>Description</th>
<th>Account type</th>
<th>Notify id</th>
<th>Level</th>
<th>Account type</th>
<th>Notify id</th>
<th>Level</th>
<input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
</td>
<td>[% line.description %] ([% line.title |html_entity %])</td>
<input type="hidden" name="totals[% line.accountno %]" value="[% line.totals %]" />
</td>
<td>[% line.description %] ([% line.title |html_entity %])</td>
+ <td><input type="text" name="payment_note_[% line.accountno %]"></input></td>
<td>[% line.accounttype %]</td>
<td>[% line.notify_id %]</td>
<td>[% line.notify_level %]</td>
<td>[% line.accounttype %]</td>
<td>[% line.notify_id %]</td>
<td>[% line.notify_level %]</td>
<fieldset class="rows">
<legend>Pay an individual fine</legend>
<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>
<table>
<thead><tr>
<th>Description</th>
<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 %]" />
<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 %]" />
+ <input type="hidden" name="payment_note" id="payment_note" value="[% payment_note %]" />
<table>
<thead><tr>
<th>Description</th>
<table>
<thead><tr>
<th>Description</th>
use strict;
use warnings;
use strict;
use warnings;
use C4::Context;
use C4::Auth;
use C4::Output;
use C4::Context;
use C4::Auth;
use C4::Output;
my $itemno = $input->param('itemnumber');
my $account_type = $input->param('accounttype');
my $amount = $input->param('amountoutstanding');
my $itemno = $input->param('itemnumber');
my $account_type = $input->param('accounttype');
my $amount = $input->param('amountoutstanding');
- WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $account_type, $amount );
+ my $payment_note = $input->param("payment_note");
+ WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $account_type, $amount, $branch, $payment_note );
$redirect .=
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
$redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 );
$redirect .=
get_for_redirect( 'amountoutstanding', "amountoutstanding$line_no", 1 );
$redirect .= get_for_redirect( 'accountno', "accountno$line_no", 0 );
- $redirect .= get_for_redirect( 'description', "description$line_no", 0 );
$redirect .= get_for_redirect( 'title', "title$line_no", 0 );
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 );
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 );
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 );
$redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
$redirect .= get_for_redirect( 'title', "title$line_no", 0 );
$redirect .= get_for_redirect( 'itemnumber', "itemnumber$line_no", 0 );
$redirect .= get_for_redirect( 'notify_id', "notify_id$line_no", 0 );
$redirect .= get_for_redirect( 'notify_level', "notify_level$line_no", 0 );
$redirect .= get_for_redirect( 'accountlines_id', "accountlines_id$line_no", 0 );
+ $redirect .= q{&} . 'payment_note' . q{=} . uri_escape( $input->param("payment_note_$line_no") );
$redirect .= '&remote_user=';
$redirect .= $user;
return print $input->redirect($redirect);
$redirect .= '&remote_user=';
$redirect .= $user;
return print $input->redirect($redirect);
my $amount = $input->param("amountoutstanding$value");
my $accountno = $input->param("accountno$value");
my $accountlines_id = $input->param("accountlines_id$value");
my $amount = $input->param("amountoutstanding$value");
my $accountno = $input->param("accountno$value");
my $accountlines_id = $input->param("accountlines_id$value");
- WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount );
+ my $payment_note = $input->param("payment_note_$value");
+ WriteOffFee( $borrowernumber, $accountlines_id, $itemno, $accounttype, $amount, $branch, $payment_note );
use strict;
use warnings;
use strict;
use warnings;
use C4::Context;
use C4::Auth;
use C4::Output;
use C4::Context;
use C4::Auth;
use C4::Output;
my $writeoff = $input->param('writeoff_individual');
my $select_lines = $input->param('selected');
my $select = $input->param('selected_accts');
my $writeoff = $input->param('writeoff_individual');
my $select_lines = $input->param('selected');
my $select = $input->param('selected_accts');
+my $payment_note = uri_unescape $input->param('payment_note');
my $accountno;
my $accountlines_id;
if ( $individual || $writeoff ) {
my $accountno;
my $accountlines_id;
if ( $individual || $writeoff ) {
description => $description,
notify_id => $notify_id,
notify_level => $notify_level,
description => $description,
notify_id => $notify_id,
notify_level => $notify_level,
+ payment_note => $payment_note,
);
} elsif ($select_lines) {
$total_due = $input->param('amt');
);
} elsif ($select_lines) {
$total_due = $input->param('amt');
if ($individual) {
if ( $total_paid == $total_due ) {
makepayment( $accountlines_id, $borrowernumber, $accountno, $total_paid, $user,
if ($individual) {
if ( $total_paid == $total_due ) {
makepayment( $accountlines_id, $borrowernumber, $accountno, $total_paid, $user,
+ $branch, $payment_note );
} else {
makepartialpayment( $accountlines_id, $borrowernumber, $accountno, $total_paid,
} else {
makepartialpayment( $accountlines_id, $borrowernumber, $accountno, $total_paid,
+ $user, $branch, $payment_note );
}
print $input->redirect(
"/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber");
}
print $input->redirect(
"/cgi-bin/koha/members/pay.pl?borrowernumber=$borrowernumber");