From 0331e15f55c8c07a2188df66134402b746a28bb1 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Thu, 30 Oct 2014 11:06:14 -0400 Subject: [PATCH] LP#1402797 Add invalid-address alert Signed-off-by: Mike Rylander Signed-off-by: Kathy Lussier --- .../src/templates/staff/circ/patron/t_alerts.tt2 | 4 ++++ .../web/js/ui/default/staff/circ/patron/app.js | 23 ++++++++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/Open-ILS/src/templates/staff/circ/patron/t_alerts.tt2 b/Open-ILS/src/templates/staff/circ/patron/t_alerts.tt2 index 822240c2d6..9281362617 100644 --- a/Open-ILS/src/templates/staff/circ/patron/t_alerts.tt2 +++ b/Open-ILS/src/templates/staff/circ/patron/t_alerts.tt2 @@ -27,6 +27,10 @@ [% l('Patron account retrieved with an INACTIVE card.') %] +
+ [% l('Patron account has invalid addresses.') %] +
+
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 c607e292b7..bd7cb8a18e 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 @@ -239,6 +239,7 @@ function($q , $timeout , $location , egCore, egUser , $locale) { service.patronExpired = false; service.patronExpiresSoon = false; service.retrievedWithInactive = false; + service.invalidAddresses = false; } service.resetPatronLists(); // initialize @@ -383,6 +384,22 @@ function($q , $timeout , $location , egCore, egUser , $locale) { return $q.when(false); } + // resolves to true if the patron account has any invalid addresses. + service.testInvalidAddrs = function() { + + if (service.invalidAddresses) + return $q.when(true); + + var fail = false; + + angular.forEach( + service.current.addresses(), + function(addr) { if (!addr.valid()) fail = true } + ); + + return $q.when(fail); + } + // resolves to true if there is any aspect of the patron account // which should produce a message in the alerts panel service.checkAlerts = function() { @@ -420,6 +437,11 @@ function($q , $timeout , $location , egCore, egUser , $locale) { deferred.resolve(service.hasAlerts); }); + service.testInvalidAddrs().then(function(bool) { + if (bool) service.invalidAddresses = true; + deferred.resolve(service.invalidAddresses); + }); + return deferred.promise; } @@ -1184,6 +1206,7 @@ function($scope, $routeParams , $location , egCore , patronSvc) { $scope.patronExpired = patronSvc.patronExpired; $scope.patronExpiresSoon = patronSvc.patronExpiresSoon; $scope.retrievedWithInactive = patronSvc.retrievedWithInactive; + $scope.invalidAddresses = patronSvc.invalidAddresses; }); }]) -- 2.11.0