Bug 33104: DB changes

Signed-off-by: Jonathan Field <jonathan.field@ptfs-europe.com>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2023-03-01 15:18:17 +01:00 committed by Tomas Cohen Arazi
parent a4b687c3aa
commit 177c0f3969
Signed by: tomascohen
GPG key ID: 0A272EA1B2F3C15F
5 changed files with 80 additions and 1 deletions

View file

@ -0,0 +1,42 @@
use Modern::Perl;
return {
bug_number => "33104",
description => "Add vendor interfaces",
up => sub {
my ($args) = @_;
my ($dbh, $out) = @$args{qw(dbh out)};
unless ( TableExists('aqbookseller_interfaces') ) {
$dbh->do(q{
CREATE TABLE `aqbookseller_interfaces` (
`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 interface, authorised value VENDOR_INTERFACE_TYPE",
`name` varchar(255) NOT NULL COMMENT 'name of the interface',
`uri` mediumtext DEFAULT NULL COMMENT 'uri of the interface',
`login` varchar(255) DEFAULT NULL COMMENT 'login',
`password` mediumtext DEFAULT NULL COMMENT 'hashed password',
`account_email` mediumtext DEFAULT NULL COMMENT 'account email',
`notes` longtext DEFAULT NULL COMMENT 'notes',
PRIMARY KEY (`id`),
CONSTRAINT `aqbookseller_interfaces_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_interfaces'";
}
$dbh->do(q{
INSERT IGNORE INTO authorised_value_categories (category_name, is_system)
VALUES
('VENDOR_INTERFACE_TYPE', 1)
});
$dbh->do(q{
INSERT IGNORE INTO authorised_values (category, authorised_value, lib)
VALUES
('VENDOR_INTERFACE_TYPE', 'ADMIN', 'Admin'),
('VENDOR_INTERFACE_TYPE', 'ORDERS', 'Orders'),
('VENDOR_INTERFACE_TYPE', 'REPORTS', 'Reports')
});
say $out "Added new authorised value category 'VENDOR_INTERFACE_TYPE'";
},
};

View file

@ -258,6 +258,18 @@ tables:
authorised_value: "audiobook"
lib: "Audiobook"
- category: "VENDOR_INTERFACE_TYPE"
authorised_value: "ADMIN"
lib: "Admin"
- category: "VENDOR_INTERFACE_TYPE"
authorised_value: "ORDERS"
lib: "Orders"
- category: "VENDOR_INTERFACE_TYPE"
authorised_value: "REPORTS"
lib: "Reports"
# Country codes
- authorised_values:
translatable: [ lib, lib_opac ]

View file

@ -440,6 +440,28 @@ CREATE TABLE `aqbookseller_aliases` (
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci;
/*!40101 SET character_set_client = @saved_cs_client */;
--
-- Table structure for table `aqbookseller_interfaces`
--
DROP TABLE IF EXISTS `aqbookseller_interfaces`;
/*!40101 SET @saved_cs_client = @@character_set_client */;
/*!40101 SET character_set_client = utf8 */;
CREATE TABLE `aqbookseller_interfaces` (
`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 interface, authorised value VENDOR_INTERFACE_TYPE",
`name` varchar(255) NOT NULL COMMENT 'name of the interface',
`uri` mediumtext DEFAULT NULL COMMENT 'uri of the interface',
`login` varchar(255) DEFAULT NULL COMMENT 'login',
`password` mediumtext DEFAULT NULL COMMENT 'hashed password',
`account_email` mediumtext DEFAULT NULL COMMENT 'account email',
`notes` longtext DEFAULT NULL COMMENT 'notes',
PRIMARY KEY (`id`),
CONSTRAINT `aqbookseller_interfaces_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

@ -20,7 +20,8 @@ INSERT IGNORE INTO authorised_value_categories( category_name, is_system )
('HOLD_CANCELLATION', 0),
('ROADTYPE', 0),
('AR_CANCELLATION', 0),
('VENDOR_TYPE', 1);
('VENDOR_TYPE', 1),
('VENDOR_INTERFACE_TYPE', 1);
INSERT IGNORE INTO authorised_value_categories( category_name, is_system )
VALUES

View file

@ -569,6 +569,8 @@
<p>Categories to be assigned to file uploads. Without a category an upload is considered temporary and may be removed during automated cleanup.</p>
[% CASE 'VENDOR_TYPE' %]
<p>Values that can be entered to fill in the 'Vendor type' field in the acquisitions module, that can be used for statistical purposes</p>
[% CASE 'VENDOR_INTERFACE_TYPE' %]
<p>Values that can be entered to fill in the 'Vendor interface type' field in the acquisitions module</p>
[% CASE 'WITHDRAWN' %]
<p>Description of a withdrawn item (appears when adding or editing an item)</p>
[% CASE 'YES_NO' %]