Lines 157-163
sub makepayment {
Link Here
|
157 |
#here we update both the accountoffsets and the account lines |
157 |
#here we update both the accountoffsets and the account lines |
158 |
#updated to check, if they are paying off a lost item, we return the item |
158 |
#updated to check, if they are paying off a lost item, we return the item |
159 |
# from their card, and put a note on the item record |
159 |
# from their card, and put a note on the item record |
160 |
my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; |
160 |
my ( $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
161 |
my $dbh = C4::Context->dbh; |
161 |
my $dbh = C4::Context->dbh; |
162 |
my $manager_id = 0; |
162 |
my $manager_id = 0; |
163 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
163 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 197-210
sub makepayment {
Link Here
|
197 |
|
197 |
|
198 |
# create new line |
198 |
# create new line |
199 |
my $payment = 0 - $amount; |
199 |
my $payment = 0 - $amount; |
|
|
200 |
$payment_note = "" unless defined $payment_note; |
200 |
|
201 |
|
201 |
my $ins = |
202 |
my $ins = |
202 |
$dbh->prepare( |
203 |
$dbh->prepare( |
203 |
"INSERT |
204 |
"INSERT |
204 |
INTO accountlines (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding) |
205 |
INTO accountlines (borrowernumber, accountno, date, amount, description, accounttype, amountoutstanding, note) |
205 |
VALUES ( ?, ?, now(), ?, 'Payment,thanks', 'Pay', 0)" |
206 |
VALUES ( ?, ?, now(), ?, 'Payment,thanks', 'Pay', 0, ?)" |
206 |
); |
207 |
); |
207 |
$ins->execute($borrowernumber, $nextaccntno, $payment); |
208 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $payment_note); |
208 |
$ins->finish; |
209 |
$ins->finish; |
209 |
} |
210 |
} |
210 |
|
211 |
|
Lines 724-733
sub recordpayment_selectaccts {
Link Here
|
724 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
725 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
725 |
# fills in |
726 |
# fills in |
726 |
sub makepartialpayment { |
727 |
sub makepartialpayment { |
727 |
my ( $borrowernumber, $accountno, $amount, $user, $branch ) = @_; |
728 |
my ( $borrowernumber, $accountno, $amount, $user, $branchm, $payment_note ) = @_; |
728 |
if (!$amount || $amount < 0) { |
729 |
if (!$amount || $amount < 0) { |
729 |
return; |
730 |
return; |
730 |
} |
731 |
} |
|
|
732 |
$payment_note = "" unless defined $payment_note; |
731 |
my $dbh = C4::Context->dbh; |
733 |
my $dbh = C4::Context->dbh; |
732 |
|
734 |
|
733 |
my $nextaccntno = getnextacctno($borrowernumber); |
735 |
my $nextaccntno = getnextacctno($borrowernumber); |
Lines 743-753
sub makepartialpayment {
Link Here
|
743 |
|
745 |
|
744 |
# create new line |
746 |
# create new line |
745 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
747 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
746 |
. 'description, accounttype, amountoutstanding) ' |
748 |
. 'description, accounttype, amountoutstanding, note) ' |
747 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0)'; |
749 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?)'; |
748 |
|
750 |
|
749 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
751 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
750 |
"Payment, thanks - $user", 'Pay'); |
752 |
"Payment, thanks - $user", 'Pay', $payment_note); |
751 |
|
753 |
|
752 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
754 |
UpdateStats( $user, 'payment', $amount, '', '', '', $borrowernumber, $accountno ); |
753 |
|
755 |
|