From 7532417b880cc8fe40c25eba7394b10a207c4c2e Mon Sep 17 00:00:00 2001 From: Lucas Gass Date: Sun, 2 Aug 2020 22:29:20 +0000 Subject: [PATCH] Bug 26123: Add notice about new messages to the patron dashboard This patch adds a notice to the patron OPAC when a logged on user of the OPAC has 1 or more OPAC messages. Test plan: 1. Apply patch, restart_all. 2. Add some OPAC messages for a patron and login as that patron. 3. On the OPAC main page you should see a notice about your OPAC messages, incdicating how many you have. 4. Add multiple OPAC messages and make sure it all continues to work. 5. Test it with some other notices that would appear on the dashboard, checkouts, holds, overdues. --- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt | 3 +++ opac/opac-main.pl | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt index af3e8e4af7..6ba45438da 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-main.tt @@ -215,6 +215,9 @@ [% IF total_owing && total_owing > 0 %]
  • [% total_owing | $Price with_symbol => 1 %] due in fines and charges
  • [% END %] + [% IF patron_messages && patron_messages.count > 0 %] +
  • [% patron_messages.count %] message(s)
  • + [% END %] [% END %] diff --git a/opac/opac-main.pl b/opac/opac-main.pl index 78b8d74fe7..24b58a49ad 100755 --- a/opac/opac-main.pl +++ b/opac/opac-main.pl @@ -30,6 +30,7 @@ use C4::Overdues; use Koha::Checkouts; use Koha::Holds; use Koha::News; +use Koha::Patron::Messages; my $input = new CGI; my $dbh = C4::Context->dbh; @@ -83,10 +84,11 @@ if ( $patron ) { my ( $overdues_count, $overdues ) = checkoverdues($borrowernumber); my $holds_pending = Koha::Holds->search({ borrowernumber => $borrowernumber, found => undef })->count; my $holds_waiting = Koha::Holds->search({ borrowernumber => $borrowernumber })->waiting->count; + my $patron_messages = Koha::Patron::Messages->search({borrowernumber => $borrowernumber}); my $total = $patron->account->balance; - if ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 ) { + if ( $checkouts > 0 || $overdues_count > 0 || $holds_pending > 0 || $holds_waiting > 0 || $total > 0 || $patron_messages > 0 ) { $template->param( dashboard_info => 1, checkouts => $checkouts, @@ -94,6 +96,7 @@ if ( $patron ) { holds_pending => $holds_pending, holds_waiting => $holds_waiting, total_owing => $total, + patron_messages => $patron_messages, ); } } -- 2.11.0