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=216e36300063a430070c1747efad18c670fa2405;p=working%2FEvergreen.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 6e7e932953..3cb09ab21b 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 @@ -1294,9 +1294,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(); @@ -1871,12 +1878,20 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , } function extract_hold_notify() { + // 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/));