From e42348dd7b8240d4d5a969dc7bdcdb3a89389ac3 Mon Sep 17 00:00:00 2001 From: Sam Lau Date: Tue, 6 Aug 2024 19:16:43 +0000 Subject: [PATCH] Bug 32485: DB Updates Add new 'checkoutmsg' and 'checkoutmsgtype' columns to 'itemtypes' --- .../data/mysql/atomicupdate/bug_32485.pl | 27 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 2 ++ 2 files changed, 29 insertions(+) create mode 100755 installer/data/mysql/atomicupdate/bug_32485.pl diff --git a/installer/data/mysql/atomicupdate/bug_32485.pl b/installer/data/mysql/atomicupdate/bug_32485.pl new file mode 100755 index 0000000000..73b8aca1ab --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_32485.pl @@ -0,0 +1,27 @@ +use Modern::Perl; +use Koha::Installer::Output qw(say_warning say_failure say_success say_info); + +return { + bug_number => "32485", + description => "Add new 'checkoutmsg' and 'checkoutmsgtype' columns to 'itemtypes'", + up => sub { + my ($args) = @_; + my ( $dbh, $out ) = @$args{qw(dbh out)}; + + if ( !column_exists( 'itemtypes', 'checkoutmsg' ) ) { + $dbh->do( + "ALTER TABLE itemtypes ADD COLUMN checkoutmsg VARCHAR(255) NULL DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked out' AFTER checkinmsgtype" + ); + } + + say $out "Added column 'itemtypes.checkoutmsg'"; + + if ( !column_exists( 'itemtypes', 'checkoutmsgtype' ) ) { + $dbh->do( + "ALTER TABLE itemtypes ADD COLUMN checkoutmsgtype CHAR(16) DEFAULT 'message' NOT NULL COMMENT 'Type (CSS class) for the checkoutmsg, can be ''alert'' or ''message''' AFTER checkoutmsg" + ); + } + + say $out "Added column 'itemtypes.checkoutmsgtype'"; + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index 07b1e78e1f..0a27c1a909 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -4133,6 +4133,8 @@ CREATE TABLE `itemtypes` ( `summary` mediumtext DEFAULT NULL COMMENT 'information from the summary field, may include HTML', `checkinmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked in', `checkinmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkinmsg, can be ''alert'' or ''message''', + `checkoutmsg` varchar(255) DEFAULT NULL COMMENT 'message that is displayed when an item with the given item type is checked out', + `checkoutmsgtype` char(16) NOT NULL DEFAULT 'message' COMMENT 'type (CSS class) for the checkoutmsg, can be ''alert'' or ''message''', `sip_media_type` varchar(3) DEFAULT NULL COMMENT 'SIP2 protocol media type for this itemtype', `hideinopac` tinyint(1) NOT NULL DEFAULT 0 COMMENT 'Hide the item type from the search options in OPAC', `searchcategory` varchar(80) DEFAULT NULL COMMENT 'Group this item type with others with the same value on OPAC search options', -- 2.39.2