Bug 41138 - Batch record modification via MARC modification template overwrites equal fields.
Summary: Batch record modification via MARC modification template overwrites equal fie...
Status: NEW
Alias: None
Product: Koha
Classification: Unclassified
Component: Cataloging (show other bugs)
Version: 25.05
Hardware: All All
: P5 - low normal
Assignee: Bugs List
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2025-10-30 01:22 UTC by int
Modified: 2025-10-30 01:22 UTC (History)
1 user (show)

See Also:
GIT URL:
Initiative type: ---
Sponsorship status: ---
Crowdfunding goal: 0
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 int 2025-10-30 01:22:18 UTC
I want to batch correct a URL in the MARC-Data.
So I created a MARC modification templates as described in the manual (see the proxy URL example):
https://koha-community.org/manual/25.05/en/html/cataloging.html#marc-modification-templates 
I did
"Copy and replace" over "All" field(s) "856 u" to field "856 u" with Regex "s/deposit.d-nb.de/deposit.dnb.de/g"
if field "856 u" matches "m/deposit.d-nb.de/" RegEx

The fields in the original record look like this:
856 42 _u http://d-nb.info/1050788141/04
       _3Inhaltsverzeichnis
856 42 _u http://deposit.d-nb.de/cgi-bin/dokserv?id=4659369&prov=M&dok_var=1&dok_ext=htm
       _3Inhaltstext
856 42 _u http://www.perlentaucher.de/buch/barbara-sichtermann/ich-rauche-zigarren-und-glaube-nicht-an-g
       _3Rezension

After applying the template, I would expect that only the middle one gets modified.
Instead I get this:
856 42 _uhttp://deposit.dnb.de/cgi-bin/dokserv?id=4659369&prov=M&dok_var=1&dok_ext=htm
       _3Inhaltsverzeichnis
856 42 _uhttp://deposit.dnb.de/cgi-bin/dokserv?id=4659369&prov=M&dok_var=1&dok_ext=htm
       _3Inhaltstext
856 42 _uhttp://deposit.dnb.de/cgi-bin/dokserv?id=4659369&prov=M&dok_var=1&dok_ext=htm
       _3Rezension 

It doesn't matter if I do "All" field(s) or "1." field(s) in the template, the result is the same.
This is probably related to and maybe not the same as
Bug 28231 - MARC modification template "1st" vs "Every" bug?
and
Bug 34508 - MARC modification templates have poor results when working with multiple of a field

I think this bug is severe as it can go unnoticed and lead to data loss in a lot of records.
Unnoticed because if you only have one field everything looks good and only multiple equal fields get overwritten.