Bug 30171 - Creating a subfield without linking it to an authorized value is error 500
Summary: Creating a subfield without linking it to an authorized value is error 500
Status: CLOSED WORKSFORME
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: 21.05
Hardware: All All
: P5 - low major (vote)
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2022-02-23 18:38 UTC by Liz Rea
Modified: 2023-12-28 20:43 UTC (History)
3 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Documentation contact:
Documentation submission:
Text to go in the release notes:
Version(s) released in:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Liz Rea 2022-02-23 18:38:53 UTC
I created a subfield 099$m with a link with COUNTRY authorized values list and it's OK

But, if I try to create a simple subfield 012$z and I've got the following error in logs : 

DBD::mysql::st execute failed: Cannot add or update a child row: a foreign key constraint fails (`koha`.`marc_subfield_structure`,
CONSTRAINT `marc_subfield_structure_ibfk_1` FOREIGN KEY
(`authorised_value`) REFERENCES `authorised_value_categories`
(`category_name`) ON DELETE SET NULL ON ) [for Statement "INSERT INTO `marc_subfield_structure` ( `authorised_value`, `authtypecode`, `defaultvalue`, `frameworkcode`, `hidden`, `isurl`, `kohafield`, `liblibrarian`, `libopac`, `link`, `mandatory`, `maxlength`, `repeatable`, `seealso`, `tab`, `tagfield`, `tagsubfield`,
`value_builder`) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ? )" with ParamValues: 0="", 1="", 2="", 3="", 4="0", 5=0, 6="", 7="test", 8="test", 9="", 10=0, 11="9999", 12=0, 13=undef, 14="0", 15="013", 16="x", 17=""] at /usr/local/share/perl5/DBIx/Class/Storage/DBI.pm line 1836.
Comment 1 Liz Rea 2022-02-23 20:24:50 UTC
It would seem that changing the dropdown value for the blank option to "NULL" instead of "" solves this.
Comment 2 Katrin Fischer 2022-02-26 16:35:45 UTC
Can't confirm on master or 20.11.14, possibly version specific.