LP#1620750 Prevent log warning for uninit var in checkin_retarget() user/csharp/lp1620750_uninit_var_checkin_retarget
authorDan Scott <dscott@laurentian.ca>
Tue, 6 Sep 2016 17:53:02 +0000 (13:53 -0400)
committerChris Sharp <csharp@georgialibraries.org>
Thu, 29 Sep 2016 12:52:18 +0000 (08:52 -0400)
If the retarget_mode variable is not initialized, then a warning is generated
in the logs every time an item is checked in. Avoid the warning by
short-circuiting before testing the value in the regex.

Signed-off-by: Dan Scott <dscott@laurentian.ca>
Signed-off-by: Chris Sharp <csharp@georgialibraries.org>
Open-ILS/src/perlmods/lib/OpenILS/Application/Circ/Circulate.pm

index d142df6..8daab0c 100644 (file)
@@ -2229,7 +2229,7 @@ sub check_transit_checkin_interval {
 # Retarget local holds at checkin
 sub checkin_retarget {
     my $self = shift;
-    return unless $self->retarget_mode =~ m/retarget/; # Retargeting?
+    return unless $self->retarget_mode and $self->retarget_mode =~ m/retarget/; # Retargeting?
     return unless $self->is_checkin; # Renewals need not be checked
     return if $self->capture eq 'nocapture'; # Not capturing holds anyway? Move on.
     return if $self->is_precat; # No holds for precats