From 8dfc99af87415638ff0480cd31bc24d9eeff9243 Mon Sep 17 00:00:00 2001 From: David Cook Date: Mon, 12 Feb 2024 23:20:35 +0000 Subject: [PATCH] Bug 15565: Tidy reserve/placerequest.pl --- reserve/placerequest.pl | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/reserve/placerequest.pl b/reserve/placerequest.pl index 95e30836d3..24300aa53d 100755 --- a/reserve/placerequest.pl +++ b/reserve/placerequest.pl @@ -44,7 +44,7 @@ my $branch = $input->param('pickup'); my $startdate = $input->param('reserve_date') || ''; my @rank = $input->multi_param('rank-request'); my $title = $input->param('title'); -my @checkitems = $input->multi_param('checkitem'); +my @checkitems = $input->multi_param('checkitem'); my $item_group_id = $input->param('item_group_id'); my $expirationdate = $input->param('expiration_date'); my $itemtype = $input->param('itemtype') || undef; @@ -69,7 +69,7 @@ if ( $patron ) { my $can_override = C4::Context->preference('AllowHoldPolicyOverride'); if ( @checkitems ) { - for ( my $i = 0; $i < scalar @checkitems; $i++ ){ + for ( my $i = 0 ; $i < scalar @checkitems ; $i++ ) { my $checkitem = $checkitems[$i]; if ( my $item_pickup_location = $input->param("item_pickup_$checkitem") ) { @@ -79,9 +79,11 @@ if ( $patron ) { $biblionumber = $item->biblionumber; } - my $can_item_be_reserved = CanItemBeReserved($patron, $item, $item_pickup_location)->{status}; + my $can_item_be_reserved = CanItemBeReserved( $patron, $item, $item_pickup_location )->{status}; - if ( $can_item_be_reserved eq 'OK' || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) { + if ( $can_item_be_reserved eq 'OK' + || ( $can_item_be_reserved ne 'itemAlreadyOnHold' && $can_override ) ) + { AddReserve( { branchcode => $item_pickup_location, @@ -99,8 +101,7 @@ if ( $patron ) { } ); - } - else { + } else { $failed_holds{$can_item_be_reserved} = 1; } } @@ -154,11 +155,12 @@ if ( $patron ) { my $redirect_url = URI->new("request.pl"); my @failed_hold_msgs = (); + #NOTE: Deduplicate failed hold reason statuses/codes - foreach my $msg (keys %failed_holds){ - push(@failed_hold_msgs,$msg); + foreach my $msg ( keys %failed_holds ) { + push( @failed_hold_msgs, $msg ); } - $redirect_url->query_form( biblionumber => [@biblionumbers], failed_holds => \@failed_hold_msgs); + $redirect_url->query_form( biblionumber => [@biblionumbers], failed_holds => \@failed_hold_msgs ); print $input->redirect($redirect_url); } elsif ( $borrowernumber eq '' ) { -- 2.30.2