Lines 25-30
use C4::Stats;
Link Here
|
25 |
use C4::Members; |
25 |
use C4::Members; |
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 C4::Koha qw(GetKohaAuthorisedValueLib); |
28 |
|
29 |
|
29 |
use Data::Dumper qw(Dumper); |
30 |
use Data::Dumper qw(Dumper); |
30 |
|
31 |
|
Lines 88-94
will be credited to the next one.
Link Here
|
88 |
sub recordpayment { |
89 |
sub recordpayment { |
89 |
|
90 |
|
90 |
#here we update the account lines |
91 |
#here we update the account lines |
91 |
my ( $borrowernumber, $data, $sip_paytype, $payment_note ) = @_; |
92 |
my ( $borrowernumber, $data, $sip_paytype, $payment_note, $paymentmode ) = @_; |
92 |
my $dbh = C4::Context->dbh; |
93 |
my $dbh = C4::Context->dbh; |
93 |
my $newamtos = 0; |
94 |
my $newamtos = 0; |
94 |
my $accdata = ""; |
95 |
my $accdata = ""; |
Lines 148-160
sub recordpayment {
Link Here
|
148 |
# create new line |
149 |
# create new line |
149 |
my $usth = $dbh->prepare( |
150 |
my $usth = $dbh->prepare( |
150 |
"INSERT INTO accountlines |
151 |
"INSERT INTO accountlines |
151 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id, note) |
152 |
(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id, note, paymentmode) |
152 |
VALUES (?,?,now(),?,'',?,?,?,?)" |
153 |
VALUES (?,?,now(),?,'',?,?,?,?,?)" |
153 |
); |
154 |
); |
154 |
|
155 |
|
155 |
my $paytype = "Pay"; |
156 |
my $paytype = "Pay"; |
156 |
$paytype .= $sip_paytype if defined $sip_paytype; |
157 |
$paytype .= $sip_paytype if defined $sip_paytype; |
157 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $payment_note ); |
158 |
$usth->execute( $borrowernumber, $nextaccntno, 0 - $data, $paytype, 0 - $amountleft, $manager_id, $payment_note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode) ); |
158 |
$usth->finish; |
159 |
$usth->finish; |
159 |
|
160 |
|
160 |
UpdateStats({ |
161 |
UpdateStats({ |
Lines 204-210
sub makepayment {
Link Here
|
204 |
#here we update both the accountoffsets and the account lines |
205 |
#here we update both the accountoffsets and the account lines |
205 |
#updated to check, if they are paying off a lost item, we return the item |
206 |
#updated to check, if they are paying off a lost item, we return the item |
206 |
# from their card, and put a note on the item record |
207 |
# from their card, and put a note on the item record |
207 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
208 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note, $paymentmode ) = @_; |
208 |
my $dbh = C4::Context->dbh; |
209 |
my $dbh = C4::Context->dbh; |
209 |
my $manager_id = 0; |
210 |
my $manager_id = 0; |
210 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
211 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
Lines 243-252
sub makepayment {
Link Here
|
243 |
my $ins = |
244 |
my $ins = |
244 |
$dbh->prepare( |
245 |
$dbh->prepare( |
245 |
"INSERT |
246 |
"INSERT |
246 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note) |
247 |
INTO accountlines (borrowernumber, accountno, date, amount, itemnumber, description, accounttype, amountoutstanding, manager_id, note, paymentmode) |
247 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?)" |
248 |
VALUES ( ?, ?, now(), ?, ?, '', 'Pay', 0, ?, ?, ?)" |
248 |
); |
249 |
); |
249 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note); |
250 |
$ins->execute($borrowernumber, $nextaccntno, $payment, $data->{'itemnumber'}, $manager_id, $payment_note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode)); |
250 |
} |
251 |
} |
251 |
|
252 |
|
252 |
if ( C4::Context->preference("FinesLog") ) { |
253 |
if ( C4::Context->preference("FinesLog") ) { |
Lines 594-600
will be credited to the next one.
Link Here
|
594 |
=cut |
595 |
=cut |
595 |
|
596 |
|
596 |
sub recordpayment_selectaccts { |
597 |
sub recordpayment_selectaccts { |
597 |
my ( $borrowernumber, $amount, $accts, $note ) = @_; |
598 |
my ( $borrowernumber, $amount, $accts, $note, $paymentmode ) = @_; |
598 |
|
599 |
|
599 |
my $dbh = C4::Context->dbh; |
600 |
my $dbh = C4::Context->dbh; |
600 |
my $newamtos = 0; |
601 |
my $newamtos = 0; |
Lines 654-662
sub recordpayment_selectaccts {
Link Here
|
654 |
|
655 |
|
655 |
# create new line |
656 |
# create new line |
656 |
$sql = 'INSERT INTO accountlines ' . |
657 |
$sql = 'INSERT INTO accountlines ' . |
657 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note) ' . |
658 |
'(borrowernumber, accountno,date,amount,description,accounttype,amountoutstanding,manager_id,note,paymentmode) ' . |
658 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?)|; |
659 |
q|VALUES (?,?,now(),?,'','Pay',?,?,?,?)|; |
659 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note ); |
660 |
$dbh->do($sql,{},$borrowernumber, $nextaccntno, 0 - $amount, 0 - $amountleft, $manager_id, $note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode) ); |
660 |
UpdateStats({ |
661 |
UpdateStats({ |
661 |
branch => $branch, |
662 |
branch => $branch, |
662 |
type => 'payment', |
663 |
type => 'payment', |
Lines 684-690
sub recordpayment_selectaccts {
Link Here
|
684 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
685 |
# makepayment needs to be fixed to handle partials till then this separate subroutine |
685 |
# fills in |
686 |
# fills in |
686 |
sub makepartialpayment { |
687 |
sub makepartialpayment { |
687 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note ) = @_; |
688 |
my ( $accountlines_id, $borrowernumber, $accountno, $amount, $user, $branch, $payment_note, $paymentmode ) = @_; |
688 |
my $manager_id = 0; |
689 |
my $manager_id = 0; |
689 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
690 |
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv; |
690 |
if (!$amount || $amount < 0) { |
691 |
if (!$amount || $amount < 0) { |
Lines 718-728
sub makepartialpayment {
Link Here
|
718 |
|
719 |
|
719 |
# create new line |
720 |
# create new line |
720 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
721 |
my $insert = 'INSERT INTO accountlines (borrowernumber, accountno, date, amount, ' |
721 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note) ' |
722 |
. 'description, accounttype, amountoutstanding, itemnumber, manager_id, note, paymentmode) ' |
722 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?)'; |
723 |
. ' VALUES (?, ?, now(), ?, ?, ?, 0, ?, ?, ?,?)'; |
723 |
|
724 |
|
724 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
725 |
$dbh->do( $insert, undef, $borrowernumber, $nextaccntno, $amount, |
725 |
'', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note); |
726 |
'', 'Pay', $data->{'itemnumber'}, $manager_id, $payment_note, GetKohaAuthorisedValueLib('PAYMODE', $paymentmode)); |
726 |
|
727 |
|
727 |
UpdateStats({ |
728 |
UpdateStats({ |
728 |
branch => $branch, |
729 |
branch => $branch, |