From eb075145c6d3b7148c9ff04f02056658167e22f7 Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Thu, 13 Mar 2025 23:55:10 +0000 Subject: [PATCH] Bug 31698: Flip the logic for priority --- Koha/Hold.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/Koha/Hold.pm b/Koha/Hold.pm index 54056435ac3..36336dad812 100644 --- a/Koha/Hold.pm +++ b/Koha/Hold.pm @@ -203,20 +203,19 @@ sub move_hold_item { if ( $canReserve->{status} eq 'OK' ) { - # Find the highest priority among holds on the new item + # Find the lowest priority among holds on the new item my $highest_new_priority = Koha::Holds->search( { biblionumber => $new_biblionumber }, { order_by => { -desc => 'priority' }, rows => 1 } )->next; - - my $max_new_priority = $highest_new_priority ? $highest_new_priority->priority : 0; - my $new_priority = $max_new_priority + 1; + my $next_available_priority = + $highest_new_priority ? $highest_new_priority->priority + 1 : 1; # Always start at 1 if empty $self->update( { itemnumber => $new_item->itemnumber, biblionumber => $new_item->biblionumber, - priority => $new_priority, + priority => $next_available_priority, } ); -- 2.39.5