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 <tomascohen@theke.io>
This commit is contained in:
Petro Vashchuk 2022-08-05 15:47:41 +03:00 committed by Tomas Cohen Arazi
parent 6215f9a0e1
commit 3a814ff573
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F

View file

@ -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");