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

(-)a/installer/data/mysql/atomicupdate/bug_30708.pl (+112 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "30708",
5
    description => "Add a preservation module",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
        $dbh->do(q{
10
            INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type` )
11
            VALUES ('PreservationModule', '0', NULL, 'Enable the preservation module', 'YesNo')
12
        });
13
        say $out "Added new system preference 'PreservationModule'";
14
15
        $dbh->do(q{
16
            INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type` )
17
            VALUES ('PreservationNotForLoanWaitingListIn', '', '', 'Not for loan to apply to items added to the preservation waiting list', 'TextArea')
18
        });
19
        say $out "Added new system preference 'PreservationNotForLoanWaitingListIn'";
20
21
        $dbh->do(q{
22
            INSERT IGNORE INTO systempreferences (`variable`, `value`, `options`, `explanation`, `type` )
23
            VALUES ('PreservationNotForLoanDefaultTrainIn', '', '', 'Not for loan to apply to items removed from the preservation waiting list', 'TextArea')
24
        });
25
        say $out "Added new system preference 'PreservationNotForLoanDefaultTrainIn'";
26
27
        $dbh->do(q{
28
            INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton)
29
            VALUES (30, 'preservation', 'Manage preservation module', 0)
30
        });
31
        say $out "Added new permission 'preservation'";
