Bug 9372 - Automatic carriage return in message_queue where content_type is html
Summary: Automatic carriage return in message_queue where content_type is html
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Patrons (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement (vote)
Target Milestone: ---
Assignee: Sophie MEYNIEUX
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-09 11:31 UTC by stephane.delaune
Modified: 2015-06-04 23:30 UTC (History)
6 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Bot Control: ---
When did the bot last check this:
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
proposed patch (1.30 KB, patch)
2013-01-09 12:16 UTC, stephane.delaune
Details | Diff | Splinter Review
proposed patch for 3.8 (1.33 KB, patch)
2013-01-09 12:16 UTC, stephane.delaune
Details | Diff | Splinter Review
Bug 9372 - Automatic carriage return in message_queue where content_type is html - Followup (1.68 KB, patch)
2013-01-11 19:49 UTC, Kyle M Hall
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9372 : replace \n with <br /> for html messages in message_queue (1.35 KB, patch)
2013-01-11 19:50 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 9372 - Automatic carriage return in message_queue where content_type is html - Followup (1.68 KB, patch)
2013-01-11 19:50 UTC, Kyle M Hall
Details | Diff | Splinter Review
[SIGNED-OFF] Bug 9372 : replace \n with <br /> for html messages in message_queue [3.8.x] (1.38 KB, patch)
2013-01-11 19:54 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 9372 : Replaces carriage return with <br /> in printed html files for overdues. (1.97 KB, patch)
2013-08-02 16:03 UTC, Sophie MEYNIEUX
Details | Diff | Splinter Review
Bug 9372 : Replaces carriage return with <br /> in printed html files for overdues. (2.03 KB, patch)
2013-08-02 16:39 UTC, Kyle M Hall
Details | Diff | Splinter Review
Bug 9372 : Replaces carriage return with <br /> in printed html files for overdues. (2.08 KB, patch)
2013-09-12 08:06 UTC, Chris Cormack
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description stephane.delaune 2013-01-09 11:31:25 UTC
html messages in message_queue have not <br /> instead of \n for html content types
Comment 1 stephane.delaune 2013-01-09 12:16:22 UTC Comment hidden (obsolete)
Comment 2 stephane.delaune 2013-01-09 12:16:51 UTC Comment hidden (obsolete)
Comment 3 Kyle M Hall 2013-01-11 19:31:53 UTC
This patch appears to be stripping all whitespace from messages:

Example before patch:
Dear Henry Acevedo,



<a href="#">test</a>


You have a hold available for pickup as of 2013-01-11. This hold will expire if it is not picked up before 01/18/2013.  If you no longer need this item or have any questions please contact us :

Title: Learning Perl 
Author: Schwartz, Randal L
005.13/3
Location: Centerville


Example after patch:
DearHenryAcevedo,<ahref="#">test</a>Youhaveaholdavailableforpickupasof2013-01-11.Thisholdwillexpireifitisnotpickedupbefore01/18/2013.Ifyounolongerneedthisitemorhaveanyquestionspleasecontactus:Title:LearningPerlAuthor:Schwartz,RandalL005.13/3Location:Centerville
Comment 4 Kyle M Hall 2013-01-11 19:49:20 UTC Comment hidden (obsolete)
Comment 5 Kyle M Hall 2013-01-11 19:50:28 UTC Comment hidden (obsolete)
Comment 6 Kyle M Hall 2013-01-11 19:50:49 UTC Comment hidden (obsolete)
Comment 7 Kyle M Hall 2013-01-11 19:54:05 UTC Comment hidden (obsolete)
Comment 8 Jared Camins-Esakov 2013-01-16 03:21:59 UTC
This patch will need a sign off before it can be QAed.
Comment 9 Owen Leonard 2013-03-19 09:53:27 UTC
Looks like the follow-up still needs to be signed off? But it doesn't have a test plan, so please add one.
Comment 10 Katrin Fischer 2013-03-19 15:54:19 UTC
I was wondering about this patch. If we automatically change evey line break to be a <br/> tag, wouldn't that be confusing when creating html messages?
Normally when you make a line break in HTML code this has no effect on the layout later?
Comment 11 Sophie MEYNIEUX 2013-08-02 16:03:17 UTC Comment hidden (obsolete)
Comment 12 Sophie MEYNIEUX 2013-08-02 16:09:56 UTC
To take Kratin's comment into account, I propose this new patch that changes carriage returns with <br /> only in printed files if paramter file format is html.
Comment 13 Kyle M Hall 2013-08-02 16:39:18 UTC Comment hidden (obsolete)
Comment 14 Chris Cormack 2013-09-12 08:06:31 UTC
Created attachment 21003 [details] [review]
Bug 9372 : Replaces carriage return with <br /> in printed html files for overdues.

For pdf generation, html files need explicit <br /> html tags. With this patch, carriage return are replaced by <br /> when letters are written into html files.

Test plan :
- Ensure you've got at least one reader with overdue triggering notice
- Ensure that your notice template got html checked
- Run misc/cronjobs/overdue_notices.pl -v -n -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of the letter is all on one line in pdf file
With the patch, pdf file is correctly formated

- remove your reader email
- Run misc/cronjobs/overdue_notices.pl -v -html <dirname>
  and misc/cronjobs/printoverdues.sh <dirname>

Without patch, the content of pdf file is all on one line
with the patch, pdf file is correctly formated.

- restore reader email
- run misc/cronjobs/overdue_notice.pl -v -html <dirname>

Verify that the a message has been generated in message_queue table
With or without patch, the message is the same

Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Signed-off-by: Chris Cormack <chris@bigballofwax.co.nz>
Comment 15 Galen Charlton 2013-09-16 18:39:41 UTC
Pushed to master.  Thanks, Sophie!
Comment 16 Tomás Cohen Arazi 2013-11-07 17:57:56 UTC
This patch has been pushed to 3.12.x, will be in 3.12.7.

Thanks Sophie!
Comment 17 Sophie MEYNIEUX 2014-08-12 12:10:47 UTC
As in Bug 11173 it was decided to write full html in letter models, this patch should be reverted, because models in html already contains <br /> tags
Comment 18 Sophie MEYNIEUX 2014-08-12 12:18:23 UTC
Forget my last comment, it is done by Bug 12294