Bug 23012: get_lostreturn_policy returns a scalar

On commit 4d994773f8
Koha::Item->_set_found_trigger gets the call to get_lostreturn_policy()
changed so it expects a hashref instead of the scalar it returns. This
patch adjusts it back.

To test:
1. Run:
   $ kshell
  k$ prove t/db_dependent/Koha/Item.t
=> FAIL: Tests fail!
2. Apply this patch
3. Repeat 1
=> SUCCESS: Tests pass!

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Tomas Cohen Arazi 2022-10-24 18:36:46 -03:00
parent ca37a33e05
commit c2fee12cd0
No known key found for this signature in database
GPG Key ID: 0A272EA1B2F3C15F
1 changed files with 5 additions and 9 deletions

View File

@ -1159,15 +1159,13 @@ sub _set_found_trigger {
return $self unless $lost_age_in_days < $no_refund_after_days;
}
my $lost_proc_return_policy = Koha::CirculationRules->get_lostreturn_policy(
{
item => $self,
my $lostreturn_policy = Koha::CirculationRules->get_lostreturn_policy(
{ item => $self,
return_branch => C4::Context->userenv
? C4::Context->userenv->{'branch'}
: undef,
}
);
my $lostreturn_policy = $lost_proc_return_policy->{lostreturn};
);
if ( $lostreturn_policy ) {
@ -1325,9 +1323,7 @@ sub _set_found_trigger {
}
}
my $processingreturn_policy = $lost_proc_return_policy->{lostreturn};
if ( $processingreturn_policy ) {
if ( $lostreturn_policy ) {
# refund processing charge made for lost book
my $processing_charge = Koha::Account::Lines->search(
@ -1355,7 +1351,7 @@ sub _set_found_trigger {
# Use cases
if (
$processing_charge->amount > $processing_charge->amountoutstanding &&
$processingreturn_policy ne "refund_unpaid"
$lostreturn_policy ne "refund_unpaid"
) {
# some amount has been cancelled. collect the offsets that are not writeoffs
# this works because the only way to subtract from this kind of a debt is