From de51eee1d698bf762ad997d0030e3076ab3d9910 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Mon, 11 Dec 2017 16:21:39 -0500 Subject: [PATCH] LP#1736763: Wait until the org tree is there before using it In offline mode, we need to wait for the org tree to be fetched or recreated before we set the working location dropdown. This commit adds a function to loop and wait for that to happen. Signed-off-by: Mike Rylander --- Open-ILS/web/js/ui/default/staff/offline.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js index d3b55be40b..a75da42ccc 100644 --- a/Open-ILS/web/js/ui/default/staff/offline.js +++ b/Open-ILS/web/js/ui/default/staff/offline.js @@ -359,7 +359,9 @@ function($routeProvider , $locationProvider , $compileProvider) { if (match) { // requested WS registered on this client + $scope.workstation_obj = match; $scope.workstation = match.id; + $scope.workstation_owner = match.owning_lib; } else { // the requested WS is not registered on this client $scope.wsNotRegistered = true; @@ -721,6 +723,17 @@ function($routeProvider , $locationProvider , $compileProvider) { return check_digit; } + function fetch_org_after_tree_exists () { + $timeout(function(){ + try { + $scope.org = egCore.org.get($scope.current_workstation_owning_lib()); + } catch(e) { + fetch_org_after_tree_exists(); + } + },100); + } + + fetch_org_after_tree_exists(); } ]) -- 2.11.0