Bug 19066: (QA follow-up) Add handling in add_credit

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
This commit is contained in:
Martin Renvoize 2018-11-02 15:10:44 +00:00 committed by Nick Clemens
parent 897ddc82b3
commit 258720579b
2 changed files with 8 additions and 2 deletions

View file

@ -2429,10 +2429,12 @@ sub _FixAccountForLostAndReturned {
my $credit_total = $accountline->amountoutstanding + $total_to_refund;
if ( $credit_total > 0 ) {
my $branchcode = C4::Context->userenv ? C4::Context->userenv->{'branch'} : undef;
$credit = $account->add_credit(
{ amount => $credit_total,
description => 'Item Returned ' . $item_id,
type => 'lost_item_return'
type => 'lost_item_return',
library_id => $branchcode
}
);

View file

@ -352,6 +352,7 @@ sub add_credit {
# Insert the account line
$line = Koha::Account::Line->new(
{ borrowernumber => $self->{patron_id},
accountno => $accountno,
date => \'NOW()',
amount => $amount,
description => $description,
@ -360,7 +361,9 @@ sub add_credit {
payment_type => $payment_type,
note => $note,
manager_id => $user_id,
itemnumber => $item_id
branchcode => $library_id,
itemnumber => $item_id,
lastincrement => undef,
}
)->store();
@ -396,6 +399,7 @@ sub add_credit {
note => $note,
itemnumber => $item_id,
manager_id => $user_id,
branchcode => $library_id,
}
)
);