When editing additional attributes of a patron of a category with a code with space (ie "CAT 3"), the Javascript is broken and Additional attributes are not displayed.
Created attachment 25113 [details] [review] Bug 11707 - Additional attributes broken for category code with space When editing additional attributes of a patron of a category with a code with space (ie "CAT 3"), the Javascript is broken and Additional attributes are not displayed. This patch corrects by adding simple quotes aroud category code in JS code. Test plan : - Create an patron additional attribute - Create a new patron category with a space in code. ie "CAT 3" - Create a new patron of this category : /cgi-bin/koha/members/memberentry.pl?op=add&categorycode=CAT 3 => Without patch the JS is broken (Syntax error, unrecognized expression: [data-category_code=CAT 3]) and additional attributes are not displayed. => With patch the JS is not broken and additional attributes are displayed and can be edited.
I am not against fixing this, but in general I would never recommend using codes with spaces in them. This is probably not the only problem. Joy wrote something about it a while ago: http://bywatersolutions.com/2012/07/05/naming-conventions-in-koha/
Created attachment 25301 [details] [review] [SIGNED-OFF] Bug 11707 - Additional attributes broken for category code with space When editing additional attributes of a patron of a category with a code with space (ie "CAT 3"), the Javascript is broken and Additional attributes are not displayed. This patch corrects by adding simple quotes aroud category code in JS code. Test plan : - Create an patron additional attribute - Create a new patron category with a space in code. ie "CAT 3" - Create a new patron of this category : /cgi-bin/koha/members/memberentry.pl?op=add&categorycode=CAT 3 => Without patch the JS is broken (Syntax error, unrecognized expression: [data-category_code=CAT 3]) and additional attributes are not displayed. => With patch the JS is not broken and additional attributes are displayed and can be edited. In current Koha version it is not possible to create categroy codes with blanks. To test, I changed an existing category code directly in the database. Then I followed the Test plan. Without patch, attribute types were not displayed. With patch, they were displayed as expected. Signed-off-by: Marc Véron <veron@veron.ch>
I agree with Katrin's comment. Perhaps it would be better to fix this by adding a check to the attribute creator to stop a librarian from creating an attribute with a space in the value, and perhaps some of Joy's other recommendations.
(In reply to Kyle M Hall from comment #4) > I agree with Katrin's comment. Perhaps it would be better to fix this by > adding a check to the attribute creator to stop a librarian from creating an > attribute with a space in the value, and perhaps some of Joy's other > recommendations. I agree too, but what about existing ones? :)
I think I would strongly encourage the library to switch to patron category codes without spaces :)
Btw, Koha currently does not let you enter a patron category code with a space and shows an error message if you try: category code can only contain the following characters: letters, numbers, - and
Created attachment 25567 [details] [review] [PASSED QA] Bug 11707 - Additional attributes broken for category code with space When editing additional attributes of a patron of a category with a code with space (ie "CAT 3"), the Javascript is broken and Additional attributes are not displayed. This patch corrects by adding simple quotes aroud category code in JS code. Test plan : - Create an patron additional attribute - Create a new patron category with a space in code. ie "CAT 3" - Create a new patron of this category : /cgi-bin/koha/members/memberentry.pl?op=add&categorycode=CAT 3 => Without patch the JS is broken (Syntax error, unrecognized expression: [data-category_code=CAT 3]) and additional attributes are not displayed. => With patch the JS is not broken and additional attributes are displayed and can be edited. In current Koha version it is not possible to create categroy codes with blanks. To test, I changed an existing category code directly in the database. Then I followed the Test plan. Without patch, attribute types were not displayed. With patch, they were displayed as expected. Signed-off-by: Marc Véron <veron@veron.ch> Signed-off-by: Katrin Fischer <Katrin.Fischer.83@web.de> I recommend not using codes with spaces and fix existing ones. Koha doesn't allow you to add category codes with spaces, so the only way to do it is via SQL. This patch fixes a problem and passes all tests.
Pushed to master. Thanks, Fridolin!
Pushed to 3.14.x, will be in 3.14.07
Pushed to 3.12.x will be in 3.12.13