From 09d226a392ef57f7a78d351bc415ac015a8ed08c Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Wed, 18 Feb 2015 22:17:46 +0000 Subject: [PATCH] LP#1410369: update TPAC dashboard counts as needed This factors the lookup of TPAC dashboard/"vital" stats to a separate routine and invokes it a couple more times as needed during patron message processing that can affect the count of unread messages. Signed-off-by: Galen Charlton Signed-off-by: Kathy Lussier --- Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm | 17 +++++++++++++---- .../src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm | 3 +++ 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm index afcd8a9cdf..4147b8f276 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader.pm @@ -298,10 +298,7 @@ sub load_common { $ctx->{is_browser_staff} = 1; } - $ctx->{user_stats} = $U->simplereq( - 'open-ils.actor', - 'open-ils.actor.user.opac.vital_stats', - $e->authtoken, $e->requestor->id); + $self->update_dashboard_stats(); } else { @@ -325,6 +322,18 @@ sub load_common { return Apache2::Const::OK; } +sub update_dashboard_stats { + my $self = shift; + + my $e = $self->editor; + my $ctx = $self->ctx; + + $ctx->{user_stats} = $U->simplereq( + 'open-ils.actor', + 'open-ils.actor.user.opac.vital_stats', + $e->authtoken, $e->requestor->id); +} + sub staff_saved_searches_set_expansion_state { my $self = shift; diff --git a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm index 514bc61055..52675998f0 100644 --- a/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm +++ b/Open-ILS/src/perlmods/lib/OpenILS/WWW/EGCatLoader/Account.pm @@ -283,6 +283,7 @@ sub load_myopac_messages { $ctx->{message_update_action} = $action; $ctx->{message_update_changed} = $changed; $ctx->{message_update_failed} = $failed; + $self->update_dashboard_stats(); } } @@ -355,6 +356,8 @@ sub _fetch_and_mark_read_single_message { } $pcrud->request('open-ils.pcrud.transaction.commit', $self->editor->authtoken)->gather(1); + $self->update_dashboard_stats(); + return $messages; } -- 2.11.0