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.