Bug 33105: DB changes

Signed-off-by: Jonathan Field <jonathan.fieeld@ptfs-europe.com>

Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-04-11 15:17:24 +02:00 committed by Tomas Cohen Arazi
parent 08913eeda1
commit 1a135e5e8c
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 75 additions and 1 deletions

View file

@ -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'";
},
};

View file

@ -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 ]

View file

@ -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`
--

View file

@ -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

View file

@ -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)'),