Bug 40272

Summary: Add an alert for incorrect (MARC21) fixed-length control fields
Product: Koha Reporter: Marcel de Rooy <m.de.rooy>
Component: MARC Bibliographic data supportAssignee: Marcel de Rooy <m.de.rooy>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=40284
GIT URL: Change sponsored?: ---
Patch complexity: Small patch Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 40272: Add an alert for bad fixed-length control fields
Bug 40272: Add an alert for bad fixed-length control fields

Description Marcel de Rooy 2025-06-30 08:58:50 UTC
This proposal adds an alert when opening the MARC basic editor while a control field (005-008) has an incorrect length.

Note that some historical bugs may have caused 008 fields to be shorter than 40 positions.
Comment 1 Marcel de Rooy 2025-06-30 09:30:38 UTC
Created attachment 183640 [details] [review]
Bug 40272: Add an alert for bad fixed-length control fields

Development wise it is much simpler to do this check in perl when
opening the editor than getting this logic into the template with
javascript. Furthermore, older data may be corrupted, but we trust
the current plugins to not insert such fields anymore.

Test plan:
Run t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC/MARC21.t
Open an existing record in the basic editor. Shorten 008 without plugin.
Save and open the record again. Do you get the alert?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Comment 2 Owen Leonard 2025-06-30 12:16:51 UTC
Created attachment 183641 [details] [review]
Bug 40272: Add an alert for bad fixed-length control fields

Development wise it is much simpler to do this check in perl when
opening the editor than getting this logic into the template with
javascript. Furthermore, older data may be corrupted, but we trust
the current plugins to not insert such fields anymore.

Test plan:
Run t/db_dependent/Koha/Biblio/Metadata/Extractor/MARC/MARC21.t
Open an existing record in the basic editor. Shorten 008 without plugin.
Save and open the record again. Do you get the alert?

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Owen Leonard <oleonard@myacpl.org>