Koha allows you to define an authorised value having length 80, but then you can't use it. Here is why: The SQL field items.ccode is a varchar(10). The SQL field authorised_values.authorised_value is a varchar(80). Therefore the authorised value is truncated to length 10 in items.ccode and the mapping from authorised value to description string fails in Koha. Not sure how this change will "bubble up" in Koha but the change to the table schema seems straightforward: increase the size of items.ccode to varchar(80). This is preferable to shortening authorised_values.authorised_value since we have many category codes (CCODE) that are longer than length 10.
Precedent for increasing the size of items.ccode: items.location is varchar(80) which maps to LOC authorised values. items.ccode should be the same size as items.location.
In current versions of Koha: items.ccode varchar(10) items.locatrion varchar(80) authorised_value varchar(80) So there is still some inconsistency.
Created attachment 78385 [details] [review] Bug 5458: increase ccode column to varchar 80 Koha allows you to define an authorised value having length 80, but then you can't use it. Here is why: The SQL field items.ccode is a varchar(10). The SQL field authorised_values.authorised_value is a varchar(80). Therefore the authorised value is truncated to length 10 in items.ccode and the mapping from authorised value to description string fails in Koha. This patch increases ccode column to varchar 80, like location. Test plan : 1) Check there is on item field a subfield with authorised value category CCODE 2) Check this subfield is linked with database column items.ccode 3) Create an authorised values in category CCODE with 'DOCUMENTATION' 4) Edit an item on ccode and choose 'DOCUMENTATION' 5) Save item 6) Look at items.ccode in database or export in MARCXML 7) Without patch the value is troncated to 'DOCUMENTAT', not with patch
Created attachment 78386 [details] [review] Bug 5458: Update DBIx schema
Patch applied successfully in sandbox, but value still appears truncated to DOCUMENTAT both w/ report displaying items.ccode and w/ XML export of record.
(In reply to Cab Vinton from comment #5) > Patch applied successfully in sandbox, but value still appears truncated to > DOCUMENTAT both w/ report displaying items.ccode and w/ XML export of record. Oh indeed my test plan is missing that the trucation is made when item is saved. I correct the test plan.
Created attachment 78553 [details] [review] Bug 5458: increase ccode column to varchar 80 Koha allows you to define an authorised value having length 80, but then you can't use it. Here is why: The SQL field items.ccode is a varchar(10). The SQL field authorised_values.authorised_value is a varchar(80). Therefore the authorised value is truncated to length 10 in items.ccode and the mapping from authorised value to description string fails in Koha. This patch increases ccode column to varchar 80, like location. Test plan : 1) Dont apply patches 2) Check there is on item field a subfield with authorised value category CCODE 3) Check this subfield is linked with database column items.ccode 4) Create an authorised values in category CCODE with 'DOCUMENTATION' 5) Edit an item on ccode and choose 'DOCUMENTATION' 6) Save item 7) Look at items.ccode in database or export in MARCXML 8) The value is troncated to 'DOCUMENTAT' 9) Apply patches and update database with installer/data/mysql/atomicupdate/bug_5458.sql 10) Repeate step 5 to 7 11) The value is not truncated 'DOCUMENTATION'
Created attachment 78554 [details] [review] Bug 5458: Update DBIx schema
(In reply to Fridolin SOMERS from comment #6) > (In reply to Cab Vinton from comment #5) > > Patch applied successfully in sandbox, but value still appears truncated to > > DOCUMENTAT both w/ report displaying items.ccode and w/ XML export of record. > > Oh indeed my test plan is missing that the trucation is made when item is > saved. > I correct the test plan. To test on a sandbox : - configure a sandbox with no patch using "master" instead of bug number - run test plan until step 8 - reconfigure sandbox with this bug number - run test plan skipping steps 8,9 and 10 Thanks for your tests ;)
Created attachment 79316 [details] [review] Bug 5458: increase ccode column to varchar 80 Koha allows you to define an authorised value having length 80, but then you can't use it. Here is why: The SQL field items.ccode is a varchar(10). The SQL field authorised_values.authorised_value is a varchar(80). Therefore the authorised value is truncated to length 10 in items.ccode and the mapping from authorised value to description string fails in Koha. This patch increases ccode column to varchar 80, like location. Test plan : 1) Dont apply patches 2) Check there is on item field a subfield with authorised value category CCODE 3) Check this subfield is linked with database column items.ccode 4) Create an authorised values in category CCODE with 'DOCUMENTATION' 5) Edit an item on ccode and choose 'DOCUMENTATION' 6) Save item 7) Look at items.ccode in database or export in MARCXML 8) The value is troncated to 'DOCUMENTAT' 9) Apply patches and update database with installer/data/mysql/atomicupdate/bug_5458.sql 10) Repeate step 5 to 7 11) The value is not truncated 'DOCUMENTATION' Signed-off-by: Michal Denar <black23ěgmail.com> https://bugs.koha-community.org/show_bug.cgi?id=17282
Created attachment 79317 [details] [review] Bug 5458: Update DBIx schema Signed-off-by: Michal Denar <black23ěgmail.com> Signed-off-by: Your Full Name <your_email> https://bugs.koha-community.org/show_bug.cgi?id=17282
Sorry, my devbox drive me crazy .... Patch tested but some mess added on sign. Mike
Indeed, signoff text is strange : Signed-off-by: Michal Denar <black23ěgmail.com> Signed-off-by: Your Full Name <your_email> Please correct
I know, It's some default value in cofiguration. I've checked setting twice and set user name and email manually, but still same. I'll start again from scratch. Sorry Mike
(In reply to Michal Denar from comment #14) > I know, It's some default value in cofiguration. I've checked setting twice > and set user name and email manually, but still same. > > I'll start again from scratch. > > > Sorry > > > Mike Its just a text in commit message, you may correct manually with "git commit --amend". Thanks a lot for testing ;)
Created attachment 79331 [details] [review] Bug 5458: increase ccode column to varchar 80 Koha allows you to define an authorised value having length 80, but then you can't use it. Here is why: The SQL field items.ccode is a varchar(10). The SQL field authorised_values.authorised_value is a varchar(80). Therefore the authorised value is truncated to length 10 in items.ccode and the mapping from authorised value to description string fails in Koha. This patch increases ccode column to varchar 80, like location. Test plan : 1) Dont apply patches 2) Check there is on item field a subfield with authorised value category CCODE 3) Check this subfield is linked with database column items.ccode 4) Create an authorised values in category CCODE with 'DOCUMENTATION' 5) Edit an item on ccode and choose 'DOCUMENTATION' 6) Save item 7) Look at items.ccode in database or export in MARCXML 8) The value is troncated to 'DOCUMENTAT' 9) Apply patches and update database with installer/data/mysql/atomicupdate/bug_5458.sql 10) Repeate step 5 to 7 11) The value is not truncated 'DOCUMENTATION' Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 79332 [details] [review] Bug 5458: Update DBIx schema Signed-off-by: Michal Denar <black23@gmail.com> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Works well, nice bit of tidy up Fridolin, thanks! Tidied up the signoff lines and passing qa.
Awesome work all! Pushed to master for 18.11
Pushed to 18.05.x for 18.05.05
Pushed to 17.11.x for 17.11.11
statistics.ccode change missing from update DB entry! See bug 21617
*** Bug 18097 has been marked as a duplicate of this bug. ***