Bug 14957: (QA follow-up) Rename 'merge' => 'overlay'

This patch acknowledges the fact that 'merging' has a different meaning
in Koha than the behavior this great patchset introduces. The more
idiomatic way of describing the behavior is to talk about 'overlay rules'.

This patch also:
- Fixes kohastructure.sql missing table encoding a collation
- Fixes the atomic update completely missing a table
- Moves the syspref entry to 'Importing', probably a rebase issue

Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 14957: (QA follow-up) Fix syntax error in atomicupdate

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 14957: Fix imports in tests

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 14957: Fix imports in marc-overlay-rules.pl

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

Bug 14957: Fix syspref's values

It didn't switch off when set to "don't use"

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>

JD amended patch: Fix license statement

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
This commit is contained in:
Tomas Cohen Arazi 2021-03-26 13:12:11 -03:00 committed by Jonathan Druart
parent f4725b6427
commit 02720d423c
16 changed files with 272 additions and 265 deletions

View File

@ -61,7 +61,7 @@ BEGIN {
DelBiblio
BiblioAutoLink
LinkBibHeadingsToAuthorities
ApplyMarcMergeRules
ApplyMarcOverlayRules
TransformMarcToKoha
TransformHtmlToMarc
TransformHtmlToXml
@ -110,12 +110,12 @@ use Koha::Acquisition::Currencies;
use Koha::Biblio::Metadatas;
use Koha::Holds;
use Koha::ItemTypes;
use Koha::MarcOverlayRules;
use Koha::Plugins;
use Koha::SearchEngine;
use Koha::SearchEngine::Indexer;
use Koha::Libraries;
use Koha::Util::MARC;
use Koha::MarcMergeRules;
=head1 NAME
@ -334,9 +334,9 @@ The C<$options> argument is a hashref with additional parameters:
=item C<context>
This parameter is forwared to L</ApplyMarcMergeRules> where it is used for
selecting the current rule set if Marc Merge Rules is enabled.
See L</ApplyMarcMergeRules> for more details.
This parameter is forwarded to L</ApplyMarcOverlayRules> where it is used for
selecting the current rule set if MARCOverlayRules is enabled.
See L</ApplyMarcOverlayRules> for more details.
=item C<disable_autolink>
@ -385,12 +385,17 @@ sub ModBiblio {
_strip_item_fields($record, $frameworkcode);
# apply merge rules
if (C4::Context->preference('MARCMergeRules') && $biblionumber && defined $options && exists $options->{'context'}) {
$record = ApplyMarcMergeRules({
# apply overlay rules
if ( C4::Context->preference('MARCOverlayRules')
&& $biblionumber
&& defined $options
&& exists $options->{'context'} )
{
$record = ApplyMarcOverlayRules(
{
biblionumber => $biblionumber,
record => $record,
context => $options->{'context'},
record => $record,
context => $options->{'context'},
}
);
}
@ -3261,9 +3266,9 @@ sub RemoveAllNsb {
return $record;
}
=head2 ApplyMarcMergeRules
=head2 ApplyMarcOverlayRules
my $record = ApplyMarcMergeRules($params)
my $record = ApplyMarcOverlayRules($params)
Applies marc merge rules to a record.
@ -3299,30 +3304,28 @@ fields with this field tag from C<record>.
=cut
sub ApplyMarcMergeRules {
sub ApplyMarcOverlayRules {
my ($params) = @_;
my $biblionumber = $params->{biblionumber};
my $incoming_record = $params->{record};
if (!$biblionumber) {
carp 'ApplyMarcMergeRules called on undefined biblionumber';
carp 'ApplyMarcOverlayRules called on undefined biblionumber';
return;
}
if (!$incoming_record) {
carp 'ApplyMarcMergeRules called on undefined record';
carp 'ApplyMarcOverlayRules called on undefined record';
return;
}
my $old_record = GetMarcBiblio({ biblionumber => $biblionumber });
# Skip merge rules if called with no context
# Skip overlay rules if called with no context
if ($old_record && defined $params->{context}) {
return Koha::MarcMergeRules->merge_records($old_record, $incoming_record, $params->{context});
return Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $params->{context});
}
return $incoming_record;
}
1;
=head2 _after_biblio_action_hooks
Helper method that takes care of calling all plugin hooks
@ -3346,6 +3349,8 @@ sub _after_biblio_action_hooks {
);
}
1;
__END__
=head1 AUTHOR

View File

@ -1,4 +1,4 @@
package Koha::Exceptions::MarcMergeRule;
package Koha::Exceptions::MarcOverlayRule;
# This file is part of Koha.
#
@ -19,34 +19,34 @@ use Modern::Perl;
use Exception::Class (
'Koha::Exceptions::MarcMergeRule' => {
'Koha::Exceptions::MarcOverlayRule' => {
description => 'Something went wrong!',
},
'Koha::Exceptions::MarcMergeRule::InvalidTagRegExp' => {
isa => 'Koha::Exceptions::MarcMergeRule',
'Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp' => {
isa => 'Koha::Exceptions::MarcOverlayRule',
description => 'Invalid regular expression for tag'
},
'Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions' => {
isa => 'Koha::Exceptions::MarcMergeRule',
'Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions' => {
isa => 'Koha::Exceptions::MarcOverlayRule',
description => 'Invalid control field actions'
}
);
=head1 NAME
Koha::Exceptions::MarcMergeRule - Base class for MarcMergeRule exceptions
Koha::Exceptions::MarcOverlayRule - Base class for MarcOverlayRule exceptions
=head1 Exceptions
=head2 Koha::Exceptions::MarcMergeRule
=head2 Koha::Exceptions::MarcOverlayRule
Generic MarcMergeRule exception
Generic MarcOverlayRule exception
=head2 Koha::Exceptions::MarcMergeRule::InvalidTagRegExp
=head2 Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp
Exception for rule validation when rule tag is an invalid regular expression
=head2 Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions
=head2 Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions
Exception for rule validation for control field rules with invalid combination of actions

View File

@ -1,58 +0,0 @@
package Koha::MarcMergeRule;
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Modern::Perl;
use parent qw(Koha::Object);
my $cache = Koha::Caches->get_instance();
=head1 NAME
Koha::MarcMergeRule - Koha MarcMergeRule Object class
=cut
=head2 store
Override C<store> to clear marc merge rules cache.
=cut
sub store {
my $self = shift @_;
$cache->clear_from_cache('marc_merge_rules');
$self->SUPER::store(@_);
}
=head2 delete
Override C<delete> to clear marc merge rules cache.
=cut
sub delete {
my $self = shift @_;
$cache->clear_from_cache('marc_merge_rules');
$self->SUPER::delete(@_);
}
sub _type {
return 'MarcMergeRule';
}
1;

58
Koha/MarcOverlayRule.pm Normal file
View File

@ -0,0 +1,58 @@
package Koha::MarcOverlayRule;
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use parent qw(Koha::Object);
my $cache = Koha::Caches->get_instance();
=head1 NAME
Koha::MarcOverlayRule - Koha MarcOverlayRule Object class
=cut
=head2 store
Override C<store> to clear marc merge rules cache.
=cut
sub store {
my $self = shift @_;
$cache->clear_from_cache('marc_overlay_rules');
$self->SUPER::store(@_);
}
=head2 delete
Override C<delete> to clear marc merge rules cache.
=cut
sub delete {
my $self = shift @_;
$cache->clear_from_cache('marc_overlay_rules');
$self->SUPER::delete(@_);
}
sub _type {
return 'MarcOverlayRule';
}
1;

View File

@ -1,26 +1,26 @@
package Koha::MarcMergeRules;
package Koha::MarcOverlayRules;
# This file is part of Koha.
#
# Koha is free software; you can redistribute it and/or modify it under the
# terms of the GNU General Public License as published by the Free Software
# Foundation; either version 3 of the License, or (at your option) any later
# version.
# Koha is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# Koha is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
# A PARTICULAR PURPOSE. See the GNU General Public License for more details.
# Koha is distributed in the hope that it will be useful, but
# WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License along
# with Koha; if not, write to the Free Software Foundation, Inc.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
# You should have received a copy of the GNU General Public License
# along with Koha; if not, see <http://www.gnu.org/licenses>.
use Modern::Perl;
use List::Util qw(first);
use Koha::MarcMergeRule;
use Koha::MarcOverlayRule;
use Carp;
use Koha::Exceptions::MarcMergeRule;
use Koha::Exceptions::MarcOverlayRule;
use Try::Tiny;
use Scalar::Util qw(looks_like_number);
@ -30,11 +30,11 @@ my $cache = Koha::Caches->get_instance();
=head1 NAME
Koha::MarcMergeRules - Koha MarcMergeRules Object set class
Koha::MarcOverlayRules - Koha MarcOverlayRules Object set class
=head1 API
=head2 Class Methods
=head2 Class methods
=head3 operations
@ -48,9 +48,9 @@ sub operations {
=head3 context_rules
my $rules = Koha::MarcMergeRules->context_rules($context);
my $rules = Koha::MarcOverlayRules->context_rules($context);
Gets all MARC merge rules for the supplied C<$context> (hashref with { module => filter, ... } values).
Gets all MARC overlay rules for the supplied C<$context> (hashref with { module => filter, ... } values).
=cut
@ -59,7 +59,7 @@ sub context_rules {
return unless %{$context};
my $rules = $cache->get_from_cache('marc_merge_rules', { unsafe => 1 });
my $rules = $cache->get_from_cache('marc_overlay_rules', { unsafe => 1 });
if (!$rules) {
$rules = {};
@ -93,7 +93,7 @@ sub context_rules {
push @{$regexps}, [$rule{tag}, $operations];
}
}
$cache->set_in_cache('marc_merge_rules', $rules);
$cache->set_in_cache('marc_overlay_rules', $rules);
}
my $context_rules = undef;
@ -120,9 +120,9 @@ sub context_rules {
=head3 merge_records
my $merged_record = Koha::MarcMergeRules->merge_records($old_record, $incoming_record, $context);
my $merged_record = Koha::MarcOverlayRules->merge_records($old_record, $incoming_record, $context);
Merge C<$old_record> with C<$incoming_record> applying merge rules for C<$context>.
Overlay C<$old_record> with C<$incoming_record> applying overlay rules for C<$context>.
Returns merged record C<$merged_record>. C<$old_record>, C<$incoming_record> and
C<$merged_record> are all MARC::Record objects.
@ -289,12 +289,12 @@ sub merge_records {
}
sub _clear_caches {
$cache->clear_from_cache('marc_merge_rules');
$cache->clear_from_cache('marc_overlay_rules');
}
=head2 find_or_create
Override C<find_or_create> to clear marc merge rules cache.
Override C<find_or_create> to clear marc overlay rules cache.
=cut
@ -306,7 +306,7 @@ sub find_or_create {
=head2 update
Override C<update> to clear marc merge rules cache.
Override C<update> to clear marc overlay rules cache.
=cut
@ -318,7 +318,7 @@ sub update {
=head2 delete
Override C<delete> to clear marc merge rules cache.
Override C<delete> to clear marc overlay rules cache.
=cut
@ -330,11 +330,11 @@ sub delete {
=head2 validate
Koha::MarcMergeRules->validate($rule_data);
Koha::MarcOverlayRules->validate($rule_data);
Validates C<$rule_data>. Throws C<Koha::Exceptions::MarcMergeRule::InvalidTagRegExp>
Validates C<$rule_data>. Throws C<Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp>
if C<$rule_data->{tag}> contains an invalid regular expression. Throws
C<Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions> if contains invalid
C<Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions> if contains invalid
combination of actions for control fields. Otherwise returns true.
=cut
@ -346,7 +346,7 @@ sub validate {
if ($rule_data->{tag} ne '*') {
eval { qr/$rule_data->{tag}/ };
if ($@) {
Koha::Exceptions::MarcMergeRule::InvalidTagRegExp->throw(
Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp->throw(
"Invalid tag regular expression"
);
}
@ -358,7 +358,7 @@ sub validate {
$rule_data->{append} &&
!$rule_data->{remove}
) {
Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions->throw(
Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions->throw(
"Combination of allow append and skip remove not permitted for control fields"
);
}
@ -367,7 +367,7 @@ sub validate {
}
sub _type {
return 'MarcMergeRule';
return 'MarcOverlayRule';
}
=head3 object_class
@ -375,7 +375,7 @@ sub _type {
=cut
sub object_class {
return 'Koha::MarcMergeRule';
return 'Koha::MarcOverlayRule';
}
1;

View File

@ -25,20 +25,16 @@ use Try::Tiny;
# Koha modules used
use C4::Context;
use C4::Koha;
use C4::Auth;
use C4::AuthoritiesMarc;
use C4::Output;
use C4::Biblio;
use C4::Auth qw( get_template_and_user );
use C4::Output qw( output_html_with_http_headers );
use C4::ImportBatch;
use C4::Matcher;
use C4::BackgroundJob;
use C4::Labels::Batch;
use Koha::MarcMergeRules;
use Koha::MarcMergeRule;
use Koha::Patron::Categories; # TODO: Required? Try without use
use Koha::MarcOverlayRules;
use Koha::Patron::Categories;
my $script_name = "/cgi-bin/koha/admin/marc-merge-rules.pl";
my $script_name = "/cgi-bin/koha/admin/marc-overlay-rules.pl";
my $input = new CGI;
my $op = $input->param('op') || '';
@ -67,11 +63,11 @@ my $rule_from_cgi = sub {
my ($template, $loggedinuser, $cookie) = get_template_and_user(
{
template_name => "admin/marc-merge-rules.tt",
template_name => "admin/marc-overlay-rules.tt",
query => $input,
type => "intranet",
authnotrequired => 0,
flagsrequired => { parameters => 'manage_marc_merge_rules' },
flagsrequired => { parameters => 'manage_marc_overlay_rules' },
debug => 1,
}
);
@ -83,7 +79,7 @@ our $sessionID = $cookies{'CGISESSID'}->value;
my $get_rules = sub {
# TODO: order?
return [map { { $_->get_columns() } } Koha::MarcMergeRules->_resultset->all];
return [map { { $_->get_columns() } } Koha::MarcOverlayRules->_resultset->all];
};
my $rules;
@ -101,7 +97,7 @@ if ($op eq 'remove' || $op eq 'doremove') {
elsif ($op eq 'doremove') {
my @remove_ids = $input->multi_param('batchremove');
push @remove_ids, scalar $input->param('id') if $input->param('id');
Koha::MarcMergeRules->search({ id => { in => \@remove_ids } })->delete();
Koha::MarcOverlayRules->search({ id => { in => \@remove_ids } })->delete();
$rules = $get_rules->();
}
}
@ -120,19 +116,19 @@ elsif ($op eq 'doedit' || $op eq 'add') {
my $rule_data = $rule_from_cgi->($input);
if (!@{$errors}) {
try {
Koha::MarcMergeRules->validate($rule_data);
Koha::MarcOverlayRules->validate($rule_data);
}
catch {
die $_ unless blessed $_ && $_->can('rethrow');
if ($_->isa('Koha::Exceptions::MarcMergeRule::InvalidTagRegExp')) {
if ($_->isa('Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp')) {
push @{$errors}, {
type => 'error',
code => 'invalid_tag_regexp',
tag => $rule_data->{tag},
};
}
elsif ($_->isa('Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions')) {
elsif ($_->isa('Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions')) {
push @{$errors}, {
type => 'error',
code => 'invalid_control_field_actions',
@ -144,7 +140,7 @@ elsif ($op eq 'doedit' || $op eq 'add') {
}
};
if (!@{$errors}) {
my $rule = Koha::MarcMergeRules->find_or_create($rule_data);
my $rule = Koha::MarcOverlayRules->find_or_create($rule_data);
# Need to call set and store here in case we have an update
$rule->set($rule_data);
$rule->store();

View File

@ -1,41 +1,51 @@
$DBversion = 'XXX'; # will be replaced by the RM
if( CheckVersion( $DBversion ) ) {
my $sql = q{
CREATE TABLE IF NOT EXISTS `marc_merge_rules` (
`id` int(11) NOT NULL auto_increment,
`tag` varchar(255) NOT NULL,
`module` varchar(127) NOT NULL,
`filter` varchar(255) NOT NULL,
`add` tinyint NOT NULL,
`append` tinyint NOT NULL,
`remove` tinyint NOT NULL,
`delete` tinyint NOT NULL,
PRIMARY KEY(`id`)
);
};
$dbh->do( $sql );
$DBversion = 'XXX'; # will be replaced by the RM
if ( CheckVersion($DBversion) ) {
$sql = q{
unless (TableExists('marc_overlay_rules_modules')) {
$dbh->do(q{
CREATE TABLE `marc_overlay_rules_modules` (
`name` varchar(127) NOT NULL,
`description` varchar(255),
`specificity` int(11) NOT NULL UNIQUE,
PRIMARY KEY(`name`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
unless ( TableExists('marc_overlay_rules') ) {
$dbh->do(q{
CREATE TABLE IF NOT EXISTS `marc_overlay_rules` (
`id` int(11) NOT NULL auto_increment,
`tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
`module` varchar(127) NOT NULL,
`filter` varchar(255) NOT NULL,
`add` TINYINT(1) NOT NULL DEFAULT 0,
`append` TINYINT(1) NOT NULL DEFAULT 0,
`remove` TINYINT(1) NOT NULL DEFAULT 0,
`delete` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
CONSTRAINT `marc_overlay_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_overlay_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
});
}
$dbh->do(q{
INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES (
'MARCMergeRules',
'MARCOverlayRules',
'0',
NULL,
'Use the MARC merge rules system to decide what actions to take for each field when modifying records.',
'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.',
'YesNo'
);
};
$dbh->do( $sql );
});
$sql = q{
$dbh->do(q{
INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (
3,
'manage_marc_merge_rules',
'Manage MARC merge rules configuration'
'manage_marc_overlay_rules',
'Manage MARC overlay rules configuration'
);
};
$dbh->do( $sql );
});
# Always end with this (adjust the bug info)
SetVersion( $DBversion );
print "Upgrade to $DBversion done (Bug 14957 - Write protecting MARC fields based on source of import)\n";
NewVersion( $DBversion, 14957, "Add a way to define overlay rules for incoming MARC records)\n" );
}

View File

@ -3386,11 +3386,11 @@ CREATE TABLE `marc_matchers` (
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `marc_merge_rules_modules`
-- Table structure for table `marc_overlay_rules_modules`
--
DROP TABLE IF EXISTS `marc_merge_rules_modules`;
CREATE TABLE `marc_merge_rules_modules` (
DROP TABLE IF EXISTS `marc_overlay_rules_modules`;
CREATE TABLE `marc_overlay_rules_modules` (
`name` varchar(127) NOT NULL,
`description` varchar(255),
`specificity` int(11) NOT NULL UNIQUE,
@ -3398,22 +3398,22 @@ CREATE TABLE `marc_merge_rules_modules` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `marc_merge_rules`
-- Table structure for table `marc_overlay_rules`
--
DROP TABLE IF EXISTS `marc_merge_rules`;
CREATE TABLE IF NOT EXISTS `marc_merge_rules` (
`id` int(11) NOT NULL auto_increment,
`tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
DROP TABLE IF EXISTS `marc_overlay_rules`;
CREATE TABLE IF NOT EXISTS `marc_overlay_rules` (
`id` int(11) NOT NULL auto_increment,
`tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
`module` varchar(127) NOT NULL,
`filter` varchar(255) NOT NULL,
`add` tinyint NOT NULL,
`append` tinyint NOT NULL,
`remove` tinyint NOT NULL,
`delete` tinyint NOT NULL,
`add` TINYINT(1) NOT NULL DEFAULT 0,
`append` TINYINT(1) NOT NULL DEFAULT 0,
`remove` TINYINT(1) NOT NULL DEFAULT 0,
`delete` TINYINT(1) NOT NULL DEFAULT 0,
PRIMARY KEY(`id`),
CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
);
CONSTRAINT `marc_overlay_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_overlay_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
--
-- Table structure for table `marc_modification_template_actions`

View File

@ -331,9 +331,9 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `
('MarcFieldForModifierName','',NULL,'Where to store the name of the record''s last modifier','Free'),
('MarcFieldsToOrder','',NULL,'Set the mapping values for a new order line created from a MARC record in a staged file. In a YAML format.','textarea'),
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
('MARCMergeRules','0',NULL,'Use the MARC merge rules system to decide what actions to take for each field when modifying records.','YesNo'),
('MarkLostItemsAsReturned','batchmod,moredetail,cronjob,additem,pendingreserves,onpayment','claim_returned|batchmod|moredetail|cronjob|additem|pendingreserves|onpayment','Mark items as returned when flagged as lost','multiple'),
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
('MARCOverlayRules','0',NULL,'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.','YesNo'),
('MaxFine',NULL,'','Maximum fine a patron can have for all late returns at one moment. Single item caps are specified in the circulation rules matrix.','Integer'),
('MaxItemsToDisplayForBatchDel','1000',NULL,'Display up to a given number of items in a single item deletionbatch.','Integer'),
('MaxItemsToDisplayForBatchMod','1000',NULL,'Display up to a given number of items in a single item modification batch.','Integer'),

View File

@ -25,7 +25,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES
( 3, 'manage_oai_sets', 'Manage OAI sets'),
( 3, 'manage_item_search_fields', 'Manage item search fields'),
( 3, 'manage_search_engine_config', 'Manage search engine configuration'),
( 3, 'manage_marc_merge_rules', 'Manage MARC merge rules configuration'),
( 3, 'manage_marc_overlay_rules', 'Manage MARC overlay rules configuration'),
( 3, 'manage_search_targets', 'Manage Z39.50 and SRU server configuration'),
( 3, 'manage_didyoumean', 'Manage Did you mean? configuration'),
( 3, 'manage_column_config', 'Manage column configuration'),

View File

@ -100,8 +100,8 @@
[% IF ( CAN_user_parameters_manage_search_engine_config ) %]
<li><a href="/cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl">Search engine configuration (Elasticsearch)</a></li>
[% END %]
[% IF ( CAN_user_parameters_manage_marc_merge_rules ) %]
<li><a href="/cgi-bin/koha/admin/marc-merge-rules.pl">MARC merge rules</a></li>
[% IF ( CAN_user_parameters_manage_marc_overlay_rules ) %]
<li><a href="/cgi-bin/koha/admin/marc-overlay-rules.pl">MARC overlay rules</a></li>
[% END %]
</ul>
[% END %]

View File

@ -210,9 +210,9 @@
Manage search engine configuration
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'manage_marc_merge_rules' -%]
<span class="sub_permission manage_marc_merge_rules_subpermission">
Manage MARC merge rules configuration
[%- CASE 'manage_marc_overlay_rules' -%]
<span class="sub_permission manage_marc_overlay_rules_subpermission">
Manage MARC overlay rules configuration
</span>
<span class="permissioncode">([% name | html %])</span>
[%- CASE 'manage_search_targets' -%]

View File

@ -192,8 +192,8 @@
<dt><a href="/cgi-bin/koha/admin/searchengine/elasticsearch/mappings.pl">Search engine configuration (Elasticsearch)</a></dt>
<dd>Manage indexes, facets, and their mappings to MARC fields and subfields</dd>
[% END %]
<dt><a href="/cgi-bin/koha/admin/marc-merge-rules.pl">MARC merge rules</a></dt>
<dd>Managed MARC field merge rules</dd>
<dt><a href="/cgi-bin/koha/admin/marc-overlay-rules.pl">MARC overlay rules</a></dt>
<dd>Managed MARC field overlay rules</dd>
</dl>
[% END %]

View File

@ -1,6 +1,6 @@
[% USE Koha %]
[% INCLUDE 'doc-head-open.inc' %]
<title>Koha &rsaquo; Administration &rsaquo; MARC merge rules</title>
<title>Koha &rsaquo; Administration &rsaquo; MARC overlay rules</title>
[% INCLUDE 'doc-head-close.inc' %]
[% Asset.css("css/datatables.css") %]
[% INCLUDE 'datatables.inc' %]
@ -16,20 +16,20 @@ function doSubmit(op, id) {
$('<input type="hidden"/>')
.attr('name', 'op')
.attr('value', op)
.appendTo('#marc-merge-rules-form');
.appendTo('#marc-overlay-rules-form');
if(id) {
$('<input type="hidden"/>')
.attr('name', 'id')
.attr('value', id)
.appendTo('#marc-merge-rules-form');
.appendTo('#marc-overlay-rules-form');
}
var valid = true;
if (op == 'add' || op == 'edit') {
var validate = [
$('#marc-merge-rules-form input[name="filter"]'),
$('#marc-merge-rules-form input[name="tag"]')
$('#marc-overlay-rules-form input[name="filter"]'),
$('#marc-overlay-rules-form input[name="tag"]')
];
for(var i = 0; i < validate.length; i++) {
if (validate[i].length) {
@ -44,7 +44,7 @@ function doSubmit(op, id) {
}
if (valid) {
$('#marc-merge-rules-form').submit();
$('#marc-overlay-rules-form').submit();
}
return valid;
@ -87,7 +87,7 @@ $(document).ready(function(){
});
}
$('#marc-merge-rules').dataTable($.extend(true, {}, dataTablesDefaults, {
$('#marc-overlay-rules').dataTable($.extend(true, {}, dataTablesDefaults, {
"aoColumns": [
{"bSearchable": false, "bSortable": false},
{"sSortDataType": "dom-input"},
@ -104,56 +104,56 @@ $(document).ready(function(){
"pagingType": "simple"
}));
var merge_rules_presets = {};
merge_rules_presets[_("Protect")] = {
var overlay_rules_presets = {};
overlay_rules_presets[_("Protect")] = {
'add': 0,
'append': 0,
'remove': 0,
'delete': 0
};
merge_rules_presets[_("Overwrite")] = {
overlay_rules_presets[_("Overwrite")] = {
'add': 1,
'append': 1,
'remove': 1,
'delete': 1
};
merge_rules_presets[_("Add new")] = {
overlay_rules_presets[_("Add new")] = {
'add': 1,
'append': 0,
'remove': 0,
'delete': 0
};
merge_rules_presets[_("Add and append")] = {
overlay_rules_presets[_("Add and append")] = {
'add': 1,
'append': 1,
'remove': 0,
'delete': 0
};
merge_rules_presets[_("Protect from deletion")] = {
overlay_rules_presets[_("Protect from deletion")] = {
'add': 1,
'append': 1,
'remove': 1,
'delete': 0
};
var merge_rules_label_to_value = {};
merge_rules_label_to_value[_("Add")] = 1;
merge_rules_label_to_value[_("Append")] = 1;
merge_rules_label_to_value[_("Remove")] = 1;
merge_rules_label_to_value[_("Delete")] = 1;
merge_rules_label_to_value[_("Skip")] = 0;
var overlay_rules_label_to_value = {};
overlay_rules_label_to_value[_("Add")] = 1;
overlay_rules_label_to_value[_("Append")] = 1;
overlay_rules_label_to_value[_("Remove")] = 1;
overlay_rules_label_to_value[_("Delete")] = 1;
overlay_rules_label_to_value[_("Skip")] = 0;
function hash_config(config) {
return JSON.stringify(config, Object.keys(config).sort());
}
var merge_rules_preset_map = {};
$.each(merge_rules_presets, function(preset, config) {
merge_rules_preset_map[hash_config(config)] = preset;
var overlay_rules_preset_map = {};
$.each(overlay_rules_presets, function(preset, config) {
overlay_rules_preset_map[hash_config(config)] = preset;
});
function operations_config_merge_rule_preset(config) {
return merge_rules_preset_map[hash_config(config)] || '';
function operations_config_overlay_rule_preset(config) {
return overlay_rules_preset_map[hash_config(config)] || '';
}
/* Set preset values according to operation config */
@ -162,10 +162,10 @@ $(document).ready(function(){
var operations_config = {};
$('.rule-operation-action', $this).each(function() {
var $operation = $(this);
operations_config[$operation.data('operation')] = merge_rules_label_to_value[$operation.text()];
operations_config[$operation.data('operation')] = overlay_rules_label_to_value[$operation.text()];
});
$('.rule-preset', $this).text(
operations_config_merge_rule_preset(operations_config) || _("Custom")
operations_config_overlay_rule_preset(operations_config) || _("Custom")
);
});
@ -178,7 +178,7 @@ $(document).ready(function(){
operations_config[$this.attr('name')] = parseInt($this.val());
});
$('select[name="preset"]', $parent_row).val(
operations_config_merge_rule_preset(operations_config)
operations_config_overlay_rule_preset(operations_config)
);
});
@ -188,7 +188,7 @@ $(document).ready(function(){
var $parent_row = $this.closest('tr');
var preset = $this.val();
if (preset) {
$.each(merge_rules_presets[preset], function(operation, action) {
$.each(overlay_rules_presets[preset], function(operation, action) {
$('select[name="' + operation + '"]', $parent_row).val(action);
});
}
@ -264,19 +264,19 @@ $(document).ready(function(){
});
</script>
</head>
<body id="admin_marc-merge-rules" class="admin">
<body id="admin_marc-overlay-rules" class="admin">
[% INCLUDE 'header.inc' %]
[% INCLUDE 'cat-search.inc' %]
<div id="breadcrumbs"><a href="/cgi-bin/koha/mainpage.pl">Home</a> &rsaquo; <a href="/cgi-bin/koha/admin/admin-home.pl">Administration</a>
&rsaquo; MARC merge rules
&rsaquo; MARC overlay rules
</div>
<div class="main container-fluid">
<div class="row">
<div class="col-sm-10 col-sm-push-2">
<h1>Manage MARC merge rules</h1>
<h1>Manage MARC overlay rules</h1>
[% FOR m IN messages %]
<div class="dialog [% m.type | html %]">
@ -291,9 +291,9 @@ $(document).ready(function(){
</div>
[% END %]
[% UNLESS Koha.Preference( 'MARCMergeRules' ) %]
[% UNLESS Koha.Preference( 'MARCOverlayRules' ) %]
<div class="dialog message">
The <b>MARCMergeRules</b> preference is not set, don't forget to enable it for rules to take effect.
The <b>MARCOverlayRules</b> preference is not set, don't forget to enable it for rules to take effect.
</div>
[% END %]
[% IF removeConfirm %]
@ -308,8 +308,8 @@ $(document).ready(function(){
</div>
[% END %]
<form action="[% script_name %]" method="POST" id="marc-merge-rules-form">
<table id="marc-merge-rules">
<form action="[% script_name %]" method="POST" id="marc-overlay-rules-form">
<table id="marc-overlay-rules">
<thead><tr>
<th>Rule</th>
<th>Module</th>

View File

@ -299,7 +299,12 @@ Cataloging:
1: "do"
0: "don't"
- attempt to match aggressively by trying all variations of the ISSNs in the imported record as a phrase in the ISSN fields of already cataloged records.
-
- pref: MARCOverlayRules
choices:
1: "Use"
0: "Don't use"
- MARC overlay rules for incoming records, to decide which action to take for each field.
Exporting:
-
- "Include the following fields when exporting BibTeX:"
@ -325,10 +330,3 @@ Cataloging:
- "All values of repeating tags and subfields will be printed with the given RIS tag."
- "<br/>"
- "Use of TY ( record type ) as a key will <em>replace</em> the default TY with the field value of your choosing."
-
- When importing records
- pref: MARCMergeRules
choices:
yes: "use"
no: "don't use"
- MARC merge rules to decide which action to take for each field.

View File

@ -21,20 +21,20 @@ use Try::Tiny;
use MARC::Record;
use C4::Context;
use C4::Biblio;
use Koha::Database; #??
use C4::Biblio qw( AddBiblio ModBiblio DelBiblio GetMarcBiblio );
use Koha::Database;
use Test::More tests => 23;
use Test::MockModule;
use Koha::MarcMergeRules;
use Koha::MarcOverlayRules;
use t::lib::Mocks;
my $schema = Koha::Database->schema;
$schema->storage->txn_begin;
t::lib::Mocks::mock_preference('MARCMergeRules', '1');
t::lib::Mocks::mock_preference('MARCOverlayRules', '1');
# Create a record
my $orig_record = MARC::Record->new();
@ -54,11 +54,11 @@ $incoming_record->append_fields(
MARC::Field->new('501', '', '', 'a' => 'Two cold bottles of beer in the fridge'), # Added
);
# Test default behavior when MARCMergeRules is enabled, but no rules defined (overwrite)
# Test default behavior when MARCOverlayRules is enabled, but no rules defined (overwrite)
subtest 'Record fields has been overwritten when no merge rules are defined' => sub {
plan tests => 4;
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
@ -79,7 +79,7 @@ subtest 'Record fields has been overwritten when no merge rules are defined' =>
);
};
my $rule = Koha::MarcMergeRules->find_or_create({
my $rule = Koha::MarcOverlayRules->find_or_create({
tag => '*',
module => 'source',
filter => '*',
@ -92,7 +92,7 @@ my $rule = Koha::MarcMergeRules->find_or_create({
subtest 'Record fields has been protected when matched merge all rule operations are set to "0"' => sub {
plan tests => 3;
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 3, "Record has the expected number of fields");
@ -122,7 +122,7 @@ subtest 'Only new fields has been added when add = 1, append = 0, remove = 0, de
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 5, "Record has the expected number of fields");
@ -159,7 +159,7 @@ subtest 'Only appended fields has been added when add = 0, append = 1, remove =
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 4, "Record has the expected number of fields");
@ -191,7 +191,7 @@ subtest 'Appended and added fields has been added when add = 1, append = 1, remo
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 6, "Record has the expected number of fields");
@ -228,7 +228,7 @@ subtest 'Record fields has been only removed when add = 0, append = 0, remove =
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 2, "Record has the expected number of fields");
@ -258,7 +258,7 @@ subtest 'Record fields has been added and removed when add = 1, append = 0, remo
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 4, "Record has the expected number of fields");
@ -294,7 +294,7 @@ subtest 'Record fields has been appended and removed when add = 0, append = 1, r
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 3, "Record has the expected number of fields");
@ -324,7 +324,7 @@ subtest 'Record fields has been added, appended and removed when add = 0, append
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 5, "Record has the expected number of fields");
@ -361,7 +361,7 @@ subtest 'Record fields has been deleted when add = 0, append = 0, remove = 0, de
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 2, "Record has the expected number of fields");
@ -386,7 +386,7 @@ subtest 'Record fields has been added and deleted when add = 1, append = 0, remo
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 4, "Record has the expected number of fields");
@ -417,7 +417,7 @@ subtest 'Record fields has been appended and deleted when add = 0, append = 1, r
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 3, "Record has the expected number of fields");
@ -442,7 +442,7 @@ subtest 'Record fields has been added, appended and deleted when add = 1, append
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 5, "Record has the expected number of fields");
@ -473,7 +473,7 @@ subtest 'Record fields has been removed and deleted when add = 0, append = 0, re
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 1, "Record has the expected number of fields");
@ -498,7 +498,7 @@ subtest 'Record fields has been added, removed and deleted when add = 1, append
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 3, "Record has the expected number of fields");
@ -529,7 +529,7 @@ subtest 'Record fields has been appended, removed and deleted when add = 0, appe
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
cmp_ok(scalar @all_fields, '==', 2, "Record has the expected number of fields");
@ -554,7 +554,7 @@ subtest 'Record fields has been overwritten when add = 1, append = 1, remove = 1
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
@ -578,7 +578,7 @@ subtest 'Record fields has been overwritten when add = 1, append = 1, remove = 1
# Test rule tag specificity
# Protect field 500 with more specific tag value
my $skip_all_rule = Koha::MarcMergeRules->find_or_create({
my $skip_all_rule = Koha::MarcOverlayRules->find_or_create({
tag => '500',
module => 'source',
filter => '*',
@ -591,7 +591,7 @@ my $skip_all_rule = Koha::MarcMergeRules->find_or_create({
subtest '"500" field has been protected when rule matching on tag "500" is add = 0, append = 0, remove = 0, delete = 0' => sub {
plan tests => 4;
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
@ -626,7 +626,7 @@ subtest '"5XX" fields has been protected when rule matching on regexp "5\d{2}" i
);
$skip_all_rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
@ -655,7 +655,7 @@ subtest 'Record fields has been overwritten when non wild card rule with filter
);
$rule->store();
my $merged_record = Koha::MarcMergeRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my $merged_record = Koha::MarcOverlayRules->merge_records($orig_record, $incoming_record, { 'source' => 'test' });
my @all_fields = $merged_record->fields();
@ -679,7 +679,7 @@ subtest 'Record fields has been overwritten when non wild card rule with filter
subtest 'An exception is thrown when append = 1, remove = 0 is set for control field rule' => sub {
plan tests => 2;
my $exception = try {
Koha::MarcMergeRules->validate({
Koha::MarcOverlayRules->validate({
'tag' => '008',
'append' => 1,
'remove' => 0,
@ -689,14 +689,14 @@ subtest 'An exception is thrown when append = 1, remove = 0 is set for control f
return $_;
};
ok(defined $exception, "Exception was caught");
ok($exception->isa('Koha::Exceptions::MarcMergeRule::InvalidControlFieldActions'), "Exception is of correct class");
ok($exception->isa('Koha::Exceptions::MarcOverlayRule::InvalidControlFieldActions'), "Exception is of correct class");
};
subtest 'An exception is thrown when rule tag is set to invalid regexp' => sub {
plan tests => 2;
my $exception = try {
Koha::MarcMergeRules->validate({
Koha::MarcOverlayRules->validate({
'tag' => '**'
});
}
@ -704,7 +704,7 @@ subtest 'An exception is thrown when rule tag is set to invalid regexp' => sub {
return $_;
};
ok(defined $exception, "Exception was caught");
ok($exception->isa('Koha::Exceptions::MarcMergeRule::InvalidTagRegExp'), "Exception is of correct class");
ok($exception->isa('Koha::Exceptions::MarcOverlayRule::InvalidTagRegExp'), "Exception is of correct class");
};
$skip_all_rule->delete();
@ -775,5 +775,3 @@ subtest 'context option in ModBiblio is handled correctly' => sub {
$rule->delete();
$schema->storage->txn_rollback;
1;