[Koha] MARC modification templates problem

Eric Phetteplace ephetteplace at cca.edu
Sat Aug 5 03:31:37 NZST 2023


Hi collective wisdom,

I'm running into a MARC modification template problem and I can't tell if
I'm missing something or there's a bug/limitation. I know I could
accomplish these edits with MARCEdit or a script, but I was hoping to use
Koha's tools.

I have a record with two 856 fields with links, I want to apply our proxy
server prefix to one link but not the other. That seems to be impossible;
Koha clobbers the second link with a copy of the first. Here's a minimal
example.

Record
245 _ _ ‡aExample
856 4 0 ‡uhttps://example.com‡yLink to proxy
856 4 0 ‡uhttps://www.cca.edu‡yLink to retain

MARC modification
Copy and replace 1st field(s) 856 u to field 856 u Regex ✅ s/^http/
https://proxy.cca.edu/url?=http/
If field 856 u matches m/https://example.com/ Regex ✅

Output record
245    _aExample
856 40 _uhttps://proxy.cca.edu/url?=https://example.com
       _yLink to proxy
856 40 _uhttps://proxy.cca.edu/url?=https://example.com
       _yLink to retain

This happens whether I set the modification template to use the "1st" or
"every"  856 field. I don't understand why the second 856 is touched at
all, since it does not meet the "if" condition, much less why instead of
receiving its own link proxied it gets the first 856 URL proxied.

Based on a few tests, it also seems like the "1st" field with respect to
modification actions is not always the one that's visually first when I
edit a record. I tried a set of three actions which 1) copied the first
field to another, unused field, 2) modified it there, and then 3) copied it
back, but Koha copied the second field instead.

Best,

ERIC PHETTEPLACE Systems Librarian, Libraries (he/him)

ephetteplace at cca.edu


*CCA is situated on the traditional unceded lands of the **Chochenyo and
Ramaytush Ohlone** peoples.*

Black-owned bookstores in Oakland: Ashay by the Bay
<https://ashaybythebay.com/>, Marcus Books
<https://www.facebook.com/marcus.books/>

:(){ :|: & };:


More information about the Koha mailing list