From: a. bellenir Date: Wed, 13 Jun 2018 15:43:47 +0000 (-0400) Subject: LP#1774268: display effective hold notify preference on patron editor X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=refs%2Fheads%2Fuser%2Frogan%2Flp1774268signoff;p=working%2FEvergreen.git LP#1774268: display effective hold notify preference on patron editor fallback on a default hold notify if user does not have a saved preference. skip saving if the value is unchanged from default. Signed-off-by: a. bellenir Signed-off-by: Rogan Hamby --- 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 cd8843a646..8122e1ecad 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 @@ -1231,6 +1231,8 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , patronSvc , patronRegSvc , egUnloadPrompt, egAlertDialog , egWorkLog) { + var default_hold_notify = ':phone:email'; + $scope.page_data_loaded = false; $scope.hold_notify_type = { phone : null, email : null, sms : null }; $scope.clone_id = patronRegSvc.clone_id = $routeParams.clone_id; @@ -1759,7 +1761,14 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , hold_notify_methods.push('sms'); } - $scope.user_settings['opac.hold_notify'] = hold_notify_methods.join(':'); + // always include a leading ':' to prevent saving an empty string + // this allows a user to specify that they do not want any notifications + // (otherwise the falsey empty string will fallback to default) + var notify_string = ':'+hold_notify_methods.join(':'); + // save only if there already was a value or the new value is non-default + if($scope.user_settings['opac.hold_notify'] || notify_string !== default_hold_notify){ + $scope.user_settings['opac.hold_notify'] = notify_string; + } } // dialog for selecting additional permission groups @@ -1825,8 +1834,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , } function extract_hold_notify() { - var notify = $scope.user_settings['opac.hold_notify']; - if (!notify) return; + var notify = $scope.user_settings['opac.hold_notify'] || default_hold_notify; $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/));