From b7d7ab764a76b07fd2a853c504813ccc076b5aba Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Thu, 25 Feb 2016 16:18:50 -0500 Subject: [PATCH] Add fix to Evergreen driver for missing hold notification parameters. When the default phone or sms hold notifications are empty strings, the hold placement would fail. This commit attempts to rectify that. Signed-off-by: Jason Stephenson --- lib/NCIP/ILS/Evergreen.pm | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/lib/NCIP/ILS/Evergreen.pm b/lib/NCIP/ILS/Evergreen.pm index 2e2bbd5..85aa440 100644 --- a/lib/NCIP/ILS/Evergreen.pm +++ b/lib/NCIP/ILS/Evergreen.pm @@ -2355,21 +2355,29 @@ sub place_hold { } if ($hold_notify->value() =~ /phone/) { my ($default_phone) = grep {$_->name() eq 'opac.default_phone'} @{$user->settings()}; + # We need to validate the value, because it could be an empty string. if ($default_phone) { - $params->{phone_notify} = $default_phone->value(); - $params->{phone_notify} =~ s/"//g; - } elsif ($user->day_phone()) { - $params->{phone_notify} = $user->day_phone(); + $default_phone = $default_phone->value(); + $default_phone =~ s/"//g; } + # Use day phone as fallback if it is empty. + $default_phone = $user->day_phone() unless ($default_phone); + $params->{phone_notify} = $default_phone if ($default_phone); } if ($hold_notify->value() =~ /sms/) { my ($sms_carrier) = grep {$_->name() eq 'opac.default_sms_carrier'} @{$user->settings()}; my ($sms_notify) = grep {$_->name() eq 'opac.default_sms_notify'} @{$user->settings()}; if ($sms_carrier && $sms_notify) { - $params->{sms_carrier} = $sms_carrier->value(); - $params->{sms_notify} = $sms_notify->value(); - $params->{sms_carrier} =~ s/"//g; - $params->{sms_notify} =~ s/"//g; + # We need to validate the values as well, because + # they can be empty strings. + $sms_carrier = $sms_carrier->value(); + $sms_carrier =~ s/"//g; + $sms_notify = $sms_notify->value(); + $sms_notify =~ s/"//g; + if ($sms_carrier && $sms_notify) { + $params->{sms_carrier} = $sms_carrier; + $params->{sms_notify} = $sms_notify; + } } } } else { -- 2.43.2