Bugzilla – Attachment 155599 Details for
Bug 34728
HTML notices should not be pre-formatted
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34728: Make pre tag conditional
Bug-34728-Make-pre-tag-conditional.patch (text/plain), 3.42 KB, created by
Lucas Gass (lukeg)
on 2023-09-13 22:52:58 UTC
(
hide
)
Description:
Bug 34728: Make pre tag conditional
Filename:
MIME Type:
Creator:
Lucas Gass (lukeg)
Created:
2023-09-13 22:52:58 UTC
Size:
3.42 KB
patch
obsolete
>From 9f8c799b18f18e6cf029cb64d7b2d2e97ff8f4f4 Mon Sep 17 00:00:00 2001 >From: Matt Blenkinsop <matt.blenkinsop@ptfs-europe.com> >Date: Wed, 6 Sep 2023 10:50:30 +0000 >Subject: [PATCH] Bug 34728: Make pre tag conditional > >This patch makes the pre-formatting of notice templates conditional on the content type. > >Test plan: >1) Navigate to tools > Notices and slips >2) Edit the notice with the code of HOLD >3) Under print, paste the following ><p>Please collect within 10 days from the date of this letter and don't forget to bring your library card with you.</p> ><p>Be aware that opening hours vary at different library branches so if in doubt double check the times before you visit.</p> ><p>Should you no longer require this item please contact us so we can make it available for another customer.</p> > ><p>Thank you</p> >4) Check the box that says HTML message and save the notice >5) In Patrons, select a patron and in Patron messaging preferences, check the box in the Email column for Hold filled >6) Find a record in the catalogue >7) Copy the barcode for one of the items >8) Place a hold on the item for the patron you selected >9) Navigate to Circulation > Check-in >10) Paste the barcode in the Check-in box and click Check-in >11) In the pop-up box, click Confirm hold >12) In the command line, run perl misc/cronjobs/gather_print_notices.pl --letter_code=HOLD --html /tmp >13) cd /tmp >14) There should be a file in there called 'notices_HOLD-date.html >15) cat this file >16) The html you pasted in the template will be wrapped in a <pre> tag >17) Apply patch and restart_all >18) rm the notices file that was created >19) cd /kohadevbox/koha >20) Select a new record from the catalogue and repeat steps 7-15 for this record, using the same patron >21) This time, the html file should not contain the <pre> tag >22) Sign off! > >Signed-off-by: Lucas Gass <lucas@bywatersolutions.com> >--- > .../intranet-tmpl/prog/en/modules/batch/print-notices.tt | 6 +++++- > misc/cronjobs/gather_print_notices.pl | 6 ++++++ > 2 files changed, 11 insertions(+), 1 deletion(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt >index ae0c0aabcc..7511eb5469 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/batch/print-notices.tt >@@ -20,7 +20,11 @@ > <body id="batch_print-notices" class="batch"> > [% FOREACH message IN messages %] > <div class="dialog message"> >- <pre>[% message.content | $raw %]</pre> >+ [% IF ( message.is_html ) %] >+ [% message.content | $raw %] >+ [% ELSE %] >+ <pre>[% message.content | $raw %]</pre> >+ [% END %] > </div> > [% END %] > </body> >diff --git a/misc/cronjobs/gather_print_notices.pl b/misc/cronjobs/gather_print_notices.pl >index c1c26ce627..d2bf8fc874 100755 >--- a/misc/cronjobs/gather_print_notices.pl >+++ b/misc/cronjobs/gather_print_notices.pl >@@ -214,6 +214,12 @@ sub generate_html { > C4::Templates::gettemplate( 'batch/print-notices.tt', 'intranet', > CGI->new ); > >+ foreach my $message (@{ $messages }) { >+ my $content_type = $message->{'content_type'} || 'text/plain; charset="UTF-8"'; >+ my $is_html = $content_type =~ m/html/io; >+ $message->{'is_html'} = $is_html; >+ } >+ > $template->param( > stylesheet => C4::Context->preference("NoticeCSS"), > today => $today_syspref, >-- >2.30.2
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34728
:
155263
|
155264
|
155265
|
155599
|
155639
|
155640