View | Details | Raw Unified | Return to bug 14956
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules-permissions.sql (-2 lines)
Lines 1-2 Link Here
1
INSERT INTO permissions (module_bit, code, description) VALUES
2
  ( 3, 'manage_marc_merge_rules', 'Manage MARC merge rules configuration');
(-)a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.perl (+56 lines)
Line 0 Link Here
1
$DBversion = 'XXX'; # will be replaced by the RM
2
if( CheckVersion( $DBversion ) ) {
3
    my $sql = q{
4
      CREATE TABLE IF NOT EXISTS `marc_merge_rules_modules` (
5
        `name` varchar(127) NOT NULL,
6
        `description` varchar(255),
7
        `specificity` int(11) NOT NULL UNIQUE,
8
        PRIMARY KEY(`name`)
9
      );
10
    };
11
    $dbh->do( $sql );
12
13
    $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0);" );
14
    $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1);" );
15
    $dbh->do( "INSERT IGNORE INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2);" );
16
17
    $sql = q{
18
      CREATE TABLE IF NOT EXISTS `marc_merge_rules` (
19
        `id` int(11) NOT NULL auto_increment,
20
        `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
21
        `module` varchar(127) NOT NULL,
22
        `filter` varchar(255) NOT NULL,
23
        `add` tinyint NOT NULL,
24
        `append` tinyint NOT NULL,
25
        `remove` tinyint NOT NULL,
26
        `delete` tinyint NOT NULL,
27
        PRIMARY KEY(`id`),
28
        CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
29
      );
30
    };
31
    $dbh->do( $sql );
32
33
    $sql = q{
34
      INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type`) VALUES (
35
        'MARCMergeRules',
36
        '0',
37
        NULL,
38
        'Use the MARC merge rules system to decide what actions to take for each field when modifying records.',
39
        'YesNo'
40
      );
41
    };
42
    $dbh->do( $sql );
43
44
    $sql = q{
45
      INSERT IGNORE INTO permissions (module_bit, code, description) VALUES (
46
        3,
47
        'manage_marc_merge_rules',
48
        'Manage MARC merge rules configuration'
49
      );
50
    };
51
    $dbh->do( $sql );
52
53
    # Always end with this (adjust the bug info)
54
    SetVersion( $DBversion );
55
    print "Upgrade to $DBversion done (Bug 14957 - Write protecting MARC fields based on source of import)\n";
56
}
(-)a/installer/data/mysql/atomicupdate/bug_14957-marc-merge-rules.sql (-30 lines)
Lines 1-30 Link Here
1
DROP TABLE IF EXISTS `marc_merge_rules`;
2
DROP TABLE IF EXISTS `marc_merge_rules_modules`;
3
4
CREATE TABLE `marc_merge_rules_modules` (
5
    `name` varchar(127) NOT NULL,
6
    `description` varchar(255),
7
    `specificity` int(11) NOT NULL UNIQUE, -- higher specificity will override rules with lower specificity
8
    PRIMARY KEY(`name`)
9
);
10
11
-- a couple of useful default filter modules
12
-- these are used in various scripts, so don't remove them if you don't know
13
-- what you're doing.
14
-- New filter modules can be added here when needed
15
INSERT INTO `marc_merge_rules_modules` VALUES('source', 'source from where modification request was sent', 0);
16
INSERT INTO `marc_merge_rules_modules` VALUES('category', 'categorycode of user who requested modification', 1);
17
INSERT INTO `marc_merge_rules_modules` VALUES('borrower', 'borrowernumber of user who requested modification', 2);
18
19
CREATE TABLE IF NOT EXISTS `marc_merge_rules` (
20
    `id` int(11) NOT NULL auto_increment,
21
    `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
22
    `module` varchar(127) NOT NULL,
23
    `filter` varchar(255) NOT NULL,
24
    `add` tinyint NOT NULL,
25
    `append` tinyint NOT NULL,
26
    `remove` tinyint NOT NULL,
27
    `delete` tinyint NOT NULL,
28
    PRIMARY KEY(`id`),
29
    CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE
30
);
(-)a/installer/data/mysql/atomicupdate/bug_14957-merge-rules-syspref.sql (-1 lines)
Line 1 Link Here
1
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');
(-)a/installer/data/mysql/kohastructure.sql (+30 lines)
Lines 1160-1165 CREATE TABLE `marc_matchers` ( Link Here
1160
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1160
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1161
1161
1162
--
1162
--
1163
-- Table structure for table `marc_merge_rules_modules`
1164
--
1165
1166
DROP TABLE IF EXISTS `marc_merge_rules_modules`;
1167
CREATE TABLE `marc_merge_rules_modules` (
1168
  `name` varchar(127) NOT NULL,
1169
  `description` varchar(255),
1170
  `specificity` int(11) NOT NULL UNIQUE,
1171
  PRIMARY KEY(`name`)
1172
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
1173
1174
--
1175
-- Table structure for table `marc_merge_rules`
1176
--
1177
1178
DROP TABLE IF EXISTS `marc_merge_rules`;
1179
CREATE TABLE IF NOT EXISTS `marc_merge_rules` (
1180
  `id` int(11) NOT NULL auto_increment,
1181
  `tag` varchar(255) NOT NULL, -- can be regexp, so need > 3 chars
1182
  `module` varchar(127) NOT NULL,
1183
  `filter` varchar(255) NOT NULL,
1184
  `add` tinyint NOT NULL,
1185
  `append` tinyint NOT NULL,
1186
  `remove` tinyint NOT NULL,
1187
  `delete` tinyint NOT NULL,
1188
  PRIMARY KEY(`id`),
1189
  CONSTRAINT `marc_merge_rules_ibfk1` FOREIGN KEY (`module`) REFERENCES `marc_merge_rules_modules` (`name`) ON DELETE CASCADE ON UPDATE CASCADE
1190
);
1191
1192
--
1163
-- Table structure for table `matchpoints`
1193
-- Table structure for table `matchpoints`
1164
--
1194
--
1165
DROP TABLE IF EXISTS `matchpoints`;
1195
DROP TABLE IF EXISTS `matchpoints`;
(-)a/installer/data/mysql/sysprefs.sql (-1 / +1 lines)
Lines 289-294 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
289
('MarcFieldForModifierName','',NULL,'Where to store the name of the record''s last modifier','Free'),
289
('MarcFieldForModifierName','',NULL,'Where to store the name of the record''s last modifier','Free'),
290
('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'),
290
('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'),
291
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
291
('MarcItemFieldsToOrder','',NULL,'Set the mapping values for new item records created from a MARC record in a staged file. In a YAML format.','textarea'),
292
('MARCMergeRules','0',NULL,'Use the MARC merge rules system to decide what actions to take for each field when modifying records.','YesNo'),
292
('MarkLostItemsAsReturned','batchmod,moredetail,cronjob,additem,pendingreserves','batchmod|moredetail|cronjob|additem|pendingreserves','Mark items as returned when flagged as lost','multiple'),
293
('MarkLostItemsAsReturned','batchmod,moredetail,cronjob,additem,pendingreserves','batchmod|moredetail|cronjob|additem|pendingreserves','Mark items as returned when flagged as lost','multiple'),
293
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
294
('MARCOrgCode','OSt','','Define MARC Organization Code for MARC21 records - http://www.loc.gov/marc/organizations/orgshome.html','free'),
294
('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'),
295
('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'),
295
- 

Return to bug 14956