Bug 15799

Summary: Move authorised values related code into Koha::AuthorisedValues - part 2
Product: Koha Reporter: Jonathan Druart <jonathan.druart>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: veron
Version: master   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 10363, 15797, 15800, 15803, 17216, 17248, 17249, 17250, 17251, 17252, 17253, 17844, 17847    
Bug Blocks: 15779, 17642    

Description Jonathan Druart 2016-02-11 14:09:06 UTC
The first patch (bug 10363) did not take care of the subroutines from C4::Koha.
This module contains several subroutines which could be either moved or replaced with a call to Koha::AuthorisedValues:

- GetKohaImageurlFromAuthorisedValues
- GetAuthValCode
- GetAuthValCodeFromField
- GetAuthorisedValues
- GetAuthorisedValueCategories
- GetAuthorisedValueByCode
- GetKohaAuthorisedValues
- GetKohaAuthorisedValuesFromField
- GetKohaAuthorisedValuesMapping
- GetKohaAuthorisedValueLib
- GetAuthvalueDropbox
Comment 1 Jonathan Druart 2016-02-11 14:13:20 UTC
IsAuthorisedValueCategory is on bug 15800
Comment 2 Jonathan Druart 2016-02-11 14:28:04 UTC
GetKohaImageurlFromAuthorisedValues is removed by bug 15797
Comment 3 Jonathan Druart 2016-02-11 15:50:52 UTC
Bug 15803 - Koha::AuthorisedValues - Remove GetAuthorisedValueCategories
Comment 4 Jonathan Druart 2016-08-11 12:08:53 UTC
We have already started to move the authorised values related code to
the Koha namespace, but some are still missing.

To continue and move C4::Koha::*AuthorisedValues* subroutines to
Koha::AuthorisedValues, we will need to join on
marc_subfield_structure(.authorised_value which is actually an
authorised value category).

To do so we need to define a relationship (fk) between the two tables.
But we have "special AV" like Asort1 (and friends) , LOST, DAMAGED, etc.)
Which could not be in the authorised_values table [yet]. And 3 other
"special special AV) like itemtypes, branches and cn_source.
Others (undetermined so far) are linked to a marc_subfield_structure
from installer/**/marcflavour/**/*framework*.sql, like STACK.
My idea would be to move all the AV categories to a new table
authorised_value_categories. It will contain only 1 column
category_name refered by
  1. authorised_values.category,
  2. additional_fields.authorised_value_category (others authorised_value
field should be renamed like that when they refer AV categories) and
  3. iitems_search_fields.authorised_value_category.

And, maybe later, auth_subfield_structure, auth_tag_structure,
borrower_attribute_types, marc_tag_structure (some are varchar(10) et
20 when they should be 32!)

We could imagine more attributes to this table, but don't ask me to
add a authorised_value_categories.id as pk please :)
We will have to use temporary tables to deal with the DB constraints,
to add more fun.

Finally the .sql will have to be updated to reflect these changes.

I have just started but before to enter in this tunnel I'd like to
know if there are a couple of volunteers to test? :)
Comment 5 Jonathan Druart 2016-08-29 14:44:48 UTC
(In reply to Jonathan Druart from comment #4)

New table created on bug 17216 - Add a new table to store authorized value categories.
Comment 6 Jonathan Druart 2016-09-05 14:01:25 UTC
Bug 17248 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValueLib
Comment 7 Jonathan Druart 2016-09-05 14:19:47 UTC
Bug 17249 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesFromField
Comment 8 Jonathan Druart 2016-09-05 14:19:59 UTC
Bug 17250 - Koha::AuthorisedValues - Remove GetAuthValCode
Comment 9 Jonathan Druart 2016-09-05 14:20:22 UTC
Bug 17251 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValuesMapping
Comment 10 Jonathan Druart 2016-09-05 14:20:36 UTC
Bug 17252 - Koha::AuthorisedValues - Remove GetAuthorisedValueByCode
Comment 11 Jonathan Druart 2016-09-05 14:20:51 UTC
Bug 17253 - Koha::AuthorisedValues - Remove GetKohaAuthorisedValues
Comment 12 Jonathan Druart 2017-01-04 10:38:18 UTC
Bug 17844 - Move C4::Koha::get_notforloan_label_of to Koha::AuthorisedValues
Comment 13 Jonathan Druart 2017-01-04 14:29:37 UTC
Bug 17847 - Move C4::Koha::GetAuthvalueDropbox to Koha::AuthorisedValues