From 1e1ccab272074b9c5074da0dbdf1b83a4665720b Mon Sep 17 00:00:00 2001 From: Agustin Moyano Date: Thu, 19 Aug 2021 23:00:26 -0300 Subject: [PATCH] Bug 27947: Add authorised values list in article requests cancellation --- .../data/mysql/atomicupdate/bug_27947.pl | 24 +++++++++++++++++++ installer/data/mysql/en/optional/auth_val.yml | 9 +++++++ installer/data/mysql/kohastructure.sql | 1 + .../data/mysql/mandatory/auth_val_cat.sql | 3 ++- 4 files changed, 36 insertions(+), 1 deletion(-) create mode 100755 installer/data/mysql/atomicupdate/bug_27947.pl diff --git a/installer/data/mysql/atomicupdate/bug_27947.pl b/installer/data/mysql/atomicupdate/bug_27947.pl new file mode 100755 index 0000000000..d87a957487 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_27947.pl @@ -0,0 +1,24 @@ +use Modern::Perl; + +return { + bug_number => "27947", + description => "Add authorised values list in article requests cancellation", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out column_exists)}; + # Do you stuffs here + $dbh->do(q{ + INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) + VALUES ('AR_CANCELLATION', 0) + }); + # Print useful stuff here + say $out "Add AR_CANCELLATION category for authorised values"; + + $dbh->do(q{ + ALTER TABLE `article_requests` ADD COLUMN `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION' AFTER `urls` + }) unless column_exists('article_requests', 'cancellation_reason'); + + # Print useful stuff here + say $out "Add cancellation_reason column in article_requests table"; + }, +} diff --git a/installer/data/mysql/en/optional/auth_val.yml b/installer/data/mysql/en/optional/auth_val.yml index de8baf3903..d2497d79db 100644 --- a/installer/data/mysql/en/optional/auth_val.yml +++ b/installer/data/mysql/en/optional/auth_val.yml @@ -300,3 +300,12 @@ tables: - category: "HOLD_CANCELLATION" authorised_value: "DAMAGED" lib: "Item was found to be too damaged to fill hold" + + # article request cancellations + - category: "AR_CANCELLATION" + authorised_value: "NOT_FOUND" + lib: "Item could not be located on shelves" + + - category: "AR_CANCELLATION" + authorised_value: "DAMAGED" + lib: "Item was found to be too damaged to fill article request" diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8e5348edff..187e1e0389 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -753,6 +753,7 @@ CREATE TABLE `article_requests` ( `notes` mediumtext COLLATE utf8mb4_unicode_ci DEFAULT NULL, `format` enum('PHOTOCOPY', 'SCAN') NOT NULL DEFAULT 'PHOTOCOPY', `urls` MEDIUMTEXT, + `cancellation_reason` varchar(80) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'optional authorised value AR_CANCELLATION', `created_on` timestamp NULL DEFAULT NULL COMMENT 'Be careful with two timestamps in one table not allowing NULL', `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp(), PRIMARY KEY (`id`), diff --git a/installer/data/mysql/mandatory/auth_val_cat.sql b/installer/data/mysql/mandatory/auth_val_cat.sql index e3bbef04df..d185f23ce7 100644 --- a/installer/data/mysql/mandatory/auth_val_cat.sql +++ b/installer/data/mysql/mandatory/auth_val_cat.sql @@ -18,7 +18,8 @@ INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) ('PAYMENT_TYPE', 0), ('PA_CLASS', 0), ('HOLD_CANCELLATION', 0), - ('ROADTYPE', 0); + ('ROADTYPE', 0), + ('AR_CANCELLATION', 0); INSERT IGNORE INTO authorised_value_categories( category_name, is_system ) VALUES -- 2.25.1