From: Jason Etheridge Date: Fri, 2 Jun 2017 16:59:24 +0000 (-0400) Subject: lp1616980 webstaff: protect "magic statuses" X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=56a223a8a9b8a43ed0d00ca219b86b5f155e0d6c;p=working%2FEvergreen.git lp1616980 webstaff: protect "magic statuses" in item editor ...fix race condition for magic statuses Signed-off-by: Jason Etheridge --- diff --git a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 index e96d543b94..0d61a68aa9 100644 --- a/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 +++ b/Open-ILS/src/templates/staff/cat/volcopy/t_attr_edit.tt2 @@ -116,7 +116,7 @@
diff --git a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js index 23bd2e82f2..def7cdcb2a 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/volcopy/app.js @@ -151,6 +151,18 @@ function(egCore , $q) { }; + service.get_magic_statuses = function() { + /* TODO: make these more configurable per lp1616170 */ + return $q.when([ + 1 /* Checked out */ + ,3 /* Lost */ + ,6 /* In transit */ + ,8 /* On holds shelf */ + ,16 /* Long overdue */ + ,18 /* Canceled Transit */ + ]); + } + service.get_statuses = function() { if (egCore.env.ccs) return $q.when(egCore.env.ccs.list); @@ -925,7 +937,7 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , return true; } - createSimpleUpdateWatcher = function (field) { + createSimpleUpdateWatcher = function (field,exclude_copies_with_one_of_these_values) { return $scope.$watch('working.' + field, function () { var newval = $scope.working[field]; @@ -944,6 +956,10 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , angular.forEach( $scope.workingGridControls.selectedItems(), function (cp) { + if (exclude_copies_with_one_of_these_values + && exclude_copies_with_one_of_these_values.indexOf(cp[field](),0) > -1) { + return; + } if (cp[field]() !== newval) { cp[field](newval); cp.ischanged(1); @@ -1478,10 +1494,13 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , createSimpleUpdateWatcher('location'); $scope.status_list = []; + itemSvc.get_magic_statuses().then(function(list){ + $scope.magic_status_list = list; + createSimpleUpdateWatcher('status',$scope.magic_status_list); + }); itemSvc.get_statuses().then(function(list){ $scope.status_list = list; }); - createSimpleUpdateWatcher('status'); $scope.circ_modifier_list = []; itemSvc.get_circ_mods().then(function(list){ @@ -1909,6 +1928,9 @@ function($scope , $q , $window , $routeParams , $location , $timeout , egCore , }); $scope.status_list = []; + itemSvc.get_magic_statuses().then(function(list){ + $scope.magic_status_list = list; + }); itemSvc.get_statuses().then(function(list){ $scope.status_list = list; });