diff --git a/Koha/Patron/Messages.pm b/Koha/Patron/Messages.pm index 7cc729ac86..063c70364b 100644 --- a/Koha/Patron/Messages.pm +++ b/Koha/Patron/Messages.pm @@ -34,6 +34,25 @@ Koha::Patron::Messages - Koha Message Object set class =cut +=head3 filter_by_unread + + Returns a resultset of messages that have not been marked read by the patron + +=cut + +sub filter_by_unread { + my ( $self, $params ) = @_; + + $params ||= {}; + + return $self->search( + { + patron_read_date => { is => undef }, + %$params, + } + ); +} + =head3 _type =cut @@ -42,6 +61,10 @@ sub _type { return 'Message'; } +=head3 object_class + +=cut + sub object_class { return 'Koha::Patron::Message'; } diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc index 19ba6cee80..cefe1d10a9 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/patron_messages.inc @@ -308,6 +308,9 @@ ( [% patron_message.get_column('manager_firstname') | html %] [% patron_message.get_column('manager_surname') | html %] ) [% END %] "[% patron_message.message | html %]" + [% IF patron_message.patron_read_date %] + Read: [% patron_message.patron_read_date | $KohaDates %] + [% END %] [% IF patron_message.branchcode == Branches.GetLoggedInBranchcode OR Koha.Preference('AllowAllMessageDeletion') %] [% IF moremember %] diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc index 22e6a068ce..6ed5e724f2 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc +++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-note.inc @@ -1,12 +1,17 @@ -[% IF patron_messages.count OR opacnote %] +[% IF patron_messages.filter_by_unread.count OR opacnote %]

Messages for you