[Bug 39504] New: Batch record modification 'doesn't exist' condition not checking every matching tag
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Bug ID: 39504 Summary: Batch record modification 'doesn't exist' condition not checking every matching tag Change sponsored?: --- Product: Koha Version: Main Hardware: All OS: All Status: NEW Severity: minor Priority: P5 - low Component: Tools Assignee: koha-bugs@lists.koha-community.org Reporter: aleisha@catalyst.net.nz QA Contact: testopia@bugs.koha-community.org 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. -- You are receiving this mail because: You are the assignee for the bug. You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED Assignee|koha-bugs@lists.koha-commun |aleisha@catalyst.net.nz |ity.org | Change sponsored?|--- |Sponsored -- You are receiving this mail because: You are watching all bug changes. You are the assignee for the bug.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #1 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 180686 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=180686&action=edit Bug 39504: [WIP] Make MARC modification templates return not_exists fields for actions Tests coming Sponsored-by: Māoriland Film Festival -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |Needs Signoff Comma delimited| |Catalyst IT, MÄoriland list of Sponsors| |Film Festival -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #180686|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Aleisha Amohia <aleisha@catalyst.net.nz> changed: What |Removed |Added ---------------------------------------------------------------------------- Comma delimited|Catalyst IT, MÄoriland |Catalyst IT, Māoriland Film list of Sponsors|Film Festival |Festival -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #2 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Created attachment 201511 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201511&action=edit Bug 39504: Make MARC modification templates return not_exists fields for actions This patch makes a batch record modification check if a MARC modification template can apply to all relevant tags. This changes the Koha::SimpleMARC field_exists method to also return a list of record fields where the tag/subfield doesn't exist. This patch only introduces the usage of this list if the template has a 'not exists' condition, but this list can now be implemented separately for other conditions too. To test: 1. Go to Cataloging -> MARC modification templates 2. Create a new template and add an action "Update existing or add new field 700$e with value Editor if 700$e does not exist" 3. Edit a biblio i.e. biblionumber 418 4. Go to the 7 tab in the biblio editor and add the following data, then Save: 700 $a John Smith $e Editor 700 $a Sally Smith 5. Go to Cataloging -> Batch record modification 6. Add your biblionumber 418 and select your MARC modification template, then continue 7. Click Show MARC next to the record 8. Notice that $e Editor has not been added to 700 $a Sally Smith, which the MARC modification template action suggests would happen as $e does not exist for that 700 9. Apply the patch and refresh the page 10. Repeat step 7, this time confirm that $e Editor has in fact been added to 700 $a Sally Smith 11. Confirm tests pass t/SimpleMARC.t Sponsored-by: Māoriland Film Festival Sponsored-by: Catalyst IT -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Needs Signoff |Signed Off -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- Attachment #201511|0 |1 is obsolete| | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #3 from Phil Ringnalda <phil@chetcolibrary.org> --- Created attachment 201774 --> https://bugs.koha-community.org/bugzilla3/attachment.cgi?id=201774&action=edit Bug 39504: Make MARC modification templates return not_exists fields for actions This patch makes a batch record modification check if a MARC modification template can apply to all relevant tags. This changes the Koha::SimpleMARC field_exists method to also return a list of record fields where the tag/subfield doesn't exist. This patch only introduces the usage of this list if the template has a 'not exists' condition, but this list can now be implemented separately for other conditions too. To test: 1. Go to Cataloging -> MARC modification templates 2. Create a new template and add an action "Update existing or add new field 700$e with value Editor if 700$e does not exist" 3. Edit a biblio i.e. biblionumber 418 4. Go to the 7 tab in the biblio editor and add the following data, then Save: 700 $a John Smith $e Editor 700 $a Sally Smith 5. Go to Cataloging -> Batch record modification 6. Add your biblionumber 418 and select your MARC modification template, then continue 7. Click Show MARC next to the record 8. Notice that $e Editor has not been added to 700 $a Sally Smith, which the MARC modification template action suggests would happen as $e does not exist for that 700 9. Apply the patch and refresh the page 10. Repeat step 7, this time confirm that $e Editor has in fact been added to 700 $a Sally Smith 11. Confirm tests pass t/SimpleMARC.t Sponsored-by: Māoriland Film Festival Sponsored-by: Catalyst IT Signed-off-by: Phil Ringnalda <phil@chetcolibrary.org> -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Phil Ringnalda <phil@chetcolibrary.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |phil@chetcolibrary.org -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Lisette Scheer <lisette@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lisette@bywatersolutions.co | |m QA Contact|testopia@bugs.koha-communit |lucas@bywatersolutions.com |y.org | -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 Lucas Gass (lukeg) <lucas@bywatersolutions.com> changed: What |Removed |Added ---------------------------------------------------------------------------- Status|Signed Off |Failed QA --- Comment #4 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- 2 new failures with this applied: prove -v t/db_dependent/MarcModificationTemplates.t: # Subtest: Import with skip_existing=1 skips existing templates 1..11 ok 1 - Template created successfully ok 2 - Original action added ok 3 - Template exported successfully ok 4 - Modified action added to existing template ok 5 - Template has 2 actions before import ok 6 - Template not imported when skip_existing=1 ok 7 - Template skipped when skip_existing=1 ok 8 - No import errors ok 9 - Template still has 2 actions after skip ok 10 - First action is still update_field ok 11 - Second action is still add_field ok 134 - Import with skip_existing=1 skips existing templates ok 135 - no warnings # Looks like you failed 2 tests of 135. Dubious, test returned 2 (wstat 512, 0x200) Failed 2/135 subtests # Subtest: Bug 32950: Moving subfield preserves values in repeatable fields 1..14 ok 1 - Should still have 5 020 fields not ok 2 - First field $a value preserved # Failed test 'First field $a value preserved' # at t/db_dependent/MarcModificationTemplates.t line 1095. # got: '9781032023175' # expected: '9781003182870' ok 3 - First field $q value preserved not ok 4 - Second field $a value preserved # Failed test 'Second field $a value preserved' # at t/db_dependent/MarcModificationTemplates.t line 1098. # got: '9780367760380' # expected: '1003182879' not ok 5 - Third field $a value preserved # Failed test 'Third field $a value preserved' # at t/db_dependent/MarcModificationTemplates.t line 1100. # got: undef # expected: '9781000407204' ok 6 - Third field $q value preserved not ok 7 - Fourth field $z moved to $a # Failed test 'Fourth field $z moved to $a' # at t/db_dependent/MarcModificationTemplates.t line 1104. # got: undef # expected: '9781032023175' ok 8 - Fourth field $q value preserved not ok 9 - Fifth field $z moved to $a # Failed test 'Fifth field $z moved to $a' # at t/db_dependent/MarcModificationTemplates.t line 1107. # got: undef # expected: '9780367760380' ok 10 - No $z subfields should remain ok 11 - No $z subfields should remain ok 12 - No $z subfields should remain ok 13 - No $z subfields should remain ok 14 - No $z subfields should remain # Looks like you failed 5 tests of 14. not ok 131 - Bug 32950: Moving subfield preserves values in repeatable fields -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #5 from Aleisha Amohia <aleisha@catalyst.net.nz> --- Hey Luke, are those test failures related to a different bug report? -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #6 from Lucas Gass (lukeg) <lucas@bywatersolutions.com> --- (In reply to Aleisha Amohia from comment #5)
Hey Luke, are those test failures related to a different bug report?
I don't think so. They only fail with this patch applied. -- You are receiving this mail because: You are watching all bug changes.
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=39504 --- Comment #7 from Aleisha Amohia <aleisha@catalyst.net.nz> --- (In reply to Lucas Gass (lukeg) from comment #6)
(In reply to Aleisha Amohia from comment #5)
Hey Luke, are those test failures related to a different bug report?
I don't think so. They only fail with this patch applied.
Thanks, will take a look. -- You are receiving this mail because: You are watching all bug changes.
participants (1)
-
bugzilla-daemon@bugs.koha-community.org