Lines 26-31
use C4::Members;
Link Here
|
26 |
use C4::Circulation qw(ReturnLostItem); |
26 |
use C4::Circulation qw(ReturnLostItem); |
27 |
use C4::Log qw(logaction); |
27 |
use C4::Log qw(logaction); |
28 |
use Koha::Account; |
28 |
use Koha::Account; |
|
|
29 |
use C4::Koha qw(GetKohaAuthorisedValueLib); |
29 |
|
30 |
|
30 |
use Data::Dumper qw(Dumper); |
31 |
use Data::Dumper qw(Dumper); |
31 |
|
32 |
|
Lines 90-96
sub makepayment {
Link Here
|
90 |
#here we update both the accountoffsets and the account lines |
91 |
#here we update both the accountoffsets and the account lines |
91 |
#updated to check, if they are paying off a lost item, we return the item |
92 |
#updated to check, if they are paying off a lost item, we return the item |
92 |
# from their card, and put a note on the item record |
93 |
# from their card, and put a note on the item record |
93 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
94 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note, $paymentmode ) = @_; |
94 |
my $dbh = C4::Context->dbh; |
95 |
my $dbh = C4::Context->dbh; |
95 |
my $manager_id = 0; |
96 |
my $manager_id = 0; |
96 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
97 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 129-138
sub makepayment {
Link Here
|
129 |
my $ins = |
130 |
my $ins = |
130 |
$dbh->prepare( |
131 |
$dbh->prepare( |
131 |
"INSERT |
132 |
"INSERT |
132 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
133 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note, paymentmode) |
133 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?)" |
134 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?, ?)" |
134 |
); |
135 |
); |
135 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
136 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode)); |
136 |
} |
137 |
} |
137 |
|
138 |
|
138 |
if ( C4::Context->preference("FinesLog") ) { |
139 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 480-486
will be credited to the next one.
Link Here
|
480 |
=cut |
481 |
=cut |
481 |
|
482 |
|
482 |
sub recordpayment_selectaccts { |
483 |
sub recordpayment_selectaccts { |
483 |
my ( $borrowernumber, $amount, $accts, $note ) = @_; |
484 |
my ( $borrowernumber, $amount, $accts, $note, $paymentmode ) = @_; |
484 |
|
485 |
|
485 |
my $dbh = C4::Context->dbh; |
486 |
my $dbh = C4::Context->dbh; |
486 |
my $newamtos = 0; |
487 |
my $newamtos = 0; |
Lines 540-548
sub recordpayment_selectaccts {
Link Here
|
540 |
|
541 |
|
541 |
# create new line |
542 |
# create new line |
542 |
$sql = 'INSERT INTO accountlines ' . |
543 |
$sql = 'INSERT INTO accountlines ' . |
543 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
544 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note,paymentmode) ' . |
544 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; |
545 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?,?)|; |
545 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); |
546 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode) ); |
546 |
UpdateStats({ |
547 |
UpdateStats({ |
547 |
branch => $branch, |
548 |
branch => $branch, |
548 |
type => 'payment', |
549 |
type => 'payment', |
Lines 570-576
sub recordpayment_selectaccts {
Link Here
|
570 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
571 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
571 |
# fills in |
572 |
# fills in |
572 |
sub makepartialpayment { |
573 |
sub makepartialpayment { |
573 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
574 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note, $paymentmode ) = @_; |
574 |
my $manager_id = 0; |
575 |
my $manager_id = 0; |
575 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
576 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
576 |
if (!$amount || $amount < 0) { |
577 |
if (!$amount || $amount < 0) { |
Lines 604-614
sub makepartialpayment {
Link Here
|
604 |
|
605 |
|
605 |
# create new line |
606 |
# create new line |
606 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
607 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
607 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
608 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note, paymentmode) ' |
608 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
609 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?,?)'; |
609 |
|
610 |
|
610 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
611 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
611 |
'', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
612 |
'', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode)); |
612 |
|
613 |
|
613 |
UpdateStats({ |
614 |
UpdateStats({ |
614 |
branch => $branch, |
615 |
branch => $branch, |