From 1f8d2fad03c44d1323eb42a88178f36588050e24 Mon Sep 17 00:00:00 2001 From: Matt Blenkinsop Date: Wed, 30 Aug 2023 13:11:56 +0000 Subject: [PATCH] Bug 19316: Add sort1 and sort2 to items and deleteditems tables This patch adds to new fields to the items table to allow input for additional data into item records to help with sorting Sponsored-by: PTFS Europe Signed-off-by: Nick Clemens --- .../bug_19316-addsort1-and-sort2-to-items.pl | 43 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 4 ++ 2 files changed, 47 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_19316-addsort1-and-sort2-to-items.pl diff --git a/installer/data/mysql/atomicupdate/bug_19316-addsort1-and-sort2-to-items.pl b/installer/data/mysql/atomicupdate/bug_19316-addsort1-and-sort2-to-items.pl new file mode 100755 index 00000000000..3716cf7f0f3 --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_19316-addsort1-and-sort2-to-items.pl @@ -0,0 +1,43 @@ +use Modern::Perl; + +return { + bug_number => "19316", + description => "Add sort1 and sort2 fields to items", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !column_exists( 'items', 'sort1' ) ) { + $dbh->do( + q{ + ALTER TABLE `items` ADD COLUMN `sort1` varchar(50) default NULL AFTER `exclude_from_local_holds_priority` + } + ); + say $out "Added column 'items.sort1'"; + } + if ( !column_exists( 'items', 'sort2' ) ) { + $dbh->do( + q{ + ALTER TABLE `items` ADD COLUMN `sort2` varchar(50) default NULL AFTER `sort1` + } + ); + say $out "Added column 'items.sort2'"; + } + if ( !column_exists( 'deleteditems', 'sort1' ) ) { + $dbh->do( + q{ + ALTER TABLE `deleteditems` ADD COLUMN `sort1` varchar(50) default NULL AFTER `exclude_from_local_holds_priority` + } + ); + say $out "Added column 'deleteditems.sort1'"; + } + if ( !column_exists( 'deleteditems', 'sort2' ) ) { + $dbh->do( + q{ + ALTER TABLE `deleteditems` ADD COLUMN `sort2` varchar(50) default NULL AFTER `sort1` + } + ); + say $out "Added column 'deleteditems.sort2'"; + } + } +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 8a6a1c26170..144188a2593 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2797,6 +2797,8 @@ CREATE TABLE `deleteditems` ( `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.', `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', + `sort1` varchar(50) default NULL, + `sort2` varchar(50) default NULL, PRIMARY KEY (`itemnumber`), KEY `delitembarcodeidx` (`barcode`), KEY `delitemstocknumberidx` (`stocknumber`), @@ -4055,6 +4057,8 @@ CREATE TABLE `items` ( `stocknumber` varchar(32) DEFAULT NULL COMMENT 'inventory number (MARC21 952$i)', `new_status` varchar(32) DEFAULT NULL COMMENT '''new'' value, you can put whatever free-text information. This field is intented to be managed by the automatic_item_modification_by_age cronjob.', `exclude_from_local_holds_priority` tinyint(1) DEFAULT NULL COMMENT 'Exclude this item from local holds priority', + `sort1` varchar(50) default NULL, + `sort2` varchar(50) default NULL, PRIMARY KEY (`itemnumber`), UNIQUE KEY `itembarcodeidx` (`barcode`), KEY `itemstocknumberidx` (`stocknumber`), -- 2.39.2