From 031888f35cd6c49f9a38c74a2c277a33d425eb93 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Wed, 11 Sep 2019 11:39:31 +0200 Subject: [PATCH] Bug 25816: Add opac messages in SIP display. Test plan: - Add one or more opac messages to a patron (patron detail -> add message -> Add a message for: OPAC) - Check that the messages will be displayed, with correctly formatted dates. You can use src/C4/SIP/interactive_patron_dump.pl for easier testing. Signed-off-by: Martin Renvoize --- C4/SIP/ILS/Patron.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/C4/SIP/ILS/Patron.pm b/C4/SIP/ILS/Patron.pm index f0320bc720..15246acd57 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -26,6 +26,8 @@ use C4::Auth qw(checkpw); use Koha::Items; use Koha::Libraries; use Koha::Patrons; +use Koha::Patron::Messages; +use Koha::DateUtils; our $kp; # koha patron @@ -154,6 +156,22 @@ sub new { } } + my @patron_messages = Koha::Patron::Messages->search( + { + borrowernumber => $kp->{borrowernumber}, + message_type => 'B', + } + ); + my @messages_array; + foreach my $message (@patron_messages) { + my $messagedt = dt_from_string( $message->message_date, 'iso' ); + my $formatted_date = output_pref({ dt => $messagedt, dateonly => 1}); + push @messages_array, $formatted_date . ": " . $message->message; + } + if (@messages_array) { + $ilspatron{screen_msg} .= ". Messages for you: " . join(' / ', @messages_array); + } + # FIXME: populate fine_items recall_items $ilspatron{unavail_holds} = _get_outstanding_holds($kp->{borrowernumber}); -- 2.20.1