LP#1642035-Small DRY refactor to regctl.js compress_hold_notify()
authorCesar Velez <cesar.velez@equinoxinitiative.org>
Fri, 2 Jun 2017 19:20:14 +0000 (15:20 -0400)
committerKathy Lussier <klussier@masslnc.org>
Wed, 21 Jun 2017 16:05:42 +0000 (12:05 -0400)
Signed-off by: Cesar Velez <cesar.velez@equinoxinitiative.org>

Signed-off-by: Kathy Lussier <klussier@masslnc.org>
Open-ILS/web/js/ui/default/staff/circ/patron/regctl.js

index 9d02459..4e53fde 100644 (file)
@@ -1500,21 +1500,18 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore ,
     // Translate hold notify preferences from the form/scope back into a 
     // single user setting value for opac.hold_notify.
     function compress_hold_notify() {
-        var hold_notify = '';
-        var splitter = '';
+        var hold_notify_methods = [];
         if ($scope.hold_notify_type.phone) {
-            hold_notify = 'phone';
-            splitter = ':';
+            hold_notify_methods.push('phone');
         }
         if ($scope.hold_notify_type.email) {
-            hold_notify = hold_notify + splitter + 'email';
-            splitter = ':';
+            hold_notify_methods.push('email');
         }
         if ($scope.hold_notify_type.sms) {
-            hold_notify = hold_notify + splitter + 'sms';
-            splitter = ':';
+            hold_notify_methods.push('sms');
         }
-        $scope.user_settings['opac.hold_notify'] = hold_notify;
+
+        $scope.user_settings['opac.hold_notify'] = hold_notify_methods.join(':');
     }
 
     // dialog for selecting additional permission groups