Bug 18097

Summary: It is possible to create unusable category codes (ccode) due to field length mismatch
Product: Koha Reporter: Kyle M Hall <kyle>
Component: CatalogingAssignee: Kyle M Hall <kyle>
Status: RESOLVED DUPLICATE QA Contact: Testopia <testopia>
Severity: major    
Priority: P5 - low CC: jonathan.druart, katrin.fischer, m.de.rooy, marjorie.barry-vila
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=5458
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 17216    
Bug Blocks:    
Attachments: Bug 18097 - Update kohastructure.pl
Bug 18097: Add FK for authorised values

Description Kyle M Hall 2017-02-10 16:16:44 UTC
The column items.ccode is 10 characters long. It references authorised values of the type CCODE. The maximum length of an authorised value is 80 characters long. If a CCODE is created with a value greater than 10, when it is stored for the item it will be truncated and become either a) an invalid ccode or b) match a different ccode!

The solution should be to increase the items.ccode column from varchar(10) to varchar(80).

This really goes for all columns that could possibly store an authorised value.
Comment 1 Kyle M Hall 2017-02-10 16:25:56 UTC
Created attachment 60121 [details] [review]
Bug 18097 - Update kohastructure.pl
Comment 2 Jonathan Druart 2017-02-15 17:33:46 UTC
Kyle, do you plan to provide a complete patch?
Comment 3 Kyle M Hall 2017-02-23 11:37:25 UTC
(In reply to Jonathan Druart from comment #2)
> Kyle, do you plan to provide a complete patch?

I haven't found the time yet to identify all columns that have the option to be authorised values yet. If you want to add a patch please go ahead!
Comment 4 Jonathan Druart 2017-02-24 14:07:30 UTC
Created attachment 60656 [details] [review]
Bug 18097: Add FK for authorised values
Comment 5 Jonathan Druart 2017-02-24 14:08:19 UTC
This patch seems more complicate and cover other authorised values FK.
However I am wondering if ccode DB fields should have a FK as well.
Comment 6 Katrin Fischer 2019-12-12 07:38:48 UTC
It looks like we fixed this elsewhere: items.ccode is 80 chars now.
Comment 7 Jonathan Druart 2019-12-12 08:22:48 UTC
(In reply to Katrin Fischer from comment #6)
> It looks like we fixed this elsewhere: items.ccode is 80 chars now.

Maybe ccode, but what I tried to address (av columns) with my patch is not fixed.

*** This bug has been marked as a duplicate of bug 5458 ***