From: Cesar Velez Date: Fri, 15 Dec 2017 15:39:29 +0000 (-0500) Subject: Lp#1712854 - fix issue with pickup lib change X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=8c0718f916d76989c858a062e419640fa30d1747;p=working%2FEvergreen.git Lp#1712854 - fix issue with pickup lib change Since we are now pre-loading/caching all holds in order to enable clientsort, we need to purge that cache when ou is changed. Signed-off by: Cesar Velez --- diff --git a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js index 8c94f5b90b..20bd078515 100644 --- a/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js +++ b/Open-ILS/web/js/ui/default/staff/cat/catalog/app.js @@ -20,7 +20,7 @@ angular.module('egCatalogApp', ['ui.bootstrap','ngRoute','ngLocationUpdate','egC .config(function($routeProvider, $locationProvider, $compileProvider) { $locationProvider.html5Mode(true); $compileProvider.aHrefSanitizationWhitelist(/^\s*(https?|mailto|blob):/); // grid export - + var resolver = {delay : ['egCore','egStartup','egUser', function(egCore, egStartup, egUser) { egCore.env.classLoaders.aous = function() { return egCore.org.settings([ @@ -1647,7 +1647,7 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e function fetchHolds() { return egHolds.fetch_holds(hold_ids).then(null, null, function(hold_data) { - holds.push(hold_data); + holds.push(hold_data); return hold_data; } ); @@ -1657,10 +1657,10 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e if ($scope.record_tab != 'holds') return $q.when(); var deferred = $q.defer(); - // see if we can use cached results - if (holds[offset]){ - return provider.arrayNotifier(holds, offset, count); - } + // see if we can use cached results + if (holds[offset]){ + return provider.arrayNotifier(holds, offset, count); + } // open a determinate progress dialog, max value set below. egProgressDialog.open({max : 1, value : 0}); @@ -1714,8 +1714,11 @@ function($scope , $routeParams , $location , $window , $q , egCore , egHolds , e // refresh the list of record holds when the pickup lib is changed. $scope.pickup_ou = egCore.org.get(egCore.auth.user().ws_ou()); $scope.pickup_ou_changed = function(org) { + if($scope.pickup_ou.id() != org.id()){ $scope.pickup_ou = org; - provider.refresh(); + holds = []; // cached hold data is stale due to ou change, clear it + } + provider.refresh(false); } $scope.print_holds = function() {