32
33
        unless ( TableExists('preservation_processings') ) {
34
            $dbh->do(q{
35
                CREATE TABLE `preservation_processings` (
36
                  `processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
37
                  `name` varchar(80) NOT NULL COMMENT 'name of the processing',
38
                  PRIMARY KEY (`processing_id`)
39
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
40
            });
41
            say $out "Added new table 'preservation_processings'";
42
        }
43
44
        unless ( TableExists('preservation_trains') ) {
45
            $dbh->do(q{
46
                CREATE TABLE `preservation_trains` (
47
                  `train_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
48
                  `name` varchar(80) NOT NULL COMMENT 'name of the train',
49
                  `description` varchar(255) NULL COMMENT 'description of the train',
50
                  `default_processing_id` int(11) NULL COMMENT 'default processing, link to preservation_processings.processing_id',
51
                  `not_for_loan` varchar(80) NOT NULL DEFAULT 0 COMMENT 'NOT_LOAN authorised value to apply toitem added to this train',
52
                  `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'creation date',
53
                  `closed_on` datetime DEFAULT NULL COMMENT 'closing date',
54
                  `sent_on` datetime DEFAULT NULL COMMENT 'sending date',
55
                  `received_on` datetime DEFAULT NULL COMMENT 'receiving date',
56
                  PRIMARY KEY (`train_id`),
57
                  CONSTRAINT `preservation_trains_ibfk_1` FOREIGN KEY (`default_processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
58
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci
59
            });
60
            say $out "Added new table 'preservation_trains'";
61
        }
62
63
        unless ( TableExists('preservation_processing_attributes') ) {
64
            $dbh->do(q{
65
                CREATE TABLE `preservation_processing_attributes` (
66
                  `processing_attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
67
                  `processing_id` int(11) NOT NULL COMMENT 'link to the processing',
68
                  `name` varchar(80) NOT NULL COMMENT 'name of the processing attribute',
69
                  `type` enum('authorised_value', 'free_text', 'db_column') NOT NULL COMMENT 'Type of the processing attribute',
70
                  `option_source` varchar(80) NULL COMMENT 'source of the possible options for this attribute',
71
                  PRIMARY KEY (`processing_attribute_id`),
72
                  CONSTRAINT `preservation_processing_attributes_ibfk_1` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE CASCADE ON UPDATE CASCADE
73
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
74
            });
75
            say $out "Added new table 'preservation_processing_attributes'";
76
        }
77
78
        unless ( TableExists('preservation_trains_items') ) {
79
            $dbh->do(q{
80
                CREATE TABLE `preservation_trains_items` (
81
                  `train_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
82
                  `train_id` int(11) NOT NULL COMMENT 'link with preservation_train',
83
                  `item_id` int(11) NOT NULL COMMENT 'link with items',
84
                  `processing_id` int(11) NULL COMMENT 'specific processing for this item',
85
                  `user_train_item_id` int(11) NOT NULL COMMENT 'train item id for this train, starts from 1',
86
                  `added_on` datetime DEFAULT NULL COMMENT 'added date',
87
                  PRIMARY KEY (`train_item_id`),
88
                  UNIQUE KEY (`train_id`,`item_id`),
89
                  CONSTRAINT `preservation_item_ibfk_1` FOREIGN KEY (`train_id`) REFERENCES `preservation_trains` (`train_id`) ON DELETE CASCADE ON UPDATE CASCADE,
90
                  CONSTRAINT `preservation_item_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
91
                  CONSTRAINT `preservation_item_ibfk_3` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
92
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
93
            });
94
            say $out "Added new table 'preservation_trains_items'";
95
        }
96
97
        unless ( TableExists('preservation_processing_attributes_items') ) {
98
            $dbh->do(q{
99
                CREATE TABLE `preservation_processing_attributes_items` (
100
                  `processing_attribute_id` int(11) NOT NULL COMMENT 'link with preservation_processing_attributes',
101
                  `train_item_id` int(11) NOT NULL COMMENT 'link with preservation_trains_items',
102
                  `value` varchar(255) NULL COMMENT 'value for this attribute',
103
                  PRIMARY KEY (`processing_attribute_id`,`train_item_id`),
104
                  CONSTRAINT `preservation_processing_attributes_items_ibfk_1` FOREIGN KEY (`processing_attribute_id`) REFERENCES `preservation_processing_attributes` (`processing_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
105
                  CONSTRAINT `preservation_processing_attributes_items_ibfk_2` FOREIGN KEY (`train_item_id`) REFERENCES `preservation_trains_items` (`train_item_id`) ON DELETE CASCADE ON UPDATE CASCADE
106
                ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
107
            });
108
            say $out "Added new table 'preservation_processing_attributes_items'";
109
        }
110
111
    },
112
};
(-)a/installer/data/mysql/kohastructure.sql (+92 lines)
Lines 4763-4768 CREATE TABLE `plugin_methods` ( Link Here
4763
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4763
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4764
/*!40101 SET character_set_client = @saved_cs_client */;
4764
/*!40101 SET character_set_client = @saved_cs_client */;
4765
4765
4766
--
4767
-- Table structure for table `preservation_trains`
4768
--
4769
4770
DROP TABLE IF EXISTS `preservation_trains`;
4771
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4772
/*!40101 SET character_set_client = utf8 */;
4773
CREATE TABLE `preservation_trains` (
4774
  `train_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4775
  `name` varchar(80) NOT NULL COMMENT 'name of the train',
4776
  `description` varchar(255) NULL COMMENT 'description of the train',
4777
  `default_processing_id` int(11) NULL COMMENT 'default processing, link to preservation_processings.processing_id',
4778
  `not_for_loan` varchar(80) NOT NULL DEFAULT 0 COMMENT 'NOT_LOAN authorised value to apply toitem added to this train',
4779
  `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'creation date',
4780
  `closed_on` datetime DEFAULT NULL COMMENT 'closing date',
4781
  `sent_on` datetime DEFAULT NULL COMMENT 'sending date',
4782
  `received_on` datetime DEFAULT NULL COMMENT 'receiving date',
4783
  PRIMARY KEY (`train_id`),
4784
  CONSTRAINT `preservation_trains_ibfk_1` FOREIGN KEY (`default_processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4785
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4786
/*!40101 SET character_set_client = @saved_cs_client */;
4787
4788
--
4789
-- Table structure for table `preservation_processings`
4790
--
4791
4792
DROP TABLE IF EXISTS `preservation_processings`;
4793
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4794
/*!40101 SET character_set_client = utf8 */;
4795
CREATE TABLE `preservation_processings` (
4796
  `processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4797
  `name` varchar(80) NOT NULL COMMENT 'name of the processing',
4798
  PRIMARY KEY (`processing_id`)
4799
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4800
/*!40101 SET character_set_client = @saved_cs_client */;
4801
4802
--
4803
-- Table structure for table `preservation_processing_attributes`
4804
--
4805
4806
DROP TABLE IF EXISTS `preservation_processing_attributes`;
4807
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4808
/*!40101 SET character_set_client = utf8 */;
4809
CREATE TABLE `preservation_processing_attributes` (
4810
  `processing_attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4811
  `processing_id` int(11) NOT NULL COMMENT 'link to the processing',
4812
  `name` varchar(80) NOT NULL COMMENT 'name of the processing attribute',
4813
  `type` enum('authorised_value', 'free_text', 'db_column') NOT NULL COMMENT 'Type of the processing attribute',
4814
  `option_source` varchar(80) NULL COMMENT 'source of the possible options for this attribute',
4815
  PRIMARY KEY (`processing_attribute_id`),
4816
  CONSTRAINT `preservation_processing_attributes_ibfk_1` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE CASCADE ON UPDATE CASCADE
4817
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4818
/*!40101 SET character_set_client = @saved_cs_client */;
4819
4820
--
4821
-- Table structure for table `preservation_processing_attributes_items`
4822
--
4823
4824
DROP TABLE IF EXISTS `preservation_processing_attributes_items`;
4825
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4826
/*!40101 SET character_set_client = utf8 */;
4827
CREATE TABLE `preservation_processing_attributes_items` (
4828
  `processing_attribute_id` int(11) NOT NULL COMMENT 'link with preservation_processing_attributes',
4829
  `train_item_id` int(11) NOT NULL COMMENT 'link with preservation_trains_items',
4830
  `value` varchar(255) NULL COMMENT 'value for this attribute',
4831
  PRIMARY KEY (`processing_attribute_id`,`train_item_id`),
4832
  CONSTRAINT `preservation_processing_attributes_items_ibfk_1` FOREIGN KEY (`processing_attribute_id`) REFERENCES `preservation_processing_attributes` (`processing_attribute_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4833
  CONSTRAINT `preservation_processing_attributes_items_ibfk_2` FOREIGN KEY (`train_item_id`) REFERENCES `preservation_trains_items` (`train_item_id`) ON DELETE CASCADE ON UPDATE CASCADE
4834
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4835
/*!40101 SET character_set_client = @saved_cs_client */;
4836
4837
--
4838
-- Table structure for table `preservation_trains_items`
4839
--
4840
4841
DROP TABLE IF EXISTS `preservation_trains_items`;
4842
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4843
/*!40101 SET character_set_client = utf8 */;
4844
CREATE TABLE `preservation_trains_items` (
4845
  `train_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4846
  `train_id` int(11) NOT NULL COMMENT 'link with preservation_train',
4847
  `item_id` int(11) NOT NULL COMMENT 'link with items',
4848
  `processing_id` int(11) NULL COMMENT 'specific processing for this item',
4849
  `added_on` datetime DEFAULT NULL COMMENT 'added date',
4850
  PRIMARY KEY (`train_item_id`),
4851
  UNIQUE KEY (`train_id`,`item_id`),
4852
  CONSTRAINT `preservation_item_ibfk_1` FOREIGN KEY (`train_id`) REFERENCES `preservation_trains` (`train_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4853
  CONSTRAINT `preservation_item_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4854
  CONSTRAINT `preservation_item_ibfk_3` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4855
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4856
/*!40101 SET character_set_client = @saved_cs_client */;
4857
4766
--
4858
--
4767
-- Table structure for table `printers_profile`
4859
-- Table structure for table `printers_profile`
4768
--
4860
--
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+3 lines)
Lines 576-581 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
576
('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'),
576
('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'),
577
('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple'),
577
('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple'),
578
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
578
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
579
('PreservationModule', '0', NULL, 'Enable the preservation module', 'YesNo'),
580
('PreservationNotForLoanDefaultTrainIn', '', '', 'Not for loan to apply to items removed from the preservation waiting list', 'TextArea'),
581
('PreservationNotForLoanWaitingListIn', '', '', 'Not for loan to apply to items added to the preservation waiting list', 'TextArea'),
579
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
582
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
580
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
583
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
581
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
584
('PrintNoticesMaxLines','0','','If greater than 0, sets the maximum number of lines an overdue notice will print. If the number of items is greater than this number, the notice will end with a warning asking the borrower to check their online account for a full list of overdue items.','Integer'),
(-)a/installer/data/mysql/mandatory/userflags.sql (-2 / +2 lines)
Lines 26-30 INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES Link Here
26
(26, 'problem_reports', 'Manage problem reports', 0),
26
(26, 'problem_reports', 'Manage problem reports', 0),
27
(27, 'recalls', 'Recalls', 0),
27
(27, 'recalls', 'Recalls', 0),
28
(28, 'erm', 'Manage electronic resources', 0),
28
(28, 'erm', 'Manage electronic resources', 0),
29
(29, 'loggedinlibrary', 'Change logged in library', 0)
29
(29, 'loggedinlibrary', 'Change logged in library', 0),
30
(30, 'preservation', 'Preservation module', 0)
30
;
31
;
31
- 

Return to bug 30708