From 93fc3c14d09dfbc701077481654f988556d537a5 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Sun, 5 Oct 2014 12:10:55 -0400 Subject: [PATCH] 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 --- lib/NCIP/ILS/Evergreen.pm | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) 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); } } -- 2.43.2