From: Mike Rylander Date: Mon, 11 Dec 2017 21:21:39 +0000 (-0500) Subject: LP#1736763: Wait until the org tree is there before using it X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=9f71b6a134458a8908680322e8b3149f5afd4d9c;p=working%2FEvergreen.git 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 Signed-off-by: Cesar Velez --- diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js index 8c75f149d5..25046b8c04 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(); } ])