Bug 11707

Summary: Additional attributes broken for category code with space
Product: Koha Reporter: Fridolin Somers <fridolin.somers>
Component: PatronsAssignee: Fridolin Somers <fridolin.somers>
Status: CLOSED FIXED QA Contact: Testopia <testopia>
Severity: normal    
Priority: P5 - low CC: gmcharlt, jonathan.druart, katrin.fischer, kyle.m.hall, kyle, veron
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Attachments: Bug 11707 - Additional attributes broken for category code with space
[SIGNED-OFF] Bug 11707 - Additional attributes broken for category code with space
[PASSED QA] Bug 11707 - Additional attributes broken for category code with space

Description Fridolin Somers 2014-02-07 09:12:39 UTC
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.
Comment 1 Fridolin Somers 2014-02-07 09:19:41 UTC Comment hidden (obsolete)
Comment 2 Katrin Fischer 2014-02-08 08:25:23 UTC
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/
Comment 3 Marc Véron 2014-02-15 10:03:03 UTC Comment hidden (obsolete)
Comment 4 Kyle M Hall 2014-02-21 13:28:27 UTC
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.
Comment 5 Jonathan Druart 2014-02-21 13:37:20 UTC
(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? :)
Comment 6 Katrin Fischer 2014-02-23 22:26:57 UTC
I think I would strongly encourage the library to switch to patron category codes without spaces :)
Comment 7 Katrin Fischer 2014-02-23 22:28:53 UTC
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
Comment 8 Katrin Fischer 2014-02-23 22:34:00 UTC
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.
Comment 9 Galen Charlton 2014-02-26 16:38:38 UTC
Pushed to master.  Thanks, Fridolin!
Comment 10 Fridolin Somers 2014-05-21 09:27:27 UTC
Pushed to 3.14.x, will be in 3.14.07
Comment 11 Kyle M Hall 2014-06-06 13:56:32 UTC
Pushed to 3.12.x will be in 3.12.13