From 177c0f3969a488c2c8d02d2f0d199f646a0da475 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 1 Mar 2023 15:18:17 +0100 Subject: [PATCH] Bug 33104: DB changes Signed-off-by: Jonathan Field Signed-off-by: Tomas Cohen Arazi --- .../data/mysql/atomicupdate/bug_33104.pl | 42 +++++++++++++++++++ .../data/mysql/en/mandatory/auth_values.yml | 12 ++++++ installer/data/mysql/kohastructure.sql | 22 ++++++++++ .../data/mysql/mandatory/auth_val_cat.sql | 3 +- .../en/modules/admin/authorised_values.tt | 2 + 5 files changed, 80 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_33104.pl diff --git a/installer/data/mysql/atomicupdate/bug_33104.pl b/installer/data/mysql/atomicupdate/bug_33104.pl new file mode 100755 index 0000000000..0fb650ca02 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33104.pl @@ -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'"; + }, +}; diff --git a/installer/data/mysql/en/mandatory/auth_values.yml b/installer/data/mysql/en/mandatory/auth_values.yml index 5bfea57674..431d2df76c 100644 --- a/installer/data/mysql/en/mandatory/auth_values.yml +++ b/installer/data/mysql/en/mandatory/auth_values.yml @@ -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 ] diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8b0f8df41a..885bb40c19 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -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` -- diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index 90a97678b7..088017de93 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -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 diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt index 03a38104a8..7f98865c4e 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/authorised_values.tt @@ -569,6 +569,8 @@

Categories to be assigned to file uploads. Without a category an upload is considered temporary and may be removed during automated cleanup.

[% CASE 'VENDOR_TYPE' %]

Values that can be entered to fill in the 'Vendor type' field in the acquisitions module, that can be used for statistical purposes

+ [% CASE 'VENDOR_INTERFACE_TYPE' %] +

Values that can be entered to fill in the 'Vendor interface type' field in the acquisitions module

[% CASE 'WITHDRAWN' %]

Description of a withdrawn item (appears when adding or editing an item)

[% CASE 'YES_NO' %] -- 2.39.5