recent patrons wip
authorBill Erickson <berickxx@gmail.com>
Wed, 9 Aug 2017 02:12:52 +0000 (22:12 -0400)
committerBill Erickson <berickxx@gmail.com>
Wed, 9 Aug 2017 02:12:56 +0000 (22:12 -0400)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/sql/Pg/950.data.seed-values.sql
Open-ILS/src/sql/Pg/upgrade/XXXX.data.recent-patrons.sql
Open-ILS/web/js/ui/default/staff/circ/patron/app.js
Open-ILS/web/js/ui/default/staff/services/navbar.js
Open-ILS/web/js/ui/default/staff/services/startup.js

index 34ca281..7771591 100644 (file)
@@ -17125,9 +17125,4 @@ VALUES (
     'integer'
 );
 
--- For backwards compat apply a max count value of 1 globally.
-INSERT INTO actor.org_unit_setting (org_unit, name, value) 
-    SELECT id, 'ui.staff.max_recent_patrons', '1' 
-        FROM actor.org_unit WHERE parent_ou IS NULL;
-
 
index 8179879..3cf897d 100644 (file)
@@ -23,9 +23,4 @@ VALUES (
     'integer'
 );
 
--- For backwards compat apply a max count value of 1 globally.
-INSERT INTO actor.org_unit_setting (org_unit, name, value) 
-    SELECT id, 'ui.staff.max_recent_patrons', '1' 
-        FROM actor.org_unit WHERE parent_ou IS NULL;
-
 COMMIT;
index 34acd7f..3329e20 100644 (file)
@@ -683,10 +683,10 @@ function($scope,  $q , $location , $filter , egCore , egNet , egUser , egAlertDi
         $scope.aous = egCore.env.aous;
         $scope.auth_user_id = egCore.auth.user().id();
 
-        // max recents setting is loaded during startup.
+        // max recents setting is loaded and scrubbed during startup.
         // cache it in a local variable for ease of access.
         egCore.org.settings('ui.staff.max_recent_patrons').then(function(s) {
-            patronSvc.maxRecentPatrons = s['ui.staff.max_recent_patrons'] || 0;
+            patronSvc.maxRecentPatrons = s['ui.staff.max_recent_patrons'];
         });
 
         if (patron_id) {
index fa022b8..1d90691 100644 (file)
@@ -120,8 +120,8 @@ angular.module('egCoreMod')
                             egCore.org.settings('ui.staff.max_recent_patrons')
                             .then(function(s) {
                                 var val = s['ui.staff.max_recent_patrons'];
-                                $scope.showRecentPatron = (val && val > 0);
-                                $scope.showRecentPatrons = (val && val > 1);
+                                $scope.showRecentPatron = val > 0;
+                                $scope.showRecentPatrons = val > 1;
                             });
                         }
                     }
index 891962b..e5db76d 100644 (file)
@@ -40,6 +40,10 @@ function($q,  $rootScope,  $location,  $window,  egIDL,  egAuth,  egEnv , egOrg
                         set['webstaff.format.dates'] || 'shortDate';
                     $rootScope.egDateAndTimeFormat = 
                         set['webstaff.format.date_and_time'] || 'short';
+
+                    // default to 1 for backwards compat.
+                    if (set['ui.staff.max_recent_patrons'] === null)
+                        set['ui.staff.max_recent_patrons'] = 1
                 }
             );
         }