From 1ca160e45d0487ac02747ab464d94ac4c5ed7137 Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Tue, 30 Jul 2024 17:30:48 +0000 Subject: [PATCH] Bug 37413: Prevent altering multiple item-level holds when setting one with no barcode to next available To test: 1) Place an item level hold on the item with no barcode 2) Place an item level hold on any other item 3) From the Holds tab, change the dropdown of the first one from "no barcode" to "next available" 4) Update holds 5) Both item level holds are now next available holds. 6) Cancel these holds and repeats steps 1-4 again 7) This time, only the hold we switched to "next available" is changed Signed-off-by: David Nind --- reserve/modrequest.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/reserve/modrequest.pl b/reserve/modrequest.pl index fbf960a554..91aeb83c1b 100755 --- a/reserve/modrequest.pl +++ b/reserve/modrequest.pl @@ -69,15 +69,17 @@ if( $op eq 'cud-cancelall' || $op eq 'cud-modifyall' ) { $params->{reservedate} = $reservedates[$i] || undef; } - try { - ModReserve($params); - } catch { - if ($_->isa('Koha::Exceptions::ObjectNotFound')){ - warn $_; - } else { - $_->rethrow; - } - }; + if ( $op eq 'cud-cancelall' ) { + try { + ModReserve($params); + } catch { + if ( $_->isa('Koha::Exceptions::ObjectNotFound') ) { + warn $_; + } else { + $_->rethrow; + } + }; + } if ( $query->param( "change_hold_type_" . $reserve_id[$i] ) ) { my $hold = Koha::Holds->find( $reserve_id[$i] ); -- 2.39.2