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