@@ -, +, @@ - 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. --- C4/SIP/ILS/Patron.pm | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) --- a/C4/SIP/ILS/Patron.pm +++ a/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}); --