LP#1642378 Webstaff Negative Balance org select repairs
authorBill Erickson <berickxx@gmail.com>
Mon, 27 Feb 2017 21:53:52 +0000 (16:53 -0500)
committerBill Erickson <berickxx@gmail.com>
Mon, 6 Mar 2017 21:15:03 +0000 (16:15 -0500)
1. Disable org units in the org unit selector that cannot have users.

Additional code cleanup:

2. The org selector calls egStartup internally, so if the page
controller has no need to wait on the startup to complete, then it does
not need to manually invoke the startup.

3. No longer necessary to manually track the selected org unit from the
org selector directive.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Terran McCanna <tmccanna@georgialibraries.org>
Open-ILS/src/templates/staff/admin/local/circ/neg_balance_users.tt2
Open-ILS/web/js/ui/default/staff/admin/local/circ/neg_balance_users.js

index 73d7ec8..9501f6a 100644 (file)
@@ -23,6 +23,7 @@
     <div class="form-group">
       <label>[% l('Patron Library') %]</label>
       <eg-org-selector onchange="org_changed" 
+        disable-test="disable_org"
         selected="context_org"></eg-org-selector>
     </div>
   </div>
index 4169c9b..1697aa7 100644 (file)
@@ -6,8 +6,6 @@ angular.module('egAdminCirc',
        ['$scope','$q','$timeout','$location','$window','egCore','egGridDataProvider',
 function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvider) {
 
-    egCore.startup.go(); // standalone mode requires manual startup
-
     $scope.grid_provider = egGridDataProvider.instance({});
 
     // API does not currenlty support paging, so it's all or none.
@@ -30,10 +28,14 @@ function($scope , $q , $timeout , $location , $window , egCore , egGridDataProvi
     }
 
     $scope.org_changed = function(org) {
-        $scope.context_org = org; // hmm, why necessary.
         $scope.grid_provider.refresh();
     }
 
+    $scope.disable_org = function(org_id) {
+        if (!org_id) return true;
+        return egCore.org.get(org_id).ou_type().can_have_users() != 't';
+    }
+
     // NOTE: Chrome only allows one tab/window to open per user
     // action.  Only the first patron will be displayed.
     $scope.get_user = function(selected) {