From b5ebd57591c3b9cb2fa3c84735b2abd2c6e327bf Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Thu, 6 Jun 2019 14:50:05 -0500 Subject: [PATCH] Bug 9834: Preserve biblio level hold preference on reverting waiting status When the waiting status of a hold is revert we want to preserve the level hold preference of the user. Test plan: Place a hold at biblio level Confirm the hold Revert the waiting hold => The hold must still be considered as a biblio level hold ("next available item") Signed-off-by: Liz Rea --- C4/Reserves.pm | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index 205ed7873a..097a5c09d6 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -210,6 +210,7 @@ sub AddReserve { waitingdate => $waitingdate, expirationdate => $expdate, itemtype => $itemtype, + item_level_hold => $checkitem ? 1 : 0, } )->store(); $hold->set_waiting() if $found eq 'W'; @@ -1894,6 +1895,8 @@ sub RevertWaitingStatus { $sth->execute( $itemnumber ); my $reserve = $sth->fetchrow_hashref(); + my $hold = Koha::Holds->find( $reserve->{reserve_id} ); # TODO Remove the next raw SQL statements and use this instead + ## Increment the priority of all other non-waiting ## reserves for this bib record $query = " @@ -1920,6 +1923,11 @@ sub RevertWaitingStatus { "; $sth = $dbh->prepare( $query ); $sth->execute( $reserve->{'reserve_id'} ); + + unless ( $hold->item_level_hold ) { + $hold->itemnumber(undef)->store; + } + _FixPriority( { biblionumber => $reserve->{biblionumber} } ); } -- 2.11.0