From: Galen Charlton Date: Fri, 18 Dec 2015 18:47:54 +0000 (-0500) Subject: improve init of next status X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=367b8f0fdd7d57eb349a6d4b38ca90dcf72d7415;p=working%2FEvergreen.git improve init of next status Signed-off-by: Galen Charlton --- diff --git a/Open-ILS/web/js/ui/default/staff/services/ui.js b/Open-ILS/web/js/ui/default/staff/services/ui.js index 99842c3eb6..49b4c5d3e5 100644 --- a/Open-ILS/web/js/ui/default/staff/services/ui.js +++ b/Open-ILS/web/js/ui/default/staff/services/ui.js @@ -508,10 +508,26 @@ function($modal , $interpolate , egCore) { return defer.promise; } + // returns a promise resolved with the list of circ mods + $scope.get_copy_statuses = function() { + if (egCore.env.ccm) + return $q.when(egCore.env.ccs.list); + + return egCore.pcrud.retrieveAll('ccs', null, {atomic : true}) + .then(function(list) { + egCore.env.absorbList(list, 'ccs'); + return list; + }); + }; + $scope.mode = args.mode || 'checkin'; var next_statuses = []; var seen_statuses = {}; + $scope.next_statuses = []; + $scope.params = { + 'the_next_status' : null + } init(args).then(function(copy_alerts) { $scope.alerts = copy_alerts; angular.forEach($scope.alerts, function(copy_alert) { @@ -530,32 +546,15 @@ function($modal , $interpolate , egCore) { }); } }); - }); - - // returns a promise resolved with the list of circ mods - $scope.get_copy_statuses = function() { - if (egCore.env.ccm) - return $q.when(egCore.env.ccs.list); - - return egCore.pcrud.retrieveAll('ccs', null, {atomic : true}) - .then(function(list) { - egCore.env.absorbList(list, 'ccs'); - return list; - }); - }; - - $scope.next_statuses = []; - $scope.params = { - 'the_next_status' : null - } - if ($scope.mode == 'checkin' && next_statuses.length > 0) { - $scope.get_copy_statuses().then(function() { - angular.forEach(next_statuses, function(st) { - $scope.next_statuses.push(egCore.env.ccs.list[st]); + if ($scope.mode == 'checkin' && next_statuses.length > 0) { + $scope.get_copy_statuses().then(function() { + angular.forEach(next_statuses, function(st) { + $scope.next_statuses.push(egCore.env.ccs.list[st]); + }); + $scope.params.the_next_status = $scope.next_statuses[0].id(); }); - $scope.params.the_next_status = $scope.next_statuses[0].id(); - }); - } + } + }); $scope.isAcknowledged = function(copy_alert) { return (copy_alert.acked);