Bug 36769 - MARC frameworks should validate subfield code when adding new subfields
Summary: MARC frameworks should validate subfield code when adding new subfields
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: unspecified
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-05-02 19:41 UTC by Esther Melander
Modified: 2024-05-03 07:13 UTC (History)
2 users (show)

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


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Esther Melander 2024-05-02 19:41:23 UTC
To recreate:

1. Edit the Default framework, 952 tag.
2. Try to add a subfield 12 as a custom note field for the 952.

500 error:

Duplicate IDDuplicate IDDuplicate ID

[2024/05/02 12:04:51] [WARN] DBIx::Class::Storage::DBI::_dbh_execute(): DBI Exception: DBD::mysql::st execute failed: Duplicate entry '952-1' for key 'PRIMARY' at /usr/share/koha/lib/Koha/Object.pm line 170

The Default framework uses the numbers 0-9, and letters a-z, with k set aside for libraries that make their catalogs available for z39.50. I'm sure this is an intended limitation to prevent subfields with double digits and characters.

Many libraries like to add custom fields to the 952. Some will reconfigure an existing subfield with a new name. It is also possible to add a new field with a capital letter, like 'A'. It may be helpful to add to the documentation on frameworks/subfields in the Koha manual what is actually available for use.
Comment 1 Magnus Enger 2024-05-03 06:22:39 UTC
I think subfield codes/names/identifiers are always limited to one character? 

"Subfield codes - Two characters that distinguish the data elements within a field which require separate manipulation. A subfield code consists of a delimiter (ASCII 1F hex), represented in this document as a $, followed by a data element identifier. Data element identifiers may be a lowercase alphabetic or a numeric character."
https://www.loc.gov/marc/bibliographic/bdintro.html
Comment 2 Katrin Fischer 2024-05-03 07:13:30 UTC
Yes, and the database field is only one character too, which is why it gets cut off. I think we could do with better validation.

Koha kinda supports uppercase letters, we have been using them for years now for some extra information.