From 3a814ff573f9491156c252fa3b2b6bcb6b82a461 Mon Sep 17 00:00:00 2001 From: Petro Vashchuk Date: Fri, 5 Aug 2022 15:47:41 +0300 Subject: [PATCH] Bug 30500: (QA follow-up) Separate code execution streams for obviously independent parameters When $new_pickup_location gets passed as parameter it doesn't make any sense to also check is_cancelable_from_opac. Also this makes code more clearer as it seemed like it was possible for item to get cancelled at the same time as request to change pickup location. Signed-off-by: Tomas Cohen Arazi --- opac/opac-modrequest.pl | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/opac/opac-modrequest.pl b/opac/opac-modrequest.pl index c12ac95d24..4eb805b359 100755 --- a/opac/opac-modrequest.pl +++ b/opac/opac-modrequest.pl @@ -54,16 +54,11 @@ if ( $reserve_id && $borrowernumber ) { exit; } - if ($cancellation_request) { + if ( $cancellation_request ) { $hold->add_cancellation_request if $hold->cancellation_requestable_from_opac; } - else { - $hold->cancel - if $hold->is_cancelable_from_opac; - } - - if ( $new_pickup_location ) { + elsif ( $new_pickup_location ) { if ( C4::Context->preference('OPACInTransitHoldPickupLocationChange') ) { $hold->set_pickup_location({ library_id => $new_pickup_location }); @@ -74,6 +69,9 @@ if ( $reserve_id && $borrowernumber ) { exit; } } + elsif ( $hold->is_cancelable_from_opac ) { + $hold->cancel; + } } print $query->redirect("/cgi-bin/koha/opac-user.pl#opac-user-holds"); -- 2.39.5