From 6cd8861d10273ee19f73f6e65d635764f30fc564 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Wed, 28 Dec 2016 16:15:24 -0500 Subject: [PATCH] LP#1635407 webstaff: show patron alert pane once Display the patron alerts pane only once per patron instance per browser tab. This is done by setting a new session storage value which tracks the last alerted patron. This value is replaced each time a new patron is loaded into the main patron app (e.g. double-clicking the patron row in patron search) and is maintained separately per browser tab. Signed-off-by: Bill Erickson Signed-off-by: Kathy Lussier --- .../web/js/ui/default/staff/circ/patron/app.js | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 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 fcf195f76f..630ca9ccb4 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 @@ -248,13 +248,23 @@ function($q , $timeout , $location , egCore, egUser , $locale) { service.patron_stats = null; service.noncat_ids = []; service.hasAlerts = false; - service.alertsShown = false; service.patronExpired = false; service.patronExpiresSoon = false; service.invalidAddresses = false; } service.resetPatronLists(); // initialize + // Returns true if the last alerted patron matches the current + // patron. Otherwise, the last alerted patron is set to the + // current patron and false is returned. + service.alertsShown = function() { + var key = 'eg.circ.last_alerted_patron'; + var last_id = egCore.hatch.getSessionItem(key); + if (last_id && last_id == service.current.id()) return true; + egCore.hatch.setSessionItem(key, service.current.id()); + return false; + } + // shortcut to force-reload the current primary service.refreshPrimary = function() { if (!service.current) return $q.when(); @@ -584,8 +594,7 @@ function($scope, $q, $location , $filter, egCore, egUser, patronSvc) { $scope.alert_penalties = function() {return patronSvc.alert_penalties} - if (patronSvc.alertsShown) return false; - patronSvc.alertsShown = true; + if (patronSvc.alertsShown()) return false; // if the patron has any unshown alerts, show them now if (patronSvc.hasAlerts && -- 2.43.2