From d808c54daad2fc9ff02e9bc86b02d14722799ba8 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 23 Feb 2022 12:27:27 +0100 Subject: [PATCH] Bug 32030: ERM - DB Syspref 'ERMModule' Permission 'erm' Table 'erm_agreements' 3 new av categories: * ERM_AGREEMENT_STATUS * ERM_AGREEMENT_CLOSURE_REASON * ERM_AGREEMENT_RENEWAL_PRIORITY Signed-off-by: Jonathan Field Signed-off-by: Martin Renvoize Signed-off-by: Kyle M Hall Signed-off-by: Tomas Cohen Arazi --- installer/data/mysql/atomicupdate/erm.pl | 58 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 19 ++++++ .../data/mysql/mandatory/auth_val_cat.sql | 20 +++++++ installer/data/mysql/mandatory/sysprefs.sql | 1 + installer/data/mysql/mandatory/userflags.sql | 3 +- .../prog/en/includes/prefs-menu.inc | 10 ++++ .../en/modules/admin/preferences/erm.pref | 8 +++ 7 files changed, 118 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/erm.pl create mode 100644 koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/erm.pref diff --git a/installer/data/mysql/atomicupdate/erm.pl b/installer/data/mysql/atomicupdate/erm.pl new file mode 100755 index 0000000000..d10bc0baa5 --- /dev/null +++ b/installer/data/mysql/atomicupdate/erm.pl @@ -0,0 +1,58 @@ +use Modern::Perl; + +return { + bug_number => "BUG_NUMBER", + description => "Some tables for ERM", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + $dbh->do(q{ + INSERT IGNORE INTO systempreferences (variable,value,explanation,options,type) + VALUES ('ERMModule', '0', NULL, 'Enable the E-Resource management module', 'YesNo'); + }); + + $dbh->do(q{ + INSERT IGNORE INTO userflags (bit, flag, flagdesc, defaulton) + VALUES (28, 'erm', 'Manage electronic resources', 0) + }); + + unless ( TableExists('erm_agreements') ) { + $dbh->do(q{ + CREATE TABLE `erm_agreements` ( + `agreement_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers', + `name` VARCHAR(255) NOT NULL COMMENT 'name of the agreement', + `description` LONGTEXT DEFAULT NULL COMMENT 'description of the agreement', + `status` VARCHAR(80) NOT NULL COMMENT 'current status of the agreement', + `closure_reason` VARCHAR(80) DEFAULT NULL COMMENT 'reason of the closure', + `is_perpetual` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual', + `renewal_priority` VARCHAR(80) DEFAULT NULL COMMENT 'priority of the renewal', + `license_info` VARCHAR(80) DEFAULT NULL COMMENT 'info about the license', + CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + PRIMARY KEY(`agreement_id`) + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + }); + } + + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories (category_name, is_system) + VALUES + ('ERM_AGREEMENT_STATUS', 1), + ('ERM_AGREEMENT_CLOSURE_REASON', 1), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 1) + }); + $dbh->do(q{ + INSERT IGNORE INTO authorised_values (category, authorised_value, lib) + VALUES + ('ERM_AGREEMENT_STATUS', 'active', 'Active'), + ('ERM_AGREEMENT_STATUS', 'in_negotiation', 'In negotiation'), + ('ERM_AGREEMENT_STATUS', 'closed', 'Closed'), + ('ERM_AGREEMENT_CLOSURE_REASON', 'expired', 'Expired'), + ('ERM_AGREEMENT_CLOSURE_REASON', 'cancelled', 'Cancelled'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'for_review', 'For review'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'renew', 'Renew'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'cancel', 'Cancel') + }); + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 4fa9db4705..ab7c59ed77 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2774,6 +2774,25 @@ CREATE TABLE `edifact_messages` ( ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; /*!40101 SET character_set_client = @saved_cs_client */; +-- +-- Table structure for table `erm_agreements` +-- + +DROP TABLE IF EXISTS `erm_agreements`; +CREATE TABLE `erm_agreements` ( + `agreement_id` INT(11) NOT NULL AUTO_INCREMENT COMMENT 'primary key', + `vendor_id` INT(11) DEFAULT NULL COMMENT 'foreign key to aqbooksellers', + `name` VARCHAR(255) NOT NULL COMMENT 'name of the agreement', + `description` LONGTEXT DEFAULT NULL COMMENT 'description of the agreement', + `status` VARCHAR(80) NOT NULL COMMENT 'current status of the agreement', + `closure_reason` VARCHAR(80) DEFAULT NULL COMMENT 'reason of the closure', + `is_perpetual` TINYINT(1) NOT NULL DEFAULT 0 COMMENT 'is the agreement perpetual', + `renewal_priority` VARCHAR(80) DEFAULT NULL COMMENT 'priority of the renewal', + `license_info` VARCHAR(80) DEFAULT NULL COMMENT 'info about the license', + CONSTRAINT `erm_agreements_ibfk_1` FOREIGN KEY (`vendor_id`) REFERENCES `aqbooksellers` (`id`) ON DELETE SET NULL ON UPDATE CASCADE, + PRIMARY KEY(`agreement_id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + -- -- Table structure for table `export_format` -- diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index aef65fb807..b4b0877aec 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -72,3 +72,23 @@ INSERT IGNORE INTO authorised_value_categories( category_name ) VALUES -- For file uploads INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) VALUES ('UPLOAD', 1); + +-- For ERM +INSERT IGNORE INTO authorised_value_categories (category_name, is_system) +VALUES + ('ERM_AGREEMENT_STATUS', 1), + ('ERM_AGREEMENT_CLOSURE_REASON', 1), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 1), + ('ERM_AGREEMENT_USER_ROLES', 1); +INSERT IGNORE INTO authorised_values (category, authorised_value, lib) +VALUES + ('ERM_AGREEMENT_STATUS', 'active', 'Active'), + ('ERM_AGREEMENT_STATUS', 'in_negotiation', 'In negotiation'), + ('ERM_AGREEMENT_STATUS', 'closed', 'Closed'), + ('ERM_AGREEMENT_CLOSURE_REASON', 'expired', 'Expired'), + ('ERM_AGREEMENT_CLOSURE_REASON', 'cancelled', 'Cancelled'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'for_review', 'For review'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'renew', 'Renew'), + ('ERM_AGREEMENT_RENEWAL_PRIORITY', 'cancel', 'Cancel'), + ('ERM_AGREEMENT_USER_ROLES', 'librarian', 'ERM librarian'), + ('ERM_AGREEMENT_USER_ROLES', 'subject_specialist', 'Subject specialist'); diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql index d57dd5aa38..bd52e85943 100644 --- a/installer/data/mysql/mandatory/sysprefs.sql +++ b/installer/data/mysql/mandatory/sysprefs.sql @@ -221,6 +221,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` ('EnableItemGroupHolds','0','','Enable item groups holds feature','YesNo'), ('EnhancedMessagingPreferences','1','','If ON, allows patrons to select to receive additional messages about items due or nearly due.','YesNo'), ('EnhancedMessagingPreferencesOPAC', '1', NULL, 'If ON, show patrons messaging setting on the OPAC.', 'YesNo'), +('ERMModule', '0', NULL, 'Enable the E-Resource management module', 'YesNo'), ('expandedSearchOption','0',NULL,'If ON, set advanced search to be expanded by default','YesNo'), ('ExpireReservesAutoFill','0',NULL,'Automatically fill the next hold with a automatically canceled expired waiting hold.','YesNo'), ('ExpireReservesAutoFillEmail','', NULL,'Send email notification of hold filled from automatically expired/cancelled hold to this address. If not defined, Koha will fallback to the library reply-to address','Free'), diff --git a/installer/data/mysql/mandatory/userflags.sql b/installer/data/mysql/mandatory/userflags.sql index 8697a7f48e..137612f14c 100644 --- a/installer/data/mysql/mandatory/userflags.sql +++ b/installer/data/mysql/mandatory/userflags.sql @@ -24,5 +24,6 @@ INSERT INTO userflags (bit, flag, flagdesc, defaulton) VALUES (24, 'stockrotation', 'Manage stockrotation operations', 0), (25, 'cash_management', 'Cash management', 0), (26, 'problem_reports', 'Manage problem reports', 0), -(27, 'recalls', 'Recalls', 0) +(27, 'recalls', 'Recalls', 0), +(28, 'erm', 'Manage electronic resources', 0) ; diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc index 42ecb5cbec..2bfa14fbc3 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/prefs-menu.inc @@ -69,6 +69,16 @@ [% END %] + [% IF ( erm ) %] +
  • + Electronic resources management + [% PROCESS subtabs %] + [% ELSE %] +
  • + Electronic resources management + [% END %] +
  • + [% IF ( i18n_l10n ) %]
  • I18N/L10N diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/erm.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/erm.pref new file mode 100644 index 0000000000..66fc61a2d0 --- /dev/null +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/erm.pref @@ -0,0 +1,8 @@ +Electronic resources management: + Interface: + - + - pref: ERMModule + choices: + 1: Enable + 0: Disable + - the Electronic resources management module -- 2.39.5