Bug 14957: Merge rules system for merging of MARC records
authorDavid Gustafsson <david.gustafsson@ub.gu.se>
Thu, 2 Feb 2017 12:36:38 +0000 (13:36 +0100)
committerJonathan Druart <jonathan.druart@bugs.koha-community.org>
Tue, 26 Oct 2021 14:46:02 +0000 (16:46 +0200)
commit139e6c30d6a88641148ea9ab7f00d0a0722f9fb5
treedf92718e09525285ce6766a887a67c7c43e9c715
parentc0a03d34cafd28eaa07e565109b448d09c04d398
Bug 14957: Merge rules system for merging of MARC records

Add a rule based system for merging MARC records to for example
prevent field data from being overwritten.

To test:
    1. Apply this patch.
    2. Log in to staff client.
    3. Enable new syspref MARCMergeRules.
    4. Click the new link "MARC merge rules" in the "Catalog"
       section of the Koha administration page.
    5. Create a new rule:
       Module: source, Filter: *, Tag: 245, Preset: Protect.
    6. Clicking "Edit" should allow you to edit corresponding rule.
    7. Clicking "Delete" should remove corresponding rule after confirmation.
    8. Selecting one or more rules followed by clicking "Delete
       selected" should remove all selected rules after confirmation.
    9. Try creating a rule with tag set to "**", the other options does
       not matter. Verify that saving this rule produces an error
       message complaining about invalid tag regular expression.
    10. Try creating a rule with tag set to "008" (or other control
        field) and set Appended: Append and Removed: Skip, the other
        options does not matter. Verify that saving this rule produces
        an error message complaining about invalid combination of actions
        for control field.
    11. With the 245 rule in step 5 in place, edit a bibliographic record,
        change 245a for example (which should be Title for MARC21) and save.
    12. Verify that the changes has not been saved.
    13. Create a new rule:
        Module: source, Filter: intranet, Tag: 245, Preset: Overwrite.
    14. Repeat step 12, and verify that the changes has now been saved.
    15. Run tests in t/db_dependent/Biblio/MarcMergeRules.t and very
        that all tests pass.

Sponsored-by: Halland County Library
Sponsored-by: Catalyst IT
Sponsored-by: Gothenburg University Library
Signed-off-by: David Nind <david@davidnind.com>
Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
24 files changed:
C4/Biblio.pm
C4/ImportBatch.pm
Koha/BackgroundJob/BatchUpdateBiblio.pm
Koha/Exceptions/MarcMergeRule.pm [new file with mode: 0644]
Koha/MarcMergeRule.pm [new file with mode: 0644]
Koha/MarcMergeRules.pm [new file with mode: 0644]
admin/marc-merge-rules.pl [new file with mode: 0755]
cataloguing/addbiblio.pl
installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl [new file with mode: 0644]
installer/data/mysql/kohastructure.sql
installer/data/mysql/mandatory/sysprefs.sql
installer/data/mysql/mandatory/userpermissions.sql
koha-tmpl/intranet-tmpl/prog/en/includes/admin-menu.inc
koha-tmpl/intranet-tmpl/prog/en/includes/permissions.inc
koha-tmpl/intranet-tmpl/prog/en/modules/admin/admin-home.tt
koha-tmpl/intranet-tmpl/prog/en/modules/admin/marc-merge-rules.tt [new file with mode: 0644]
koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/cataloguing.pref
koha-tmpl/intranet-tmpl/prog/en/modules/cataloguing/addbiblio.tt
misc/link_bibs_to_authorities.pl
misc/migration_tools/bulkmarcimport.pl
misc/migration_tools/import_lexile.pl
t/db_dependent/Biblio.t
t/db_dependent/Biblio/MarcMergeRules.t [new file with mode: 0755]
tools/batch_record_modification.pl