#
# This file is part of Koha.
#
-# Koha is free software; you can redistribute it and/or modify it under the
-# terms of the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any later
-# version.
+# Koha is free software; you can redistribute it and/or modify it
+# under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
#
-# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
-# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
-# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
+# Koha is distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
#
-# You should have received a copy of the GNU General Public License along
-# with Koha; if not, write to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+# You should have received a copy of the GNU General Public License
+# along with Koha; if not, see <http://www.gnu.org/licenses>.
use strict;
=head2 recordpayment
- &recordpayment($borrowernumber, $payment, $sip_paytype);
+ &recordpayment($borrowernumber, $payment, $sip_paytype, $note);
Record payment by a patron. C<$borrowernumber> is the patron's
borrower number. C<$payment> is a floating-point number, giving the
sub recordpayment {
#here we update the account lines
- my ( $borrowernumber, $data, $sip_paytype ) = @_;
+ my ( $borrowernumber, $data, $sip_paytype, $payment_note ) = @_;
my $dbh = C4::Context->dbh;
my $newamtos = 0;
my $accdata = "";
my $manager_id = 0;
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
+ $payment_note //= "";
+
# begin transaction
my $nextaccntno = getnextacctno($borrowernumber);
accountlines_id => $accdata->{'accountlines_id'},
accountno => $accdata->{'accountno'},
manager_id => $manager_id,
+ note => $payment_note,
}));
push( @ids, $accdata->{'accountlines_id'} );
}
# create new line
my $usth = $dbh->prepare(
"INSERT INTO accountlines
- (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id)
- VALUES (?,?,now(),?,'',?,?,?)"
+ (borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id, note)
+ VALUES (?,?,now(),?,'',?,?,?,?)"
);
my $paytype = "Pay";
$paytype .= $sip_paytype if defined $sip_paytype;
- $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id );
+ $usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $payment_note );
$usth->finish;
UpdateStats({
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)';
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount,
- "Payment, thanks - $user", 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
+ '', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note);
UpdateStats({
branch => $user,