Summary: | Holidays description shows \r\n for every new line | ||
---|---|---|---|
Product: | Koha | Reporter: | Joonas Kylmälä <joonas.kylmala> |
Component: | Holidays | Assignee: | Joonas Kylmälä <joonas.kylmala> |
Status: | CLOSED FIXED | QA Contact: | Testopia <testopia> |
Severity: | minor | ||
Priority: | P5 - low | CC: | chris, jonathan.druart, m.de.rooy, tomascohen |
Version: | Main | ||
Hardware: | All | ||
OS: | All | ||
GIT URL: | Change sponsored?: | --- | |
Patch complexity: | Trivial patch | Documentation contact: | |
Documentation submission: | Text to go in the release notes: | ||
Version(s) released in: | Circulation function: | ||
Attachments: |
Bug 14703: Holidays description shows \r\n for every new line
Bug 14703: Holidays description shows \r\n for every new line |
Description
Joonas Kylmälä
2015-08-21 09:47:33 UTC
Created attachment 41885 [details] [review] Bug 14703: Holidays description shows \r\n for every new line Adds a new line for the holiday's description instead of the string \r\n. Test plan: 1. In tools -> Calendar look at some holiday's description (Do a new holiday with description of multiple lines if there is not already) 2. Notice that there is characters \r\n if someone has put a newline in the holiday's description 3. Apply patch 4. See that the new lines show there now nicely Sponsored-by: Vaara-kirjastot Created attachment 42025 [details] [review] Bug 14703: Holidays description shows \r\n for every new line Adds a new line for the holiday's description instead of the string \r\n. Test plan: 1. In tools -> Calendar look at some holiday's description (Do a new holiday with description of multiple lines if there is not already) 2. Notice that there is characters \r\n if someone has put a newline in the holiday's description 3. Apply patch 4. See that the new lines show there now nicely Sponsored-by: Vaara-kirjastot Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Amended slightly: no need to replace title. Taking the liberty to promote this trivial patch to PQA directly. Thanks, Joonas. IMO this should be done after the input (and correct the values in DB), not on display. (In reply to Jonathan Druart from comment #4) > IMO this should be done after the input (and correct the values in DB), not > on display. I tried that in a way that I left the new line character there, but then there was some JavaScript which refused to work with that. And if we put the <br> tag in the database I'm not sure if it will show in the description as the string <br> or as a new line. Let me try that. (In reply to Joonas Kylmälä from comment #5) > (In reply to Jonathan Druart from comment #4) > > IMO this should be done after the input (and correct the values in DB), not > > on display. > > I tried that in a way that I left the new line character there, but then > there was some JavaScript which refused to work with that. And if we put the > <br> tag in the database I'm not sure if it will show in the description as > the string <br> or as a new line. Let me try that. But wait, I think I tried that and the <br> will show in the edit text box as <br>.. So I came to the conclusion that it's much more better to have the fix in only one place. Forget the idea if it's not easy to do :) Hobby holiday project: See newHolidays.pl if ($description) { $description =~ s/\r/\\r/g; $description =~ s/\n/\\n/g; } Joonas: If you want to change the patch, go ahead and change the status. But I do not mind pushing this tiny adjustment. (In reply to Marcel de Rooy from comment #8) > Hobby holiday project: > > See newHolidays.pl > > if ($description) { > $description =~ s/\r/\\r/g; > $description =~ s/\n/\\n/g; > } I looked into that. Changing the new line into <br> didn't work in the because then we need to also change the description editor to convert <br> to \r\n. So it's similar fix to that what we do now when displaying the description (but more changes with no reason). And so we have done already the fix to change the description so I will go with the current patch. Patch pushed to master. Thanks Joonas! Pushed to 3.20.x will be in 3.20.4 |