[Bug 23488] New: Line wrapping doesn't always respect word order in Patron card creator
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Bug ID: 23488 Summary: Line wrapping doesn't always respect word order in Patron card creator Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Label/patron card printing Assignee: cnighswonger@foundations.edu Reporter: maryse.simard@inlibro.com QA Contact: testopia@bugs.koha-community.org In patron card creator, layouts can define up to three lines of text to print to the card. When the text of a line is too long, wrapping will happen. If the wrapped text contains a word that is repeated at least once in the string, the words in the text can be rearranged, the repeated words being grouped together. To reproduce, I use the following text that I put in a card layout : "one two three one two three one two three one two three one two three one two three one two three one two three" I then export some patron cards using this layout. In the resulting file, the words are all out of order : all of the ones appear first, followed by all the twos and only then the threes. The problem is that wrapping happens by finding the last word that can be cut from the string and putting it in a new line. But, when the word is then removed from the original text, only the first occurrence is removed if it appears more than once. The new last word to be removed from the end of the line is the same word again and again until there is none left. We should make sure to remove the word at the end of the line, exactly where we found it to start with. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 --- Comment #1 from Maryse Simard <maryse.simard@inlibro.com> --- Created attachment 92411 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=92411&action=edit Bug 23488: Line wrapping doesn't always respect word order in Patron card creator When wrapping long lines of text, the line is divided by removing each word from the end of the line and putting it in a new one until the line is the right width. When the word to be removed appears multiple time in the line, it is not the last occurrence that is removed. This patch changes the regular expression used to remove the part of the text that is wrapped to a new line, making sure it removes it at the end of the text. Test plan: 1. Go to Tools > Patron card creator 2. Have a card template and a card batch -> If needs be, you can create them by using New > Card template or New > Card batch 3. Create a layout and use one text field containing a long text with at least one word which is repeated a minimum of 2 times (preferably towrdds the end of the text, since it has to be picked as one of the words to appear in the new line). You can use this: one two three one two three one two three one two three one two three one two three one two three one two three ... 4. Go to Manage > Card batches and export a batch 5. Choose the layout set up in 3. 6. Click the Export button and open the resulting pdf file 7. Notice all the repeated word have been grouped -> For this example : all of the ones appear first, followed by all the twos and only then the threes. 8. Apply patch 9. Repeat step 4 through 7 => this time the order of the words has not changed! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Maryse Simard <maryse.simard@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff Assignee|cnighswonger@foundations.ed |maryse.simard@inlibro.com |u | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Gabriel DeCarufel <gabriel.decarufel@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #92411|0 |1 is obsolete| | --- Comment #2 from Gabriel DeCarufel <gabriel.decarufel@inlibro.com> --- Created attachment 97030 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97030&action=edit Bug 23488: Line wrapping doesn't always respect word order in Patron card creator When wrapping long lines of text, the line is divided by removing each word from the end of the line and putting it in a new one until the line is the right width. When the word to be removed appears multiple time in the line, it is not the last occurrence that is removed. This patch changes the regular expression used to remove the part of the text that is wrapped to a new line, making sure it removes it at the end of the text. Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 william.frazilien@inlibro.com changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97030|0 |1 is obsolete| | --- Comment #3 from william.frazilien@inlibro.com --- Created attachment 97059 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=97059&action=edit Bug 23488: Line wrapping doesn't always respect word order in Patron card creator When wrapping long lines of text, the line is divided by removing each word from the end of the line and putting it in a new one until the line is the right width. When the word to be removed appears multiple time in the line, it is not the last occurrence that is removed. This patch changes the regular expression used to remove the part of the text that is wrapped to a new line, making sure it removes it at the end of the text. Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com> Signed-off-by: William Frazilien <william.frazilien@inlibro.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #97059|0 |1 is obsolete| | --- Comment #4 from Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> --- Created attachment 99115 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99115&action=edit Bug 23488: Line wrapping doesn't always respect word order in Patron card creator When wrapping long lines of text, the line is divided by removing each word from the end of the line and putting it in a new one until the line is the right width. When the word to be removed appears multiple time in the line, it is not the last occurrence that is removed. This patch changes the regular expression used to remove the part of the text that is wrapped to a new line, making sure it removes it at the end of the text. Test plan: 1. Go to Tools > Patron card creator 2. Have a card template and a card batch -> If needs be, you can create them by using New > Card template or New > Card batch 3. Create a layout and use one text field containing a long text with at least one word which is repeated a minimum of 2 times (preferably towrdds the end of the text, since it has to be picked as one of the words to appear in the new line). You can use this: one two three one two three one two three one two three one two three one two three one two three one two three ... 4. Go to Manage > Card batches and export a batch 5. Choose the layout set up in 3. 6. Click the Export button and open the resulting pdf file 7. Notice all the repeated word have been grouped -> For this example : all of the ones appear first, followed by all the twos and only then the threes. 8. Apply patch 9. Repeat step 4 through 7 => this time the order of the words has not changed! Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work as described, no errors. Tested adding addrees to test layout, and using the proposed text. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |katrin.fischer@bsz-bw.de --- Comment #5 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Readded the 2 sign-off lines that got lost when the test plan was added to the commit message (thx for that Bernardo!) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA Patch complexity|--- |Trivial patch -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #99115|0 |1 is obsolete| | --- Comment #6 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Created attachment 99835 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=99835&action=edit Bug 23488: Line wrapping doesn't always respect word order in Patron card creator When wrapping long lines of text, the line is divided by removing each word from the end of the line and putting it in a new one until the line is the right width. When the word to be removed appears multiple time in the line, it is not the last occurrence that is removed. This patch changes the regular expression used to remove the part of the text that is wrapped to a new line, making sure it removes it at the end of the text. Test plan: 1. Go to Tools > Patron card creator 2. Have a card template and a card batch -> If needs be, you can create them by using New > Card template or New > Card batch 3. Create a layout and use one text field containing a long text with at least one word which is repeated a minimum of 2 times (preferably towrdds the end of the text, since it has to be picked as one of the words to appear in the new line). You can use this: one two three one two three one two three one two three one two three one two three one two three one two three ... 4. Go to Manage > Card batches and export a batch 5. Choose the layout set up in 3. 6. Click the Export button and open the resulting pdf file 7. Notice all the repeated word have been grouped -> For this example : all of the ones appear first, followed by all the twos and only then the threes. 8. Apply patch 9. Repeat step 4 through 7 => this time the order of the words has not changed! Signed-off-by: Gabriel DeCarufel <gabriel@inlibro.com> Signed-off-by: William Frazilien <william.frazilien@inlibro.com> Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com> Work as described, no errors. Tested adding addrees to test layout, and using the proposed text. Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |20.05.00 released in| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 --- Comment #7 from Martin Renvoize <martin.renvoize@ptfs-europe.com> --- Nice work everyone! Pushed to master for 20.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Joy Nelson <joy@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|20.05.00 |20.05.00, 19.11.05 released in| | CC| |joy@bywatersolutions.com Status|Pushed to master |Pushed to stable --- Comment #8 from Joy Nelson <joy@bywatersolutions.com> --- Pushed to 19.11.x branch for 19.11.05 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Version(s)|20.05.00, 19.11.05 |20.05.00, 19.11.05, released in| |19.05.10 Status|Pushed to stable |Pushed to oldstable --- Comment #9 from Lucas Gass <lucas@bywatersolutions.com> --- backported to 19.05.x for 19.05.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=23488 Hayley Mapley <hayleymapley@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hayleymapley@catalyst.net.n | |z --- Comment #10 from Hayley Mapley <hayleymapley@catalyst.net.nz> --- Minor patch will not be backported to 18.11.x series. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org