Bug 39504

Summary: Batch record modification 'doesn't exist' condition not checking every matching tag
Product: Koha Reporter: Aleisha Amohia <aleisha>
Component: ToolsAssignee: Aleisha Amohia <aleisha>
Status: ASSIGNED --- QA Contact: Testopia <testopia>
Severity: minor    
Priority: P5 - low    
Version: Main   
Hardware: All   
OS: All   
GIT URL: Change sponsored?: Sponsored
Patch complexity: --- Documentation contact:
Documentation submission: Text to go in the release notes:
Version(s) released in:
Circulation function:
Attachments: Bug 39504: [WIP] Make MARC modification templates return not_exists fields for actions

Description Aleisha Amohia 2025-03-31 22:34:54 UTC
I feel like this MARC modification template isn't behaving as I expect it to.

I have a biblio record with the following MARC:

700 $a John Smith $e Editor
700 $a Sally Smith

I want a template that will add a value in 700$e if 700$e doesn't exist.

My MARC modification template action looks like:

- Add new field 700$e with value test if 700$e does not exist 

It doesn't work, probably because the earlier 700 tag does have the $e subfield, so the condition is false and it moves on.

I've tried with other variations for the template action, for example

- Add new field 700$e with value test2 if 700$e does not match RegEx m/(.*)/ 

Still doesn't apply, and I think it should be normal to expect that the MARC modification template will look at all 700 tags to apply this action.
Comment 1 Aleisha Amohia 2025-04-06 23:11:10 UTC
Created attachment 180686 [details] [review]
Bug 39504: [WIP] Make MARC modification templates return not_exists fields for actions

Tests coming

Sponsored-by: Māoriland Film Festival