From b5cfb15d517997fed48dc4d2d91e730299742b79 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Mon, 6 Nov 2023 12:50:05 +0000 Subject: [PATCH] Bug 30287: Conditionally render notice preview This patch adds conditional formatting based on whether the notice was generated from an HTML template or a plaintext one. I replace the html_line_break for plaintext formatted notices too as I believe this closer resembles how we actually output such generated notices. --- .../intranet-tmpl/prog/en/modules/members/notices.tt | 9 +++++++-- members/notices.pl | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt index 26260468033..45bb3a96f9c 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/notices.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Asset %] +[% USE String %] [% USE Koha %] [% USE AuthorisedValues %] [% USE Branches %] @@ -64,8 +65,12 @@ [% FOREACH QUEUED_MESSAGE IN QUEUED_MESSAGES %] - [% QUEUED_MESSAGE.subject | html %] - + [% QUEUED_MESSAGE.subject | html %] ([% QUEUED_MESSAGE.content_type %]) + [% IF QUEUED_MESSAGE.content_type.search('html') %] + + [% ELSE %] + + [% END %] [% IF ( QUEUED_MESSAGE.message_transport_type == 'email' ) %]email diff --git a/members/notices.pl b/members/notices.pl index 11f3faa917a..019b1430fff 100755 --- a/members/notices.pl +++ b/members/notices.pl @@ -110,7 +110,7 @@ if ( $op eq 'send_password_reset' ) { } # Getting the messages -my $queued_messages = C4::Letters::GetQueuedMessages({borrowernumber => $borrowernumber}); +my $queued_messages = Koha::Notice::Messages->search({borrowernumber => $borrowernumber}); $template->param( patron => $patron, -- 2.41.0