From: Jeff Davis Date: Fri, 22 May 2020 22:40:30 +0000 (-0700) Subject: LP#1879993: use default value for opac.hold_notify when appropriate X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=931dbb4c83128010f6563fc03426b8e4fcf0b5de;p=evergreen%2Fpines.git LP#1879993: use default value for opac.hold_notify when appropriate Signed-off-by: Jeff Davis Signed-off-by: Michele Morgan Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js index 17c908b7c8..e161105532 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js @@ -1296,9 +1296,16 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , // passsword may originate from staged user. $scope.generate_password(); } - $scope.hold_notify_type.phone = true; - $scope.hold_notify_type.email = true; - $scope.hold_notify_type.sms = false; + + var notify = 'phone:email'; // hard-coded default when opac.hold_notify has no reg_default + var notify_stype = $scope.user_setting_types['opac.hold_notify']; + if (notify_stype && notify_stype.reg_default() !== undefined && notify_stype.reg_default() !== null) { + console.log('using default opac.hold_notify'); + notify = notify_stype.reg_default(); + } + $scope.hold_notify_type.phone = Boolean(notify.match(/phone/)); + $scope.hold_notify_type.email = Boolean(notify.match(/email/)); + $scope.hold_notify_type.sms = Boolean(notify.match(/sms/)); // staged users may be loaded w/ a profile. $scope.set_expire_date(); @@ -1897,12 +1904,21 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , function extract_hold_notify() { var p = $scope.patron; + + // get the user's opac.hold_notify setting var notify = $scope.user_settings['opac.hold_notify']; + // if it's not set, use the default opac.hold_notify value if (!notify && !(notify === '')) { - $scope.hold_notify_type.phone = true; - $scope.hold_notify_type.email = true; - return; + var notify_stype = $scope.user_setting_types['opac.hold_notify']; + if (notify_stype && notify_stype.reg_default() !== undefined && notify_stype.reg_default() !== null) { + notify = notify_stype.reg_default(); + } else { + // no setting and no default: set phone and email to true + $scope.hold_notify_type.phone = true; + $scope.hold_notify_type.email = true; + return; + } } $scope.hold_notify_type.phone = Boolean(notify.match(/phone/));