From 9486558416f3a8016aa1d1171a72fcf2373aa093 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Fri, 18 Dec 2020 11:56:22 +0100 Subject: [PATCH] Bug 27205: Improve logic readability in conditional Signed-off-by: Jonathan Druart (cherry picked from commit 85c25260853aa1c8003b0a041dba2772cd2f316b) Signed-off-by: Fridolin Somers (cherry picked from commit 6b24d072f9fc91e39e7f482467d93571b0c0e474) --- Koha/REST/V1/Holds.pm | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/Koha/REST/V1/Holds.pm b/Koha/REST/V1/Holds.pm index a6f36eecdd..06dce55908 100644 --- a/Koha/REST/V1/Holds.pm +++ b/Koha/REST/V1/Holds.pm @@ -255,11 +255,9 @@ sub edit { my $pickup_library_id = $body->{pickup_library_id}; - unless ( - !defined $pickup_library_id - or $hold->is_pickup_location_valid( - { library_id => $pickup_library_id } - ) + if ( + defined $pickup_library_id + and not $hold->is_pickup_location_valid({ library_id => $pickup_library_id }) ) { return $c->render( @@ -270,8 +268,7 @@ sub edit { ); } - $pickup_library_id = $hold->branchcode - unless defined $pickup_library_id; + $pickup_library_id //= $hold->branchcode; my $priority = $body->{priority} // $hold->priority; # suspended_until can also be set to undef my $suspended_until = exists $body->{suspended_until} ? $body->{suspended_until} : $hold->suspend_until; -- 2.39.5