From e29a6b2987f7dd002c034179863206c37bd4d7c7 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 13 Jan 2022 09:45:12 -0300 Subject: [PATCH] Bug 29869: Remove C4::Reserves::ModReserveFill Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall --- C4/Reserves.pm | 30 +++++------------------------- C4/SIP/ILS/Item.pm | 8 ++++++-- C4/SIP/ILS/Transaction/Checkout.pm | 1 - 3 files changed, 11 insertions(+), 28 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 21a32bb4048..c9a721033f5 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -107,7 +107,6 @@ BEGIN { ChargeReserveFee GetReserveFee - ModReserveFill ModReserveAffect ModReserve ModReserveStatus @@ -1093,26 +1092,6 @@ sub ModReserve { } } -=head2 ModReserveFill - - &ModReserveFill($reserve); - -Fill a reserve. If I understand this correctly, this means that the -reserved book has been found and given to the patron who reserved it. - -C<$reserve> specifies the reserve to fill. It is a reference-to-hash -whose keys are fields from the reserves table in the Koha database. - -=cut - -sub ModReserveFill { - my ($res) = @_; - my $reserve_id = $res->{'reserve_id'}; - - my $hold = Koha::Holds->find($reserve_id); - $hold->fill; -} - =head2 ModReserveStatus &ModReserveStatus($itemnumber, $newstatus); @@ -1795,7 +1774,7 @@ sub _Findgroupreserve { _koha_notify_reserve( $hold->reserve_id ); Sends a notification to the patron that their hold has been filled (through -ModReserveAffect, _not_ ModReserveFill) +ModReserveAffect) The letter code for this notice may be found using the following query: @@ -1956,10 +1935,11 @@ sub MoveReserve { my ( $restype, $res, undef ) = CheckReserves( $itemnumber, undef, $lookahead ); return unless $res; - my $biblionumber = $res->{biblionumber}; + my $biblionumber = $res->{biblionumber}; if ($res->{borrowernumber} == $borrowernumber) { - ModReserveFill($res); + my $hold = Koha::Holds->find( $res->{reserve_id} ); + $hold->fill; } else { # warn "Reserved"; @@ -1975,7 +1955,7 @@ sub MoveReserve { if ( $borr_res ) { # The item is reserved by the current patron - ModReserveFill($borr_res->unblessed); + $borr_res->fill; } if ( $cancelreserve eq 'revert' ) { ## Revert waiting reserve to priority 1 diff --git a/C4/SIP/ILS/Item.pm b/C4/SIP/ILS/Item.pm index d57947a3686..a85a557d007 100644 --- a/C4/SIP/ILS/Item.pm +++ b/C4/SIP/ILS/Item.pm @@ -21,7 +21,6 @@ use C4::Circulation qw( barcodedecode ); use C4::Context; use C4::Items; use C4::Members; -use C4::Reserves qw( ModReserveFill ); use Koha::Biblios; use Koha::Checkouts::ReturnClaims; use Koha::Checkouts; @@ -404,13 +403,18 @@ sub barcode_is_borrowernumber { # because hold_queue only has borrowernumber. return unless $converted; return ($number == $converted); } +# FIXME: This methods is very likely not used. It's only reference in the codebase +# is itself. I'm 'fixing' it so we can remove ModReserveFill. But filing a bug +# for properly removing it. sub fill_reserve { my $self = shift; my $hold = shift or return; foreach (qw(biblionumber borrowernumber reservedate)) { $hold->{$_} or return; } - return ModReserveFill($hold); + + my $hold_obj = Koha::Holds->find( $hold->id ); + return $hold_obj->fill; } =head2 build_additional_item_fields_string diff --git a/C4/SIP/ILS/Transaction/Checkout.pm b/C4/SIP/ILS/Transaction/Checkout.pm index f5c88766ca1..b9fa51979e9 100644 --- a/C4/SIP/ILS/Transaction/Checkout.pm +++ b/C4/SIP/ILS/Transaction/Checkout.pm @@ -17,7 +17,6 @@ use C4::SIP::ILS::Transaction; use C4::Context; use C4::Circulation qw( AddIssue GetIssuingCharges CanBookBeIssued ); use C4::Members; -use C4::Reserves qw(ModReserveFill); use Koha::DateUtils; use parent qw(C4::SIP::ILS::Transaction); -- 2.30.2