From: Jason Stephenson Date: Sun, 5 Oct 2014 16:10:55 +0000 (-0400) Subject: Try to fix a warning when checking penalties. X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=93fc3c14d09dfbc701077481654f988556d537a5;p=NCIPServer.git Try to fix a warning when checking penalties. Use of uninitialized value in pattern match (m//) at /home/opensrf/NCIPServer/lib/NCIP/ILS/Evergreen.pm line 1595. Signed-off-by: Jason Stephenson --- diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index 23381e3..2bd524d 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -1591,20 +1591,26 @@ sub check_user_for_problems { # Next, check if the patron has one of the indicated blocks. unless ($problem) { - foreach my $block (@blocks) { - if (grep {$_->standing_penalty->block_list() =~ /$block/} @{$user->standing_penalties()}) { - $problem = NCIP::Problem->new( - { - ProblemType => 'User Blocked', - ProblemDetail => 'User blocked from ' . - ($block eq 'HOLD') ? 'holds' : (($block eq 'RENEW') ? 'renewals' : - (($block eq 'CIRC') ? 'checkout' : lc($block))), - ProblemElement => 'NULL', - ProblemValue => 'NULL' + foreach my $penalty (@{$user->standing_penalties()}) { + my @pblocks = split(/\|/, $penalty->standing_penalty->block_list()); + if (@pblocks) { + foreach my $block (@blocks) { + if (grep {$_ =~ /$block/} @pblocks) { + $problem = NCIP::Problem->new( + { + ProblemType => 'User Blocked', + ProblemDetail => 'User blocked from ' . + ($block eq 'HOLD') ? 'holds' : (($block eq 'RENEW') ? 'renewals' : + (($block eq 'CIRC') ? 'checkout' : lc($block))), + ProblemElement => 'NULL', + ProblemValue => 'NULL' + } + ); + last; } - ); - last; + } } + last if ($problem); } }