[Bug 40313] New: Legacy/migrated categorycode can break patron save
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 Bug ID: 40313 Summary: Legacy/migrated categorycode can break patron save Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Patrons Assignee: koha-bugs@lists.koha-community.org Reporter: dcook@prosentient.com.au QA Contact: testopia@bugs.koha-community.org CC: gmcharlt@gmail.com, kyle.m.hall@gmail.com This should be quite an edge case, but if you have done a data migration and have category codes like "(ABC123", you may notice that you cannot edit your patrons. Due to some suboptimal Javascript, the "(" gets erroneously interpreted by jQuery and leads to an error which breaks other Javascript and prevents the page save from working. -- 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=40313 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |Needs Signoff -- 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=40313 --- Comment #2 from David Cook <dcook@prosentient.com.au> --- Created attachment 183819 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=183819&action=edit Bug 40313: Prevent jQuery error when saving patron with bad categorycode This patch prevents a problem string from being passed to $(). Out of the box, this shouldn't be a problem, but if you migrate categorycodes from another system which may or may not include the "(" character in them, you'll find you cannot edit and save these patrons anymore due to a Javascript error. To reproduce: 0. DO NOT APPLY THE PATCH 1. Create a new patron category with a code called "TEST" 2. In the mysql client, change this patron category code to "(TEST" 3. Create a new patron with this category 4. Try to edit and save the patron 5. Note you cannot (and if you open the browser console, you'll see JS errors) Test plan: 0. Apply the patch 1. Try to edit and save the patron from above 2. Note that you can now save the patron Bonus points: 0. Edit the new patron category to have a password length of 16 or higher 1. Create a patron attribute just for this new patron category 2. Test editing patrons by changing the category to this TEST category and other established categories. 3. Note that the password length and patron attributes change as you change the category -- 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=40313 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |dcook@prosentient.com.au |ity.org | -- 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=40313 David Nind <david@davidnind.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=40313 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #183819|0 |1 is obsolete| | --- Comment #4 from David Nind <david@davidnind.com> --- Created attachment 184418 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=184418&action=edit Bug 40313: Prevent jQuery error when saving patron with bad categorycode This patch prevents a problem string from being passed to $(). Out of the box, this shouldn't be a problem, but if you migrate categorycodes from another system which may or may not include the "(" character in them, you'll find you cannot edit and save these patrons anymore due to a Javascript error. To reproduce: 0. DO NOT APPLY THE PATCH 1. Create a new patron category with a code called "TEST" 2. In the mysql client, change this patron category code to "(TEST" 3. Create a new patron with this category 4. Try to edit and save the patron 5. Note you cannot (and if you open the browser console, you'll see JS errors) Test plan: 0. Apply the patch 1. Try to edit and save the patron from above 2. Note that you can now save the patron Bonus points: 0. Edit the new patron category to have a password length of 16 or higher 1. Create a patron attribute just for this new patron category 2. Test editing patrons by changing the category to this TEST category and other established categories. 3. Note that the password length and patron attributes change as you change the category Signed-off-by: David Nind <david@davidnind.com> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 David Nind <david@davidnind.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |david@davidnind.com --- Comment #5 from David Nind <david@davidnind.com> --- Testing notes (using KTD): 1. SQL to update patron category: update categories set categorycode="(TEST" where categorycode="TEST"; 2. I didn't try for bonus points! 8-) -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |m.de.rooy@rijksmuseum.nl --- Comment #6 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- git grep koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code( "[% borrower_data.categorycode | html %]" ); koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code( category_code ); koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code(this); koha-tmpl/intranet-tmpl/prog/js/members.js:function update_category_code(category_code) { Shouldnt we change this part in the template: $("#categorycode_entry").on("change", function(){ update_category_code(this); }); And have a consistent param type in the function? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 --- Comment #7 from David Cook <dcook@prosentient.com.au> --- (In reply to Marcel de Rooy from comment #6)
git grep koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code( "[% borrower_data.categorycode | html %]" ); koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code( category_code ); koha-tmpl/intranet-tmpl/prog/en/modules/members/memberentrygen.tt: update_category_code(this); koha-tmpl/intranet-tmpl/prog/js/members.js:function update_category_code(category_code) {
Shouldnt we change this part in the template:
$("#categorycode_entry").on("change", function(){ update_category_code(this); }); And have a consistent param type in the function?
I think that would be the optimal outcome for sure. I was short on time locally, so this was the shortest path to a working version, and I figured I'd upstream that. But yes I think a better overall solution would be to change the rest of the template/javascript to be more consistent. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 Marcel de Rooy <m.de.rooy@rijksmuseum.nl> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #8 from Marcel de Rooy <m.de.rooy@rijksmuseum.nl> --- (In reply to David Cook from comment #7)
But yes I think a better overall solution would be to change the rest of the template/javascript to be more consistent.
Agreed. Please do. Shouldnt take you much time? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 David Cook <dcook@prosentient.com.au> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|dcook@prosentient.com.au |koha-bugs@lists.koha-commun | |ity.org --- Comment #9 from David Cook <dcook@prosentient.com.au> --- (In reply to Marcel de Rooy from comment #8)
(In reply to David Cook from comment #7)
But yes I think a better overall solution would be to change the rest of the template/javascript to be more consistent.
Agreed. Please do. Shouldnt take you much time?
Unfortunately, it looks like my schedule has changed to include less Koha time, so I will have to consider my contributions more carefully. This one probably isn't important enough to come back to. Resetting assignee. -- 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=40313 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |martin.renvoize@openfifth.c | |o.uk -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40313 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|koha-bugs@lists.koha-commun |martin.renvoize@openfifth.c |ity.org |o.uk -- 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=40313 Martin Renvoize (ashimema) <martin.renvoize@openfifth.co.uk> changed: What |Removed |Added ---------------------------------------------------------------------------- Assignee|martin.renvoize@openfifth.c |koha-bugs@lists.koha-commun |o.uk |ity.org -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org