From 21e0315bcbecaeaae862a28a1ef9893f6169321f Mon Sep 17 00:00:00 2001 From: "a. bellenir" Date: Wed, 13 Jun 2018 11:43:47 -0400 Subject: [PATCH] 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 --- Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 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 ea5138b78b..ba33335a7c 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 @@ -1139,6 +1139,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; @@ -1584,7 +1586,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 @@ -1650,8 +1659,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/)); -- 2.11.0