From 851b15daacdefbd32d628222aff37ee400084530 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 5 Feb 2020 09:14:24 +0000 Subject: [PATCH] Bug 24474: Drop `ReturnLostItem` from ::Account classes This patche removes the ReturnLostItem calls from Koha::Account->pay and Koha::Account::Line->apply methods. --- Koha/Account.pm | 18 ------------------ Koha/Account/Line.pm | 10 ---------- 2 files changed, 28 deletions(-) diff --git a/Koha/Account.pm b/Koha/Account.pm index ae6bebbb7a..8f06ab8ede 100644 --- a/Koha/Account.pm +++ b/Koha/Account.pm @@ -24,7 +24,6 @@ use Data::Dumper; use List::MoreUtils qw( uniq ); use Try::Tiny; -use C4::Circulation qw( ReturnLostItem ); use C4::Letters; use C4::Log qw( logaction ); use C4::Stats qw( UpdateStats ); @@ -114,15 +113,6 @@ sub pay { $fine->amountoutstanding($new_amountoutstanding)->store(); $balance_remaining = $balance_remaining - $amount_to_pay; - # Same logic exists in Koha::Account::Line::apply - if ( $new_amountoutstanding == 0 - && $fine->itemnumber - && $fine->debit_type_code - && ( $fine->debit_type_code eq 'LOST' ) ) - { - C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); - } - my $account_offset = Koha::Account::Offset->new( { debit_id => $fine->id, @@ -174,14 +164,6 @@ sub pay { $fine->amountoutstanding( $old_amountoutstanding - $amount_to_pay ); $fine->store(); - if ( $fine->amountoutstanding == 0 - && $fine->itemnumber - && $fine->debit_type_code - && ( $fine->debit_type_code eq 'LOST' ) ) - { - C4::Circulation::ReturnLostItem( $self->{patron_id}, $fine->itemnumber ); - } - my $account_offset = Koha::Account::Offset->new( { debit_id => $fine->id, diff --git a/Koha/Account/Line.pm b/Koha/Account/Line.pm index 1fac85d10c..152a9ec214 100644 --- a/Koha/Account/Line.pm +++ b/Koha/Account/Line.pm @@ -482,16 +482,6 @@ sub apply { $self->amountoutstanding( $available_credit * -1 )->store; $debit->amountoutstanding( $owed - $amount_to_cancel )->store; - - # Same logic exists in Koha::Account::pay - if ( $debit->amountoutstanding == 0 - && $debit->itemnumber - && $debit->debit_type_code - && $debit->debit_type_code eq 'LOST' ) - { - C4::Circulation::ReturnLostItem( $self->borrowernumber, $debit->itemnumber ); - } - } }); -- 2.20.1