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 4764-4769 CREATE TABLE `plugin_methods` ( Link Here
4764
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4764
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4765
/*!40101 SET character_set_client = @saved_cs_client */;
4765
/*!40101 SET character_set_client = @saved_cs_client */;
4766
4766
4767
--
4768
-- Table structure for table `preservation_trains`
4769
--
4770
4771
DROP TABLE IF EXISTS `preservation_trains`;
4772
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4773
/*!40101 SET character_set_client = utf8 */;
4774
CREATE TABLE `preservation_trains` (
4775
  `train_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4776
  `name` varchar(80) NOT NULL COMMENT 'name of the train',
4777
  `description` varchar(255) NULL COMMENT 'description of the train',
4778
  `default_processing_id` int(11) NULL COMMENT 'default processing, link to preservation_processings.processing_id',
4779
  `not_for_loan` varchar(80) NOT NULL DEFAULT 0 COMMENT 'NOT_LOAN authorised value to apply toitem added to this train',
4780
  `created_on` timestamp NOT NULL DEFAULT current_timestamp() COMMENT 'creation date',
4781
  `closed_on` datetime DEFAULT NULL COMMENT 'closing date',
4782
  `sent_on` datetime DEFAULT NULL COMMENT 'sending date',
4783
  `received_on` datetime DEFAULT NULL COMMENT 'receiving date',
4784
  PRIMARY KEY (`train_id`),
4785
  CONSTRAINT `preservation_trains_ibfk_1` FOREIGN KEY (`default_processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4786
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4787
/*!40101 SET character_set_client = @saved_cs_client */;
4788
4789
--
4790
-- Table structure for table `preservation_processings`
4791
--
4792
4793
DROP TABLE IF EXISTS `preservation_processings`;
4794
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4795
/*!40101 SET character_set_client = utf8 */;
4796
CREATE TABLE `preservation_processings` (
4797
  `processing_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4798
  `name` varchar(80) NOT NULL COMMENT 'name of the processing',
4799
  PRIMARY KEY (`processing_id`)
4800
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4801
/*!40101 SET character_set_client = @saved_cs_client */;
4802
4803
--
4804
-- Table structure for table `preservation_processing_attributes`
4805
--
4806
4807
DROP TABLE IF EXISTS `preservation_processing_attributes`;
4808
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4809
/*!40101 SET character_set_client = utf8 */;
4810
CREATE TABLE `preservation_processing_attributes` (
4811
  `processing_attribute_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4812
  `processing_id` int(11) NOT NULL COMMENT 'link to the processing',
4813
  `name` varchar(80) NOT NULL COMMENT 'name of the processing attribute',
4814
  `type` enum('authorised_value', 'free_text', 'db_column') NOT NULL COMMENT 'Type of the processing attribute',
4815
  `option_source` varchar(80) NULL COMMENT 'source of the possible options for this attribute',
4816
  PRIMARY KEY (`processing_attribute_id`),
4817
  CONSTRAINT `preservation_processing_attributes_ibfk_1` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE CASCADE ON UPDATE CASCADE
4818
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4819
/*!40101 SET character_set_client = @saved_cs_client */;
4820
4821
--
4822
-- Table structure for table `preservation_processing_attributes_items`
4823
--
4824
4825
DROP TABLE IF EXISTS `preservation_processing_attributes_items`;
4826
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4827
/*!40101 SET character_set_client = utf8 */;
4828
CREATE TABLE `preservation_processing_attributes_items` (
4829
  `processing_attribute_id` int(11) NOT NULL COMMENT 'link with preservation_processing_attributes',
4830
  `train_item_id` int(11) NOT NULL COMMENT 'link with preservation_trains_items',
4831
  `value` varchar(255) NULL COMMENT 'value for this attribute',
4832
  PRIMARY KEY (`processing_attribute_id`,`train_item_id`),
4833
  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,
4834
  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
4835
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4836
/*!40101 SET character_set_client = @saved_cs_client */;
4837
4838
--
4839
-- Table structure for table `preservation_trains_items`
4840
--
4841
4842
DROP TABLE IF EXISTS `preservation_trains_items`;
4843
/*!40101 SET @saved_cs_client     = @@character_set_client */;
4844
/*!40101 SET character_set_client = utf8 */;
4845
CREATE TABLE `preservation_trains_items` (
4846
  `train_item_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key',
4847
  `train_id` int(11) NOT NULL COMMENT 'link with preservation_train',
4848
  `item_id` int(11) NOT NULL COMMENT 'link with items',
4849
  `processing_id` int(11) NULL COMMENT 'specific processing for this item',
4850
  `added_on` datetime DEFAULT NULL COMMENT 'added date',
4851
  PRIMARY KEY (`train_item_id`),
4852
  UNIQUE KEY (`train_id`,`item_id`),
4853
  CONSTRAINT `preservation_item_ibfk_1` FOREIGN KEY (`train_id`) REFERENCES `preservation_trains` (`train_id`) ON DELETE CASCADE ON UPDATE CASCADE,
4854
  CONSTRAINT `preservation_item_ibfk_2` FOREIGN KEY (`item_id`) REFERENCES `items` (`itemnumber`) ON DELETE CASCADE ON UPDATE CASCADE,
4855
  CONSTRAINT `preservation_item_ibfk_3` FOREIGN KEY (`processing_id`) REFERENCES `preservation_processings` (`processing_id`) ON DELETE SET NULL ON UPDATE CASCADE
4856
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
4857
/*!40101 SET character_set_client = @saved_cs_client */;
4858
4767
--
4859
--
4768
-- Table structure for table `printers_profile`
4860
-- Table structure for table `printers_profile`
4769
--
4861
--
(-)a/installer/data/mysql/mandatory/sysprefs.sql (+3 lines)
Lines 580-585 INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` Link Here
580
('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'),
580
('PhoneNotification','0',NULL,'If ON, enables generation of phone notifications to be sent by plugins','YesNo'),
581
('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple'),
581
('PrefillGuaranteeField', 'phone,email,streetnumber,address,city,state,zipcode,country', NULL, 'Prefill these fields in guarantee member entry form from guarantor patron record', 'Multiple'),
582
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
582
('PrefillItem','0','','When a new item is added, should it be prefilled with last created item values?','YesNo'),
583
('PreservationModule', '0', NULL, 'Enable the preservation module', 'YesNo'),
584
('PreservationNotForLoanDefaultTrainIn', '', '', 'Not for loan to apply to items removed from the preservation waiting list', 'TextArea'),
585
('PreservationNotForLoanWaitingListIn', '', '', 'Not for loan to apply to items added to the preservation waiting list', 'TextArea'),
583
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
586
('PreserveSerialNotes','1','','When a new "Expected" issue is generated, should it be prefilled with last created issue notes?','YesNo'),
584
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
587
('previousIssuesDefaultSortOrder','asc','asc|desc','Specify the sort order of Previous Issues on the circulation page','Choice'),
585
('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'),
588
('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