Bug 21720: Use Koha::Account->add_debit in AddIssuingCharge
Known Side Effect: Prior to this patch issuing charges were not recorded in the FinesLog. After this patch, if the FinesLog is enabled then the 'action' will be recorded as `create_rent`. Sponsored-by: PTFS Europe Signed-off-by: Josef Moravec <josef.moravec@gmail.com> Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io> Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
parent
a639299c98
commit
b104046d89
1 changed files with 11 additions and 28 deletions
|
@ -3219,36 +3219,19 @@ sub AddIssuingCharge {
|
|||
|
||||
# FIXME What if checkout does not exist?
|
||||
|
||||
my $nextaccntno = C4::Accounts::getnextacctno( $checkout->borrowernumber );
|
||||
|
||||
my $manager_id = 0;
|
||||
$manager_id = C4::Context->userenv->{'number'} if C4::Context->userenv;
|
||||
|
||||
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
|
||||
|
||||
my $accountline = Koha::Account::Line->new(
|
||||
my $account = Koha::Account->new({ patron_id => $checkout->borrowernumber });
|
||||
my $accountline = $account->add_debit(
|
||||
{
|
||||
borrowernumber => $checkout->borrowernumber,
|
||||
itemnumber => $checkout->itemnumber,
|
||||
issue_id => $checkout->issue_id,
|
||||
accountno => $nextaccntno,
|
||||
amount => $charge,
|
||||
amountoutstanding => $charge,
|
||||
manager_id => $manager_id,
|
||||
branchcode => $branchcode,
|
||||
description => 'Rental',
|
||||
accounttype => 'Rent',
|
||||
date => \'NOW()',
|
||||
note => undef,
|
||||
user_id => C4::Context->userenv ? C4::Context->userenv->{'number'} : 0,
|
||||
library_id => C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef,
|
||||
type => 'rent',
|
||||
item_id => $checkout->itemnumber,
|
||||
issue_id => $checkout->issue_id,
|
||||
}
|
||||
)->store();
|
||||
|
||||
Koha::Account::Offset->new(
|
||||
{
|
||||
debit_id => $accountline->id,
|
||||
type => 'Rental Fee',
|
||||
amount => $charge,
|
||||
}
|
||||
)->store();
|
||||
);
|
||||
}
|
||||
|
||||
=head2 GetTransfers
|
||||
|
|
Loading…
Reference in a new issue