From e3d9791b69e56015528fa6e99457694788e7c0e8 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 --- .../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 0000000000..3716cf7f0f --- /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 21f6ec015c..9e547af93e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -2729,6 +2729,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`), @@ -3701,6 +3703,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.37.1 (Apple Git-137.1)