From 931dbb4c83128010f6563fc03426b8e4fcf0b5de Mon Sep 17 00:00:00 2001 From: Jeff Davis Date: Fri, 22 May 2020 15:40:30 -0700 Subject: [PATCH] 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 --- .../web/js/ui/default/staff/circ/patron/regctl.js | 28 +++++++++++++++++----- 1 file changed, 22 insertions(+), 6 deletions(-) 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/)); -- 2.11.0