From 3bc14af683fbdb37e881d16d0f7da5ef313c165a Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Fri, 31 Oct 2014 09:51:43 -0400 Subject: [PATCH] Bug 13116 [QA Followup] - Remove tabs, use unless instead of if Signed-off-by: Tomas Cohen Arazi --- C4/Reserves.pm | 6 +++--- opac/opac-reserve.pl | 13 +++++-------- reserve/request.pl | 27 ++++++++++++++------------- 3 files changed, 22 insertions(+), 24 deletions(-) diff --git a/C4/Reserves.pm b/C4/Reserves.pm index f69d6accd5..5c4f981f47 100644 --- a/C4/Reserves.pm +++ b/C4/Reserves.pm @@ -465,9 +465,9 @@ sub CanBookBeReserved{ push (@$items,@hostitems); } - my $canReserve; - foreach my $item (@$items){ - $canReserve = CanItemBeReserved($borrowernumber, $item); + my $canReserve; + foreach my $item (@$items) { + $canReserve = CanItemBeReserved( $borrowernumber, $item ); return 'OK' if $canReserve eq 'OK'; } return $canReserve; diff --git a/opac/opac-reserve.pl b/opac/opac-reserve.pl index 4343936d8b..3ef36f6d9b 100755 --- a/opac/opac-reserve.pl +++ b/opac/opac-reserve.pl @@ -548,14 +548,11 @@ foreach my $biblioNum (@biblionumbers) { if ($biblioLoopIter{already_reserved}) { $biblioLoopIter{holdable} = undef; } - my $canReserve = CanBookBeReserved($borrowernumber,$biblioNum); - if ($canReserve eq 'OK') { - #All is OK! - } - else { - $biblioLoopIter{holdable} = undef; - $biblioLoopIter{ $canReserve } = 1; - } + my $canReserve = CanBookBeReserved($borrowernumber,$biblioNum); + unless ($canReserve eq 'OK') { + $biblioLoopIter{holdable} = undef; + $biblioLoopIter{ $canReserve } = 1; + } if(not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowernumber,$biblioNum)) { $biblioLoopIter{holdable} = undef; $biblioLoopIter{already_patron_possession} = 1; diff --git a/reserve/request.pl b/reserve/request.pl index dd271e6b27..70c002ace9 100755 --- a/reserve/request.pl +++ b/reserve/request.pl @@ -191,20 +191,21 @@ foreach my $biblionumber (@biblionumbers) { my $dat = GetBiblioData($biblionumber); - my $canReserve = CanBookBeReserved($borrowerinfo->{borrowernumber}, $biblionumber); - if ($canReserve eq 'OK') { - #All is OK and we can continue - } - elsif ( $canReserve eq 'tooManyReserves' ) { - $maxreserves = 1; + my $canReserve = CanBookBeReserved( $borrowerinfo->{borrowernumber}, $biblionumber ); + if ( $canReserve eq 'OK' ) { + + #All is OK and we can continue + } + elsif ( $canReserve eq 'tooManyReserves' ) { + $maxreserves = 1; + } + elsif ( $canReserve eq 'ageRestricted' ) { + $template->param( $canReserve => 1 ); + $biblioloopiter{$canReserve} = 1; + } + else { + $biblioloopiter{$canReserve} = 1; } - elsif ( $canReserve eq 'ageRestricted' ) { - $template->param( $canReserve => 1 ); - $biblioloopiter{ $canReserve } = 1; - } - else { - $biblioloopiter{ $canReserve } = 1; - } my $alreadypossession; if (not C4::Context->preference('AllowHoldsOnPatronsPossessions') and CheckIfIssuedToPatron($borrowerinfo->{borrowernumber},$biblionumber)) { -- 2.39.5