[Koha-bugs] [Bug 20280] Authorised value categories list in bibliographic frameworks has 2 empty entries

bugzilla-daemon at bugs.koha-community.org bugzilla-daemon at bugs.koha-community.org
Sat May 4 18:09:25 CEST 2019


https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=20280

--- Comment #5 from Jonathan Druart <jonathan.druart at bugs.koha-community.org> ---
So, weird history.

On bug 17216 (which created the authorised_value_categories table), there is
one commit adding the empty option in the template:
+                                <option value=""></option>

(Bug 17216: Use Koha::AVC from mss.pl)

Then one commit hiding the empty value from the DB:
  Bug 17216: Do no display the empty string category name

And finally the last commit (Bug 17216: Move the AV cat list file to the top
level) changed the name of .sql installer file and add the empty entry in the
DB (nothing in the commit description or the bug report tells something about
that change).

Also, another occurrence is in auth_subfields_structure.pl where the empty
entry comes from the DB.

Prior to 17216 the empty option was added once from the .pl and once from the
.tt (not consistent but at least appeared once and only once (I think!).

The thing that is wrong is that, I guess, the empty row in DB was added to
satisfy the FK (marc_subfield_structure.authorised_value), but it must actually
be set to NULL instead of "". The update DB entry (16.06.00.033) set it to
NULL, but next change to the framework set it to "".

All of that to say that I think we should:
1. uniformize the code to make sure we are using the same code everywhere (also
see Koha::AuthorisedValues->new->categories vs
Koha::AuthorisedValueCategories->search)
2. Add the empty option in template, but insert NULL when picked
3. In DB, update the '' occurrences with NULL
4. Remove the '' DB row from the .sql installer file

Hope that makes sense!

-- 
You are receiving this mail because:
You are the assignee for the bug.
You are watching all bug changes.


More information about the Koha-bugs mailing list