From: Mike Rylander Date: Mon, 12 Jun 2017 17:05:45 +0000 (-0400) Subject: offline: force-save outstanding transactions on patron registration to avoid losing... X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=23dc8836f77f2797b602e77054aa231ab85db618;p=working%2FEvergreen.git offline: force-save outstanding transactions on patron registration to avoid losing data Signed-off-by: Mike Rylander --- diff --git a/Open-ILS/web/js/ui/default/staff/offline.js b/Open-ILS/web/js/ui/default/staff/offline.js index 58ea2a1dc4..c924d64047 100644 --- a/Open-ILS/web/js/ui/default/staff/offline.js +++ b/Open-ILS/web/js/ui/default/staff/offline.js @@ -38,8 +38,8 @@ function($routeProvider , $locationProvider , $compileProvider) { }]) .controller('OfflineSessionCtrl', - ['$scope','$location','$window','egCore','$routeParams','$http','$q','$timeout','egPromptDialog','ngToast','egProgressDialog', - function($scope , $location , $window , egCore , $routeParams , $http , $q , $timeout , egPromptDialog , ngToast , egProgressDialog) { + ['$scope','$window','egCore','$routeParams','$http','$q','$timeout','egPromptDialog','ngToast','egProgressDialog', + function($scope , $window , egCore , $routeParams , $http , $q , $timeout , egPromptDialog , ngToast , egProgressDialog) { $scope.active_session_tab = 'pending'; $scope.lookupNoncatTypeName = function (type) { @@ -250,8 +250,8 @@ function($routeProvider , $locationProvider , $compileProvider) { ]) .controller('OfflineCtrl', - ['$q','$scope','$location','$window','egCore','egLovefield','$routeParams','$timeout','$http','ngToast','egConfirmDialog', - function($q , $scope , $location , $window , egCore , egLovefield , $routeParams , $timeout , $http , ngToast , egConfirmDialog) { + ['$q','$scope','$location','$rootScope','egCore','egLovefield','$routeParams','$timeout','$http','ngToast','egConfirmDialog', + function($q , $scope , $location , $rootScope , egCore , egLovefield , $routeParams , $timeout , $http , ngToast , egConfirmDialog) { $scope.active_tab = $routeParams.tab || 'checkout'; $scope.minDate = new Date(); @@ -429,6 +429,8 @@ function($routeProvider , $locationProvider , $compileProvider) { }); } + $rootScope.save_offline_xacts = function () { return $scope.save() }; + $scope.clear_pending = function (skip_confirm) { if (skip_confirm) { return egLovefield.destroyPendingOfflineXacts().then(function () { @@ -1363,11 +1365,12 @@ function($routeProvider , $locationProvider , $compileProvider) { .controller('PatronRegCtrl', ['$scope','$routeParams','$q','$uibModal','$window','egCore', 'patronSvc','patronRegSvc','egUnloadPrompt','egAlertDialog', - 'egWorkLog','$timeout','egLovefield', + 'egWorkLog','$timeout','egLovefield','$rootScope', function($scope , $routeParams , $q , $uibModal , $window , egCore , patronSvc , patronRegSvc , egUnloadPrompt, egAlertDialog , - egWorkLog , $timeout , egLovefield) { + egWorkLog , $timeout , egLovefield , $rootScope) { + $scope.rs = $rootScope; patronRegSvc.org = $scope.workstation_obj.owning_lib; $scope.offline = true; @@ -2021,6 +2024,7 @@ function($scope , $routeParams , $q , $uibModal , $window , egCore , var updated_user; patronRegSvc.save_user($scope.patron) + .then($scope.rs.save_offline_xacts) .then(function(new_user) { // reload the current page $window.location.href = location.href;