From c0c1879cb0cea95905c88eed0924bb8237ea9c82 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. --- 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 6969c115ed..aa13980e00 100644 --- a/C4/SIP/ILS/Patron.pm +++ b/C4/SIP/ILS/Patron.pm @@ -27,6 +27,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 @@ -137,6 +139,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.11.0