From 83fa75d46610cd10c77ff2d1d3c352de6a0b81f2 Mon Sep 17 00:00:00 2001 From: Josef Moravec Date: Thu, 19 Nov 2020 06:27:49 +0000 Subject: [PATCH] Bug 24488: (QA follow-up) Go to next loop as early as possible Content-Type: text/plain; charset=utf-8 Signed-off-by: Josef Moravec Signed-off-by: Marcel de Rooy --- circ/pendingreserves.pl | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/circ/pendingreserves.pl b/circ/pendingreserves.pl index b7b362fb71..bc7b25b001 100755 --- a/circ/pendingreserves.pl +++ b/circ/pendingreserves.pl @@ -252,6 +252,11 @@ foreach my $bibnum ( @biblionumbers ){ my $hold_info; my $items = $all_items->{$bibnum}; + my $items_count = defined $items ? scalar @$items : 0; + my $pull_count = $items_count <= $patrons_count->{$bibnum} ? $items_count : $patrons_count->{$bibnum}; + if ( $pull_count == 0 ) { + next; + } # get available item types for each biblio my @res_itemtypes; @@ -286,16 +291,12 @@ foreach my $bibnum ( @biblionumbers ){ $hold_info->{holdingbranches} = [ uniq map { defined $_->holdingbranch ? $_->holdingbranch : () } @$items ]; # items available - my $items_count = scalar @$items; $hold_info->{items_count} = $items_count; # patrons with holds $hold_info->{patrons_count} = $patrons_count->{$bibnum}; - my $pull_count = $items_count <= $patrons_count->{$bibnum} ? $items_count : $patrons_count->{$bibnum}; - if ( $pull_count == 0 ) { - next; - } + # number of items to pull $hold_info->{pull_count} = $pull_count; # get other relevant information -- 2.11.0