Bug 11173 - Carriage returns are missing in email notification when content type is html
Summary: Carriage returns are missing in email notification when content type is html
Status: RESOLVED WONTFIX
Alias: None
Product: Koha
Classification: Unclassified
Component: Notices (show other bugs)
Version: Main
Hardware: All All
: P5 - low normal (vote)
Assignee: Sophie MEYNIEUX
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-10-30 17:41 UTC by Sophie MEYNIEUX
Modified: 2023-07-08 22:03 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 11173 : Notifications by email lacks carriage returns if content type is HTML (1.37 KB, patch)
2013-10-30 17:48 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
Bug 11173 : Notifications by email lacks carriage returns if content type is HTML (1.48 KB, patch)
2013-10-31 11:51 UTC, Marcel de Rooy
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Sophie MEYNIEUX 2013-10-30 17:41:06 UTC
Notifications by email lacks carriage returns if content type is HTML

Test plan :
- Define one letter template for overdues for example
- Check "HTML Message"
- Define some overdue rules that are using this letter
- Find one borrower that has overdues triggering this notification.
- Run misc/cronjobs/overdue_notices.pl to generate the message and change to_address to give your email

Without patch :
- run misc/cronjobs/process_messsage_queue.pl => email content is all on one line

With the patch :
- change message status to 'pending' so that it could be sent once again
- run misc/cronjobs/process_message_queue.pl => email content is displaid correctly with carriage returns as defined in template
Comment 1 Sophie MEYNIEUX 2013-10-30 17:48:13 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2013-10-30 23:00:00 UTC
Hm, not sure, but would we not be using <br/> and HTML block elements to create line breaks in HTML overdues? If I am using HTML I might make line breaks for better and easier readable display and wouldn't want those interpreted as new lines.
Comment 3 Katrin Fischer 2013-10-30 23:13:47 UTC
Hm that last sentence didn't make sense: make line breaks for an easier readable template, but don't want them to appear in my notice.
Comment 4 Marcel de Rooy 2013-10-31 11:51:32 UTC
Created attachment 22631 [details] [review]
Bug 11173 : Notifications by email lacks carriage returns if content type is HTML

Test plan :
- Define one letter template for overdues for example
- Check "HTML Message"
- Define some overdue rules that are using this letter
- Find one borrower that has overdues triggering this notification.
- Run misc/cronjobs/overdue_notices.pl to generate the message and change to_address to give your email

Without patch :
- run misc/cronjobs/process_messsage_queue.pl => email content is all on one line

With the patch :
- change message status to 'pending' so that it could be sent once again
- run misc/cronjobs/process_message_queue.pl => email content is displaid correctly with carriage returns as defined in template

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 5 Marcel de Rooy 2013-10-31 11:54:57 UTC
(In reply to Katrin Fischer from comment #2)
> Hm, not sure, but would we not be using <br/> and HTML block elements to
> create line breaks in HTML overdues? If I am using HTML I might make line
> breaks for better and easier readable display and wouldn't want those
> interpreted as new lines.

I guess that you would be formally right. But I think that most users (not limited by extensive html knowledge..) would enjoy to get the line breaks as they do now.

Looking forward to your QA remarks on that, Katrin. :)
Comment 6 Katrin Fischer 2013-10-31 12:59:06 UTC
Well, I disagree. If I work with HTML, I want it to behave like HTML, else I will have to write insanely long lines to avoid accidental line breaks - which doesn't seem right to me. And I lose the ability that HTML gives me - to control the layout more exactly that I can do with plain text.
Comment 7 Sophie MEYNIEUX 2013-11-15 11:32:06 UTC
Katrin, 

Librarian use HTML in template only to add some specific display (add a div to right align address for exemple), but they are not writing full html templates.
And they are very suprised to see their carriage returns vanished in sent messages. 
I'm not sure to ask them to write full HTML is a good point
Comment 8 Katrin Fischer 2013-11-15 11:45:54 UTC
Maybe we can have another checkbox to indicate 'parial HTML'?
I am still not persuaded that mixing up things is the way to go.

There is some information on the wiki about HTML emails, and it looks like writing HTML for emails is a bit different than writing HTML for websites:
http://wiki.koha-community.org/wiki/Customising_Notices_and_Slips

But we also have the slips - those are 'normal HTML.

I am adding Galen to this discussion - I think more opinions on this would be good.
Comment 9 Owen Leonard 2013-11-15 14:33:25 UTC
The HTML option has been available since 3.8, so we must presume that some libraries have crafted HTML-formatted notices to their liking, including adding the necessary explicit <br> tags or whatever. If we add automatic insertion of <br> for line breaks those existing notices then they will suddenly have broken formatting.

To me the obvious solution is to offer a WYSIWYG interface for notices like we have for News: Checking the "HTML" checkbox would trigger the TinyMCE editor on the textarea. If we did that then it would be quite clear where line breaks would fall.

The tricky part, I imagine, would be making the field chooser play nicely with the WYSIWYG editor. That makes this idea non-trivial, I think.

In short: I don't think this patch is a good idea, but I don't have an easy alternative to offer.
Comment 10 Mathieu Saby 2013-11-17 15:56:24 UTC
Why don't we write templates completely in HTML, with <br />?

And if we check to send notices in plain text, Koha could stripe out all HTML tags, and replace BR with new lines.

Mathieu
Comment 11 Katrin Fischer 2013-11-17 17:36:04 UTC
Hi Mathieu, we have a checkbox for HTML - so you can choose, how you want to format.
Comment 12 Sophie MEYNIEUX 2016-08-24 13:49:19 UTC
May I close this bug as it seems everybody uses templates as they are since a while ?
Comment 13 Katrin Fischer 2023-07-08 22:03:04 UTC
(In reply to Sophie MEYNIEUX from comment #12)
> May I close this bug as it seems everybody uses templates as they are since
> a while ?

You can always close what you have opened. :)