From e4898785b3b9ad07459e9bb2face0c4b63dc6714 Mon Sep 17 00:00:00 2001 From: Martin Renvoize Date: Wed, 8 Nov 2023 09:59:30 +0000 Subject: [PATCH] Bug 35285: Add non-html template support to html_content wrapping This patch adds support for messages generated using non-html formatted notice templates to the html_content method of Koha::Notice::Message. We continue to wrap content for html generated messages with the appropriate headers, css and title. For non-html generated content we wrap in the
block to maintain text formatting as defined in the original plaintext template. --- Koha/Notice/Message.pm | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/Koha/Notice/Message.pm b/Koha/Notice/Message.pm index a44107a59c2..03943fb8e8b 100644 --- a/Koha/Notice/Message.pm +++ b/Koha/Notice/Message.pm @@ -31,6 +31,14 @@ Koha::Notice::Message - Koha notice message Object class, related to the message =cut +=head3 is_html + + my $bool = $message->is_html; + +Returns a boolean denoting whether the message was generated using a preformatted html template. + +=cut + =head3 html_content my $wrapped_content = $message->html_content; @@ -45,10 +53,14 @@ sub html_content { my $title = $self->subject; my $content = $self->content; - my $css = C4::Context->preference("NoticeCSS") || ''; - $css = qq{} if $css; - return <is_html ) { + + my $css = C4::Context->preference("NoticeCSS") || ''; + $css = qq{} if $css; + + $wrapped = < @@ -62,7 +74,12 @@ sub html_content { EOS - + } else { + $wrapped = "
\n"; + $wrapped .= $content . "\n"; + $wrapped .= "
"; + } + return $wrappe; } =head3 type -- 2.41.0