From aab18ba056000c27e89f84fdfb16388be77f44f1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 26 Oct 2021 15:49:59 +0200 Subject: [PATCH] Bug 14957: DBRev 21.06.00.038 Signed-off-by: Jonathan Druart --- Koha.pm | 2 +- .../bug_14957-marc-merge-rules.perl | 39 --------------- installer/data/mysql/db_revs/210600038.pl | 47 +++++++++++++++++++ 3 files changed, 48 insertions(+), 40 deletions(-) delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl create mode 100755 installer/data/mysql/db_revs/210600038.pl diff --git a/Koha.pm b/Koha.pm index e6db8c3daf..0c7943a2a7 100644 --- a/Koha.pm +++ b/Koha.pm @@ -29,7 +29,7 @@ use vars qw{ $VERSION }; # - #4 : the developer version. The 4th number is the database subversion. # used by developers when the database changes. updatedatabase take care of the changes itself # and is automatically called by Auth.pm when needed. -$VERSION = "21.06.00.037"; +$VERSION = "21.06.00.038"; sub version { return $VERSION; diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl deleted file mode 100644 index d61a8e2675..0000000000 --- a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl +++ /dev/null @@ -1,39 +0,0 @@ -$DBversion = 'XXX'; # will be replaced by the RM -if ( CheckVersion($DBversion) ) { - - 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`) - ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; - }); - } - - $dbh->do(q{ - INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ( - 'MARCOverlayRules', - '0', - NULL, - 'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.', - 'YesNo' - ); - }); - - $dbh->do(q{ - INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( - 3, - 'manage_marc_overlay_rules', - 'Manage MARC overlay rules configuration' - ); - }); - - NewVersion( $DBversion, 14957, "Add a way to define overlay rules for incoming MARC records)\n" ); -} diff --git a/installer/data/mysql/db_revs/210600038.pl b/installer/data/mysql/db_revs/210600038.pl new file mode 100755 index 0000000000..db6f5afd95 --- /dev/null +++ b/installer/data/mysql/db_revs/210600038.pl @@ -0,0 +1,47 @@ +use Modern::Perl; + +return { + bug_number => "14957", + description => "Add a way to define overlay rules for incoming MARC records", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + 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`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + + say $out "Added new table 'marc_overlay_rules'"; + } + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ( + 'MARCOverlayRules', + '0', + NULL, + 'Use the MARC record overlay rules system to decide what actions to take for each field when modifying records.', + 'YesNo' + ); + }); + say $out "Added new system preferences 'MARCOverlayRules'"; + + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( + 3, + 'manage_marc_overlay_rules', + 'Manage MARC overlay rules configuration' + ); + }); + say $out "Added new permissions 'manage_marc_overlay_rules'"; + }, +} -- 2.39.5