From f6555251add7c9ca4c4b66858f34aaa6414142ee Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Tue, 9 Jan 2018 16:51:54 -0500 Subject: [PATCH] LP#1724052: move stat-cat cache initialization to patron search service When the patron search was split out of the patron app per bug 1701001, the startup code that copied the current patron stat-cat list into egCore.env was not moved over as well and remained in the patron app. As a consequence, the patron search-to-hold dialog would fail to display any patrons in the results list that had statistical categories assigned. This patch moves that bit of initialization into the service. To test ------- [1] Ensure that some patron records have statistical categories assigned. [2] In the web staff client, perform a catalog search, place a hold, then use the 'Patron Search' button. Perform a search; note that patrons with statistical categories are not displayed and that errors are present in the browser debug console. [3] Apply the patch and repeat step #2. This time, patrons that have stat cats should be included in the results. [4] Perform a patron search in the main patron search interface; verify that patrons with statistical categories are retrieved. [5] Directly go to the page listing stat cats for a patron (e.g., /eg/staff/circ/patron/$ID/stat_cats). Verify that the name of the OU that owns the stat cat is displayed. Signed-off-by: Galen Charlton Signed-off-by: Cesar Velez Signed-off-by: Bill Erickson --- Open-ILS/web/js/ui/default/staff/circ/patron/app.js | 13 +------------ .../web/js/ui/default/staff/services/patron_search.js | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 15 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js index 3b5e364d3f..a52c8b8a05 100644 --- a/Open-ILS/web/js/ui/default/staff/circ/patron/app.js +++ b/Open-ILS/web/js/ui/default/staff/circ/patron/app.js @@ -61,18 +61,7 @@ angular.module('egPatronApp', ['ngRoute', 'ui.bootstrap', 'egUserBucketMod', ]); } - return egCore.startup.go().then(function() { - - // This call requires orgs to be loaded, because it - // calls egCore.org.ancestors(), so call it after startup - return egCore.pcrud.search('actsc', - {owner : egCore.org.ancestors( - egCore.auth.user().ws_ou(), true)}, - {}, {atomic : true} - ).then(function(cats) { - egCore.env.absorbList(cats, 'actsc'); - }); - }); + return egCore.startup.go(); }]}; $routeProvider.when('/circ/patron/search', { diff --git a/Open-ILS/web/js/ui/default/staff/services/patron_search.js b/Open-ILS/web/js/ui/default/staff/services/patron_search.js index 758681a7b6..07f73bee8d 100644 --- a/Open-ILS/web/js/ui/default/staff/services/patron_search.js +++ b/Open-ILS/web/js/ui/default/staff/services/patron_search.js @@ -48,15 +48,25 @@ function($q , $timeout , $location , egCore, egUser , egConfirmDialog , $locale } service.resetPatronLists(); // initialize - // Max recents setting is loaded and scrubbed during egStartup. - // Copy it to a local variable here for ease of local access - // after startup has run. egCore.startup.go().then( function() { + // Max recents setting is loaded and scrubbed during egStartup. + // Copy it to a local variable here for ease of local access + // after startup has run. egCore.org.settings('ui.staff.max_recent_patrons') .then(function(s) { service.maxRecentPatrons = s['ui.staff.max_recent_patrons']; }); + + // This call requires orgs to be loaded, because it + // calls egCore.org.ancestors(), so call it after startup + egCore.pcrud.search('actsc', + {owner : egCore.org.ancestors( + egCore.auth.user().ws_ou(), true)}, + {}, {atomic : true} + ).then(function(cats) { + egCore.env.absorbList(cats, 'actsc'); + }); } ); -- 2.11.0