From a8381f9b9cb61b020893ae5ffe7eedfbd2e388a1 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 --- 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 19a8e97..01f2372 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 4343936..3ef36f6 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 dd271e6..70c002a 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)) { -- 1.7.2.5