@@ -, +, @@ past end of array 1 - Add holds with lowest priorty to 2 records in the catalog 2 - Add a hold on a third record 3 - Note errors in log like: [2021/07/23 17:47:17] [WARN] splice() offset past end of array at /kohadevbox/koha/C4/Reserves.pm line 1649 4 - Apply patch and restart all the things 5 - Add a new hold on third record - no warns 6 - Make one of the holds on third record have lowestPriority (click rightmost arrow with line at bottom) 7 - Note no warns 8 - Adjust other holds on record and note no warns --- C4/Reserves.pm | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) --- a/C4/Reserves.pm +++ a/C4/Reserves.pm @@ -1643,9 +1643,9 @@ sub _FixPriority { # if index exists in array then move it to new position if ( $key > -1 && $rank ne 'del' && $rank > 0 ) { - my $new_rank = $rank - - 1; # $new_rank is what you want the new index to be in the array + my $new_rank = $rank - 1; # $new_rank is what you want the new index to be in the array my $moving_item = splice( @priority, $key, 1 ); + $new_rank = scalar @priority if $new_rank > scalar @priority; splice( @priority, $new_rank, 0, $moving_item ); } @@ -1663,10 +1663,9 @@ sub _FixPriority { ); } - $sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 ORDER BY priority" ); - $sth->execute(); - unless ( $ignoreSetLowestRank ) { + $sth = $dbh->prepare( "SELECT reserve_id FROM reserves WHERE lowestPriority = 1 AND biblionumber = ? ORDER BY priority" ); + $sth->execute($biblionumber); while ( my $res = $sth->fetchrow_hashref() ) { _FixPriority({ reserve_id => $res->{'reserve_id'}, --