[Bug 36047] New: Apostrophe in suggestion status reason blocks order receipt
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Bug ID: 36047 Summary: Apostrophe in suggestion status reason blocks order receipt Change sponsored?: --- Product: Koha Version: master Hardware: All OS: All Status: NEW Severity: enhancement Priority: P5 - low Component: Acquisitions Assignee: koha-bugs@lists.koha-community.org Reporter: mirjam.vantieghem@etf.edu QA Contact: testopia@bugs.koha-community.org Since the new way of receiving orders in 23.11, the receiving of an order is impossible when this order was created from a purchase suggestion and the reason for accepting the suggestion contains an apostrophe. I didn't test all possible characters. Exclamation and question marks, comma's and semicolons all seem fine. Temporary workaround is to edit the suggestion were the order came from and remove the apostrophe. However, by editing the suggestion, the patron who made the suggestion will get another automatic notice that the title has been ordered and the library will get another email that a suggestion was made, so not ideal. And it slows down the acquisition process. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Mirjam Vantieghem <mirjam.vantieghem@etf.edu> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@ptfs-europe | |.com -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Depends on| |8179 Severity|enhancement |major CC| |caroline.cyr-la-rose@inlibr | |o.com, | |philippe.blouin@inlibro.com --- Comment #1 from Caroline Cyr La Rose <caroline.cyr-la-rose@inlibro.com> --- I have had several complaints about this from clients since we upgraded them. Here is the test plan to recreate the problem: 1. Create a suggestion 1.1. Go to Acquisitions > Suggestions 1.2. Click New purchase suggestion 1.3. Enter a title 1.4. Click Submit your suggestion 2. Update the suggestion to accepted and add a reason with an apostrophe 2.1. In the suggestions list, check the box next to the suggestion 2.2. At the bottom of the screen, choose Mark selected as: Accepted 2.3. In With this reason, choose Others... 2.4. Enter a reason with an apostrophe (my case was in French : Disponible en impression à la demande (POD). S'attendre à un long temps d'attente) 2.5. Click Submit 3. Order the suggestion 3.1. Go to Acquisitions 3.2. Search for a vendor 3.3. Click New > Basket 3.4. Enter a basket name (Optional: for testing I like to change Create items when: cataloging the record) 3.5. Click Save 3.6. Click Add to basket 3.7. Click From a suggestion 3.8. Click Order next to the suggestion 3.9. Enter order details 3.10. Click Save 3.11. Click Close basket 3.12. Click Yes, close 4. Receive the order 4.1. Click Receive shipments 4.2. Enter a Vendor invoice number 4.3. Click Next 4.4. Click Receive next to the order --> Page stays In processing forever I upped the severity to major as this causes a functionality to not work at all (acquisitions receive), but there is a workaround (remove the apostrophe), so not critical. Referenced Bugs: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=8179 [Bug 8179] Receiving multiple order lines at once -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 --- Comment #2 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 162243 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162243&action=edit Bug 36047: Workaround the apostrophe This is just a quick hack fix highlighting where the issue lies the real fix should be escape HTML entities coming from biblio.suggestions as this fix may also fail in case the data contains double quotes -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |pedro.amorim@ptfs-europe.co | |m --- Comment #3 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- I may come back to this but I'm out of time for now so just wanted to submit the result of my dig through. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162243|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 --- Comment #4 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 162280 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162280&action=edit Bug 36047: Add apos and quot to escapeHtml core function -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 --- Comment #5 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 162281 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162281&action=edit Bug 36047: filter jQuery selector through escapeHtml -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Phan Tung Bui <phan-tung.bui@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Phan Tung Bui <phan-tung.bui@inlibro.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162281|0 |1 is obsolete| | --- Comment #6 from Phan Tung Bui <phan-tung.bui@inlibro.com> --- Created attachment 162285 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162285&action=edit Bug 36047: filter jQuery selector through escapeHtml Signed-off-by: Phan Tung Bui <phan-tung.bui@inlibro.com> -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |pedro.amorim@ptfs-europe.co |ity.org |m -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |victor@tuxayo.net -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |julian.maurice@biblibre.com --- Comment #7 from Julian Maurice <julian.maurice@biblibre.com> --- With the patch applied, if the reason selected is one from the SUGGEST authorised value category, and this reason has an apostrophe, on the receive modal the reason is displayed inside a text input, instead of the select. I think it's due to the fact that the selector `option[value="l'apostrophe"]` will not match <option value="l'apostrophe">. A properly escaped selector would be `option[value="l\'apostrophe"]` We should do something like this instead: - if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { + const options = Array.from(document.querySelectorAll('#reason option')) + if (options.some(option => option.value === row.biblio.suggestions[0].reason)) { No need to escape anything -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- QA Contact|testopia@bugs.koha-communit |julian.maurice@biblibre.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162280|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162285|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Pedro Amorim <pedro.amorim@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Failed QA |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 --- Comment #8 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- Created attachment 162337 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162337&action=edit Bug 36047: Remove jQuery selector from conditional This prevents the jQuery from breaking if the reason contains an apostrophe character. 1. Create a suggestion 1.1. Go to Acquisitions > Suggestions 1.2. Click New purchase suggestion 1.3. Enter a title 1.4. Click Submit your suggestion 2. Update the suggestion to accepted and add a reason with an apostrophe 2.1. In the suggestions list, check the box next to the suggestion 2.2. At the bottom of the screen, choose Mark selected as: Accepted 2.3. In With this reason, choose Others... 2.4. Enter a reason with an apostrophe (my case was in French : Disponible en impression à la demande (POD). S'attendre à un long temps d'attente) 2.5. Click Submit 3. Order the suggestion 3.1. Go to Acquisitions 3.2. Search for a vendor 3.3. Click New > Basket 3.4. Enter a basket name (Optional: for testing I like to change Create items when: cataloging the record) 3.5. Click Save 3.6. Click Add to basket 3.7. Click From a suggestion 3.8. Click Order next to the suggestion 3.9. Enter order details 3.10. Click Save 3.11. Click Close basket 3.12. Click Yes, close 4. Receive the order 4.1. Click Receive shipments 4.2. Enter a Vendor invoice number 4.3. Click Next 4.4. Click Receive next to the order --> Page stays In processing forever Apply patch. Repeat. Notice the page now renders correctly. Extra: Add an entry containg an apostrophe to the SUGGEST authorized values category and repeat test plan. Confirm everything works as expected. Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 --- Comment #9 from Pedro Amorim <pedro.amorim@ptfs-europe.com> --- (In reply to Julian Maurice from comment #7)
With the patch applied, if the reason selected is one from the SUGGEST authorised value category, and this reason has an apostrophe, on the receive modal the reason is displayed inside a text input, instead of the select. I think it's due to the fact that the selector `option[value="l'apostrophe"]` will not match <option value="l'apostrophe">. A properly escaped selector would be `option[value="l\'apostrophe"]`
We should do something like this instead:
- if($("#reason option[value='"+row.biblio.suggestions[0].reason+"']").length) { + const options = Array.from(document.querySelectorAll('#reason option')) + if (options.some(option => option.value === row.biblio.suggestions[0].reason)) {
No need to escape anything
Thank you Julian, my solution fixed the reported issue but broke functionality as you've described. I was able to reproduce the issue my patch introduced, tested your suggestion and confirmed it fixes it. I've submitted the patch authored by you with my SO. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #162337|0 |1 is obsolete| | --- Comment #10 from Julian Maurice <julian.maurice@biblibre.com> --- Created attachment 162361 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=162361&action=edit Bug 36047: Remove jQuery selector from conditional This prevents the jQuery from breaking if the reason contains an apostrophe character. 1. Create a suggestion 1.1. Go to Acquisitions > Suggestions 1.2. Click New purchase suggestion 1.3. Enter a title 1.4. Click Submit your suggestion 2. Update the suggestion to accepted and add a reason with an apostrophe 2.1. In the suggestions list, check the box next to the suggestion 2.2. At the bottom of the screen, choose Mark selected as: Accepted 2.3. In With this reason, choose Others... 2.4. Enter a reason with an apostrophe (my case was in French : Disponible en impression à la demande (POD). S'attendre à un long temps d'attente) 2.5. Click Submit 3. Order the suggestion 3.1. Go to Acquisitions 3.2. Search for a vendor 3.3. Click New > Basket 3.4. Enter a basket name (Optional: for testing I like to change Create items when: cataloging the record) 3.5. Click Save 3.6. Click Add to basket 3.7. Click From a suggestion 3.8. Click Order next to the suggestion 3.9. Enter order details 3.10. Click Save 3.11. Click Close basket 3.12. Click Yes, close 4. Receive the order 4.1. Click Receive shipments 4.2. Enter a Vendor invoice number 4.3. Click Next 4.4. Click Receive next to the order --> Page stays In processing forever Apply patch. Repeat. Notice the page now renders correctly. Extra: Add an entry containg an apostrophe to the SUGGEST authorized values category and repeat test plan. Confirm everything works as expected. Signed-off-by: Pedro Amorim <pedro.amorim@ptfs-europe.com> Signed-off-by: Julian Maurice <julian.maurice@biblibre.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Julian Maurice <julian.maurice@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Passed QA -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Katrin Fischer <katrin.fischer@bsz-bw.de> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Passed QA |Pushed to master Version(s)| |24.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=36047 --- Comment #11 from Katrin Fischer <katrin.fischer@bsz-bw.de> --- Pushed for 24.05! Well done everyone, thank you! -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Fridolin Somers <fridolin.somers@biblibre.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Version(s)|24.05.00 |24.05.00,23.11.04 released in| | CC| |fridolin.somers@biblibre.co | |m Status|Pushed to master |Pushed to stable --- Comment #12 from Fridolin Somers <fridolin.somers@biblibre.com> --- Pushed to 23.11.x for 23.11.04 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Lucas Gass <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lucas@bywatersolutions.com Status|Pushed to stable |Pushed to oldstable Version(s)|24.05.00,23.11.04 |24.05.00,23.11.04,23.05.10 released in| | --- Comment #13 from Lucas Gass <lucas@bywatersolutions.com> --- Backported to 23.05.x for upcoming 23.05.10 -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Martin Renvoize <martin.renvoize@ptfs-europe.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC|martin.renvoize@ptfs-europe | |.com | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=36047 Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Pushed to oldstable |RESOLVED CC| |wainuiwitikapark@catalyst.n | |et.nz Resolution|--- |FIXED --- Comment #14 from Wainui Witika-Park <wainuiwitikapark@catalyst.net.nz> --- Not backporting to 22.11 unless requested -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org