From 6f6f88105db069fb365307f2e2ffaae11c863421 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 27 Jan 2020 14:55:54 +0100 Subject: [PATCH] Bug 23070: Increment all priorities in 1 query Signed-off-by: Victor Grousset/tuxayo Signed-off-by: Katrin Fischer Signed-off-by: Jonathan Druart --- C4/Reserves.pm | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index a78f2a49f4..2a5904fd32 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -2006,10 +2006,8 @@ sub RevertWaitingStatus { ## Increment the priority of all other non-waiting ## reserves for this bib record - my $holds = Koha::Holds->search({ biblionumber => $hold->biblionumber, priority => { '>' => 0 } }); - while ( my $h = $holds->next ) { - $h->priority( $h->priority + 1 )->store; - } + my $holds = Koha::Holds->search({ biblionumber => $hold->biblionumber, priority => { '>' => 0 } }) + ->update({ priority => \'priority + 1' }); ## Fix up the currently waiting reserve $hold->set( -- 2.39.5