Bug 22571 - MARC modification templates do not handle control fields in conditional
Summary: MARC modification templates do not handle control fields in conditional
Status: Pushed to stable
Alias: None
Product: Koha
Classification: Unclassified
Component: Tools (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Testopia
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2019-03-24 19:48 UTC by Michael Kuhn
Modified: 2019-07-22 13:57 UTC (History)
4 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:
19.11.00,19.05.02


Attachments
Bug 22571: Add tests (2.44 KB, patch)
2019-05-05 17:46 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22571: Handle control fields in MMT for conditionals (1.62 KB, patch)
2019-05-05 17:46 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22571: Add tests (2.49 KB, patch)
2019-06-17 17:59 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 22571: Handle control fields in MMT for conditionals (1.67 KB, patch)
2019-06-17 17:59 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 22571: (follow up) fix Donald cut-&-paste error (1.14 KB, patch)
2019-06-17 17:59 UTC, M. Tompsett
Details | Diff | Splinter Review
Bug 22571: Add tests (2.55 KB, patch)
2019-06-21 11:30 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 22571: Handle control fields in MMT for conditionals (1.73 KB, patch)
2019-06-21 11:30 UTC, Nick Clemens
Details | Diff | Splinter Review
Bug 22571: (follow up) fix Donald cut-&-paste error (1.19 KB, patch)
2019-06-21 11:30 UTC, Nick Clemens
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Kuhn 2019-03-24 19:48:56 UTC
After successfully creating a MARC modification template in Koha menu "Tools > Batch record modification" with the following action:

Add new field 041$a with value ger if 008 matches RegEx m/^...................................ger..$/

the action is run over a given record and Koha says that the bibliographic record has successfully been modified - but in fact nothing has changed, thus no new MARC 041$a is created.

According to Jonathan Druart (in mailinglist "Koha", 21.03.2019 17:12) this is a bug in Perl module "Koha::SimpleMARC::field_equals".
Comment 1 Jonathan Druart 2019-05-05 17:46:31 UTC
Created attachment 89362 [details] [review]
Bug 22571: Add tests
Comment 2 Jonathan Druart 2019-05-05 17:46:33 UTC
Created attachment 89363 [details] [review]
Bug 22571: Handle control fields in MMT for conditionals

Control fields are not handled correctly by Koha::SimpleMARC when
comparaison (with or without regex) is done.

Which means we did not support something like:
Do something if control field 008 equals or matches "a string"

Test plan:
Create a new MARC modification template and a new action, like:
Add new field 100$a with value "foo bar" if 008 (or any other control
fields) matches (or equals) a regex
Then use the record mofication tool and confirm that the new field is
create if the regex matches 008 of the bib record
Comment 3 M. Tompsett 2019-06-17 17:59:31 UTC
Created attachment 90683 [details] [review]
Bug 22571: Add tests

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 4 M. Tompsett 2019-06-17 17:59:33 UTC
Created attachment 90684 [details] [review]
Bug 22571: Handle control fields in MMT for conditionals

Control fields are not handled correctly by Koha::SimpleMARC when
comparaison (with or without regex) is done.

Which means we did not support something like:
Do something if control field 008 equals or matches "a string"

Test plan:
Create a new MARC modification template and a new action, like:
Add new field 100$a with value "foo bar" if 008 (or any other control
fields) matches (or equals) a regex
Then use the record mofication tool and confirm that the new field is
create if the regex matches 008 of the bib record

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 5 M. Tompsett 2019-06-17 17:59:36 UTC
Created attachment 90685 [details] [review]
Bug 22571: (follow up) fix Donald cut-&-paste error

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>
Comment 6 Nick Clemens 2019-06-21 11:30:25 UTC
Created attachment 90896 [details] [review]
Bug 22571: Add tests

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 7 Nick Clemens 2019-06-21 11:30:28 UTC
Created attachment 90897 [details] [review]
Bug 22571: Handle control fields in MMT for conditionals

Control fields are not handled correctly by Koha::SimpleMARC when
comparaison (with or without regex) is done.

Which means we did not support something like:
Do something if control field 008 equals or matches "a string"

Test plan:
Create a new MARC modification template and a new action, like:
Add new field 100$a with value "foo bar" if 008 (or any other control
fields) matches (or equals) a regex
Then use the record mofication tool and confirm that the new field is
create if the regex matches 008 of the bib record

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 8 Nick Clemens 2019-06-21 11:30:31 UTC
Created attachment 90898 [details] [review]
Bug 22571: (follow up) fix Donald cut-&-paste error

Signed-off-by: Mark Tompsett <mtompset@hotmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>
Comment 9 Martin Renvoize 2019-06-21 12:13:45 UTC
Nice work!

Pushed to master for 19.11.00
Comment 10 Fridolin SOMERS 2019-07-16 06:41:04 UTC
Pushed to 19.05.x for 19.05.02