Bug 28495

Summary: Add validation to branchcode upon library creation
Product: Koha Reporter: Caroline Cyr La Rose <caroline.cyr-la-rose>
Component: System AdministrationAssignee: Bugs List <koha-bugs>
Status: NEW --- QA Contact: Nick Clemens (kidclamp) <nick>
Severity: enhancement    
Priority: P5 - low CC: dcook, eric.begin, gmcharlt, jonathan.druart, nick, philippe.blouin
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:
Circulation function:
Attachments: Bug 28495: Improve validation of library entry form
Bug 28495: Improve validation of library entry form
Bug 28495: (QA follow-up) Enable the use of underscores in branch codes
Bug 28495: Improve validation of library entry form
Bug 28495: (QA follow-up) Enable the use of underscores in branch codes

Description Caroline Cyr La Rose 2021-06-01 13:57:05 UTC
Since hyphens and trailing spaces can cause issues in the branchcode (see bug 28492), I propose we add a validation to the branchcode when a user creates a new library. I would limit it to letters and numbers only. Is there something else?
Comment 1 Owen Leonard 2021-06-09 11:46:28 UTC Comment hidden (obsolete)
Comment 2 Owen Leonard 2021-06-11 11:50:19 UTC
Is this really signed off? It looks like you may have forgotten to attach the signed-off patch.
Comment 3 Salman Ali 2021-06-11 17:09:47 UTC Comment hidden (obsolete)
Comment 4 Nick Clemens (kidclamp) 2021-07-30 12:21:58 UTC
Underscores? I know we have many libraries that have these in existing libraries and may want to continue with their naming pattern.

I like preventing problems, but am we can limit this far
Comment 5 Owen Leonard 2021-07-30 12:45:19 UTC Comment hidden (obsolete)
Comment 6 Nick Clemens (kidclamp) 2021-07-30 14:45:51 UTC Comment hidden (obsolete)
Comment 7 Nick Clemens (kidclamp) 2021-07-30 14:45:54 UTC Comment hidden (obsolete)
Comment 8 Nick Clemens (kidclamp) 2021-07-30 14:46:58 UTC
We cannot edit existing branchcodes, so should nto cause issues for previously entered names, and prevents issues with new ones
Comment 9 Jonathan Druart 2021-08-04 08:16:57 UTC
Why this limitation?

I would exclude a list of special characters but not to anything that is not a-Z0-9, "❤" is a valid branchcode and is known (by me, at least) to work perfectly. It will certainly be considered as a regression by users not using Latin alphabet.
Comment 10 Katrin Fischer 2021-08-06 23:33:28 UTC
The initial issue was with search here. If you have A-B and A as branch codes, limiting to A will also bring up A-B. 

Could be adding a hint that using _ space and - might lead to unexpected search results an alternative?

That said, there _IS_  validation on the branchcode in the onboarding tool that is not reflected in the normal GUI - so instead of adding validation here, we could remove it there and add hints in both spots.
Comment 11 Blou 2023-03-24 19:57:02 UTC
Some variation of this issue poped up again, this time with categories.  Rereading the comments from the QAs, I see a resistance to putting restrictions on the branchcode (or other auth values, as well), but I see no trace of a solution.

Underscores, hyphens, trailing spaces are breaking the search, and it's ok ? 

I don't see why Koha should accept *everything* for a CODE(!!).  Yeah, we want the description to be flexible, in any language, but I don't get it for the code.  We don't have to be uberrestrictive, but at least known problems should be avoided.