From 1a135e5e8cff30e910bd8a4a68496cf6ca62cade Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 11 Apr 2023 15:17:24 +0200 Subject: [PATCH] Bug 33105: DB changes Signed-off-by: Jonathan Field Signed-off-by: Marcel de Rooy Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_33105.pl | 45 +++++++++++++++++++ .../data/mysql/en/mandatory/auth_values.yml | 8 ++++ installer/data/mysql/kohastructure.sql | 19 ++++++++ .../data/mysql/mandatory/auth_val_cat.sql | 3 +- .../data/mysql/mandatory/userpermissions.sql | 1 + 5 files changed, 75 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33105.pl diff --git a/installer/data/mysql/atomicupdate/bug_33105.pl b/installer/data/mysql/atomicupdate/bug_33105.pl new file mode 100755 index 0000000000..96b73cb142 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33105.pl @@ -0,0 +1,45 @@ +use Modern::Perl; + +return { + bug_number => "33105", + description => "A vendor issues", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + # Do you stuffs here + unless (TableExists('aqbookseller_issues')) { + $dbh->do(q{ + CREATE TABLE `aqbookseller_issues` ( + `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor', + `type` varchar(80) DEFAULT NULL COMMENT "type of the issue, authorised value VENDOR_ISSUE_TYPE", + `started_on` date DEFAULT NULL COMMENT 'start of the issue', + `ended_on` date DEFAULT NULL COMMENT 'end of the issue', + `notes` longtext DEFAULT NULL COMMENT 'notes', + PRIMARY KEY (`issue_id`), + CONSTRAINT `aqbookseller_issues_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + say $out "Added new table 'aqbookseller_issues'"; + } + + $dbh->do(q{ + INSERT IGNORE INTO permissions (module_bit, code, description) VALUES + (11, 'issue_manage', 'Manage issues'); + }); + say $out "Added new permission 'acquisition.issue_manage'"; + + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories (category_name, is_system) + VALUES + ('VENDOR_ISSUE_TYPE', 1) + }); + $dbh->do(q{ + INSERT IGNORE INTO authorised_values (category, authorised_value, lib) + VALUES + ('VENDOR_ISSUE_TYPE', 'MAINTENANCE', 'Maintenance'), + ('VENDOR_ISSUE_TYPE', 'OUTAGE', 'Outage') + }); + say $out "Added new authorised value category 'VENDOR_ISSUE_TYPE'"; + }, +}; diff --git a/installer/data/mysql/en/mandatory/auth_values.yml b/installer/data/mysql/en/mandatory/auth_values.yml index e2f4003176..2f5ed23e9e 100644 --- a/installer/data/mysql/en/mandatory/auth_values.yml +++ b/installer/data/mysql/en/mandatory/auth_values.yml @@ -275,6 +275,14 @@ tables: authorised_value: "REPORTS" lib: "Reports" + - category: "VENDOR_ISSUE_TYPE" + authorised_value: "MAINTENANCE" + lib: "Maintenance" + + - category: "VENDOR_ISSUE_TYPE" + authorised_value: "OUTAGE" + lib: "Outage" + # Country codes - authorised_values: translatable: [ lib, lib_opac ] diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 5395e1f20c..83c647698b 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -466,6 +466,25 @@ CREATE TABLE `aqbooksellers` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `aqbookseller_issues` +-- + +DROP TABLE IF EXISTS `aqbookseller_issues`; +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8 */; +CREATE TABLE `aqbookseller_issues` ( + `issue_id` int(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key and unique identifier assigned by Koha', + `vendor_id` int(11) NOT NULL COMMENT 'link to the vendor', + `type` varchar(80) DEFAULT NULL COMMENT "type of the issue, authorised value VENDOR_ISSUE_TYPE", + `started_on` date DEFAULT NULL COMMENT 'start of the issue', + `ended_on` date DEFAULT NULL COMMENT 'end of the issue', + `notes` longtext DEFAULT NULL COMMENT 'notes', + PRIMARY KEY (`issue_id`), + CONSTRAINT `aqbookseller_issues_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE CASCADE ON UPDATE CASCADE +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; +/*!40101 SET character_set_client = @saved_cs_client */; + -- -- Table structure for table `aqbudgetborrowers` -- diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index 088017de93..6c20dd427a 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -21,7 +21,8 @@ INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) ('ROADTYPE', 0), ('AR_CANCELLATION', 0), ('VENDOR_TYPE', 1), - ('VENDOR_INTERFACE_TYPE', 1); + ('VENDOR_INTERFACE_TYPE', 1), + ('VENDOR_ISSUE_TYPE', 1); INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) VALUES diff --git a/installer/data/mysql/mandatory/userpermissions.sql b/installer/data/mysql/mandatory/userpermissions.sql index 63da567fb7..103c27accc 100644 --- a/installer/data/mysql/mandatory/userpermissions.sql +++ b/installer/data/mysql/mandatory/userpermissions.sql @@ -73,6 +73,7 @@ INSERT INTO permissions (module_bit, code, description) VALUES (11, 'planning_manage', 'Manage budget plannings'), (11, 'order_manage', 'Manage baskets and order lines'), (11, 'order_manage_all', 'Manage all baskets and order lines, regardless of restrictions on them'), + (11, 'issue_manage', 'Manage issues'); (11, 'group_manage', 'Manage basket groups'), (11, 'order_receive', 'Receive orders and manage shipments'), (11, 'budget_add_del', 'Add and delete funds (but can''t modify funds)'), -- 2.39.5