Bug 35631 - Default Z39.50 target syntax to match sys pref marcflavour
Summary: Default Z39.50 target syntax to match sys pref marcflavour
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Z39.50 / SRU / OpenSearch Servers (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-12-21 18:15 UTC by Donna
Modified: 2024-11-14 04:19 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:
Circulation function:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Donna 2023-12-21 18:15:27 UTC
When setting up a new Z39.50 target, the Syntax currently defaults to UNIMARC.  It would be really helpful to have it default to whatever the system preference marcflavour is set to (UNIMARC or MARC21).
Comment 1 Nick Clemens (kidclamp) 2023-12-21 18:39:27 UTC
I am wondering if the list of formats is misleading - we have many, but afaict Koha only differentiates USMARC/MARC21 and UNIMARC - and the rest, while part of the Z39.50 spec, are simply ignored?

Our code only references them in this script (with some spurious matches in JS for SBN and CCF)

git grep "INTERMARC\|UKMARC\|NORMARC\|LIBRISMARC\|DANMARC\|FINMARC\|CANMARC\|PICAMARC\|AUSMARC\|IBERMARC\|CATMARC\|MALMARC"
git grep -c "[^IH]SBN"
git grep -c "CCF"


MARC::Record->new_from_xml seems to only accept 4, and I am not sure it treats USMARC/MARC21 differently:
143 If you have a chunk of XML and you want a record object for it you can use
144 this method to generate a MARC::Record object.  You can pass an optional
145 encoding parameter to specify which encoding (UTF-8 or MARC-8) you would like
146 the resulting record to be in.  You can also pass a format parameter to specify
147 the source record type, such as UNIMARC, UNIMARCAUTH, USMARC or MARC21.
Comment 2 Katrin Fischer 2023-12-23 15:59:56 UTC
Pre-selecting the marcflavour format makes a lot of sense, also shortening the list if it has on consequence. 
How should we migrate existing entries?
Comment 3 David Cook 2024-09-02 02:07:59 UTC
So according to https://metacpan.org/pod/MARC::File::XML#MARC::File::XML-%3Edefault_record_format([$format]) the only valid formats are "MARC21, USMARC, UNIMARC and UNIMARCAUTH"

In the code for MARC::File::XML, it mostly just checks if it's unimarc or not, and I think there's one test for unimarc vs unimarcauth. 

So... I think we can probably just change this to "UNIMARC" and "MARC21/USMARC".

For migrating... I'd say force to MARC21/USMARC for other formats, since that's what the MARC::* code appears to do anyway.
Comment 4 David Cook 2024-11-14 04:19:28 UTC
I just had another report of a library failing to add Z39.50 targets because they accidentally set them up to use UNIMARC instead of USMARC.

I'll try to get to this one...