From 800262a3ec8ebd2a637d4110583282bc00879b5a 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 --- .../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 | 4 +- .../en/modules/admin/authorised_values.tt | 2 + 5 files changed, 81 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 00000000000..0fb650ca02f --- /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 41c931e96c5..af267da0f24 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 4140a6f2493..88c783d9db0 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -439,6 +439,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 90a97678b71..5fe97202dfa 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 @@ -88,3 +89,4 @@ VALUES ('ERM_PACKAGE_TYPE', 1), ('ERM_PACKAGE_CONTENT_TYPE', 1), ('ERM_TITLE_PUBLICATION_TYPE', 1); + 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 1e06bbcef34..6bc4a3e23a7 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 @@ -587,6 +587,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.25.1