Bugzilla – Attachment 88203 Details for
Bug 14956
Remove C4::Dates from files opac/*.pl
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 14957: Put database updates in perl script
Bug-14957-Put-database-updates-in-perl-script.patch (text/plain), 8.96 KB, created by
David Gustafsson
on 2019-04-17 15:36:21 UTC
(
hide
)
Description:
Bug 14957: Put database updates in perl script
Filename:
MIME Type:
Creator:
David Gustafsson
Created:
2019-04-17 15:36:21 UTC
Size:
8.96 KB
patch
obsolete
>From 0c01ab1999b01df2ab50aab96e611611e5c41f44 Mon Sep 17 00:00:00 2001 >From: David Gustafsson <david.gustafsson@ub.gu.se> >Date: Fri, 12 Apr 2019 19:46:38 +0200 >Subject: [PATCH] Bug 14957: Put database updates in perl script > >Also add schema changes to kohastructure.sql and syspref to sysprefs.sql > >https://bugs.koha-community.org/show_bug.cgi?id=14956 >--- > .../bug_14957-marc-merge-rules-permissions.sql | 2 - > .../atomicupdate/bug_14957-marc-merge-rules.perl | 56 ++++++++++++++++++++++ > .../atomicupdate/bug_14957-marc-merge-rules.sql | 30 ------------ > .../atomicupdate/bug_14957-merge-rules-syspref.sql | 1 - > installer/data/mysql/kohastructure.sql | 30 ++++++++++++ > installer/data/mysql/sysprefs.sql | 1 + > 6 files changed, 87 insertions(+), 33 deletions(-) > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql > create mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql > delete mode 100644 installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql > >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql >deleted file mode 100644 >index 87739b558b..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql >+++ /dev/null >@@ -1,2 +0,0 @@ >-INSERT INTO permissions (module_bit, code, description) VALUES >- ( 3, 'manage_marc_merge_rules', 'Manage MARC merge rules configuration'); >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl >new file mode 100644 >index 0000000000..535f619c20 >--- /dev/null >+++ b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl >@@ -0,0 +1,56 @@ >+$DBversion = 'XXX'; # will be replaced by the RM >+if( CheckVersion( $DBversion ) ) { >+ my $sql = q{ >+ CREATE TABLE IF NOT EXISTS `marc_merge_rules_modules` ( >+ `name` varchar(127) NOT NULL, >+ `description` varchar(255), >+ `specificity` int(11) NOT NULL UNIQUE, >+ PRIMARY KEY(`name`) >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0);" ); >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1);" ); >+ $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2);" ); >+ >+ $sql = q{ >+ 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 >+ `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`), >+ CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $sql = q{ >+ INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES ( >+ 'MARCMergeRules', >+ '0', >+ NULL, >+ 'Use the MARC merge rules system to decide what actions to take for each field when modifying records.', >+ 'YesNo' >+ ); >+ }; >+ $dbh->do( $sql ); >+ >+ $sql = q{ >+ INSERT IGNORE INTO permissions (module_bit, code, description) VALUES ( >+ 3, >+ 'manage_marc_merge_rules', >+ 'Manage MARC merge 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"; >+} >diff --git a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql b/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql >deleted file mode 100644 >index 67554d7599..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql >+++ /dev/null >@@ -1,30 +0,0 @@ >-DROP TABLE IF EXISTS `marc_merge_rules`; >-DROP TABLE IF EXISTS `marc_merge_rules_modules`; >- >-CREATE TABLE `marc_merge_rules_modules` ( >- `name` varchar(127) NOT NULL, >- `description` varchar(255), >- `specificity` int(11) NOT NULL UNIQUE, -- higher specificity will override rules with lower specificity >- PRIMARY KEY(`name`) >-); >- >--- a couple of useful default filter modules >--- these are used in various scripts, so don't remove them if you don't know >--- what you're doing. >--- New filter modules can be added here when needed >-INSERT INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0); >-INSERT INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1); >-INSERT INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2); >- >-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 >- `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`), >- CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE >-); >diff --git a/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql b/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql >deleted file mode 100644 >index 5116c0a355..0000000000 >--- a/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql >+++ /dev/null >@@ -1 +0,0 @@ >-INSERT IGNORE INTO systempreferences ( `variable`, `value`, `options`, `explanation`, `type` ) VALUES ('MARCMergeRules','0','','Use the MARC merge rules system to decide what actions to take for each field when modifying records.','YesNo'); >diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql >index 6d7a4d28e1..f933aaac72 100644 >--- a/installer/data/mysql/kohastructure.sql >+++ b/installer/data/mysql/kohastructure.sql >@@ -1160,6 +1160,36 @@ CREATE TABLE `marc_matchers` ( > ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; > > -- >+-- Table structure for table `marc_merge_rules_modules` >+-- >+ >+DROP TABLE IF EXISTS `marc_merge_rules_modules`; >+CREATE TABLE `marc_merge_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; >+ >+-- >+-- Table structure for table `marc_merge_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 >+ `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`), >+ CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE >+); >+ >+-- > -- Table structure for table `matchpoints` > -- > DROP TABLE IF EXISTS `matchpoints`; >diff --git a/installer/data/mysql/sysprefs.sql b/installer/data/mysql/sysprefs.sql >index 0a983e35ef..ddc43f7617 100644 >--- a/installer/data/mysql/sysprefs.sql >+++ b/installer/data/mysql/sysprefs.sql >@@ -289,6 +289,7 @@ 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','batchmod|moredetail|cronjob|additem|pendingreserves','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'), > ('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'), >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14956
:
43123
|
43356
|
43357
|
43359
|
43362
|
43408
|
44352
|
44353
|
44518
|
44534
|
44593
|
44594
|
88203
|
88204