From 572e1e1087c4ddf43062d259ae7a8cb01774f273 Mon Sep 17 00:00:00 2001 From: Tomas Cohen Arazi Date: Thu, 13 Jan 2022 09:08:11 -0300 Subject: [PATCH] Bug 29869: Make ModReserveFill a (temporary) wrapper for Koha::Hold->fill Before diving into removing ModReserveFill, I propose this: In order to perform real-life testing of the new Koha::Hold->fill method, this patch makes the ModReserveFill method, just call the new one. To test: 1. Apply this patchset 2. Run: $ kshell k$ prove t/db_dependent/Koha/Hold* \ t/db_dependent/Hold* \ t/db_dependent/api/v1/holds.t \ t/db_dependent/Reserves* \ t/db_dependent/Circulation* \ t/db_dependent/SIP/* => SUCCESS: Tests pass! 3. Sign off :-D --- C4/Reserves.pm | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 1490d5aa88..21a32bb404 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -1110,35 +1110,7 @@ sub ModReserveFill { my $reserve_id = $res->{'reserve_id'}; my $hold = Koha::Holds->find($reserve_id); - # get the priority on this record.... - my $priority = $hold->priority; - - # update the hold statuses, no need to store it though, we will be deleting it anyway - $hold->set( - { - found => 'F', - priority => 0, - } - ); - - logaction( 'HOLDS', 'MODIFY', $hold->reserve_id, $hold ) - if C4::Context->preference('HoldsLog'); - - # FIXME Must call Koha::Hold->cancel ? => No, should call ->filled and add the correct log - Koha::Old::Hold->new( $hold->unblessed() )->store(); - - $hold->delete(); - - if ( C4::Context->preference('HoldFeeMode') eq 'any_time_is_collected' ) { - my $reserve_fee = GetReserveFee( $hold->borrowernumber, $hold->biblionumber ); - ChargeReserveFee( $hold->borrowernumber, $reserve_fee, $hold->biblio->title ); - } - - # now fix the priority on the others (if the priority wasn't - # already sorted!).... - unless ( $priority == 0 ) { - _FixPriority( { reserve_id => $reserve_id, biblionumber => $hold->biblionumber } ); - } + $hold->fill; } =head2 ModReserveStatus -- 2.34.1