From 4d41d5e4ef342140d7a4eb6273eb22d5c058cdbd Mon Sep 17 00:00:00 2001 From: Aleisha Amohia Date: Tue, 18 Apr 2023 04:52:46 +0000 Subject: [PATCH] Bug 33478: Add formatting columns to letter table --- .../bug_33478-add_letter_columns.pl | 58 +++++++++++++++++++ installer/data/mysql/kohastructure.sql | 6 ++ 2 files changed, 64 insertions(+) create mode 100644 installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl diff --git a/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl b/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl new file mode 100644 index 00000000000..d92d0d1d1bd --- /dev/null +++ b/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl @@ -0,0 +1,58 @@ +use Modern::Perl; + +return { + bug_number => "33478", + description => "Customise the format of notices when they are printed", + up => sub { + my ($args) = @_; + my ($dbh, $out) = @$args{qw(dbh out)}; + + if( !column_exists( 'letter', 'font_size' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `font_size` int(4) NOT NULL DEFAULT 10 AFTER `updated_on` + }); + + say $out "Added column 'letter.font_size'"; + } + + if( !column_exists( 'letter', 'text_justify' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `text_justify` char(1) NOT NULL DEFAULT 'L' AFTER `font_size` + }); + + say $out "Added column 'letter.text_justify'"; + } + + if( !column_exists( 'letter', 'units' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `units` char(20) NOT NULL DEFAULT 'INCH' AFTER `text_justify` + }); + + say $out "Added column 'letter.units'"; + } + + if( !column_exists( 'letter', 'notice_width' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `notice_width` float NOT NULL DEFAULT 8.5 AFTER `units` + }); + + say $out "Added column 'letter.notice_width'"; + } + + if( !column_exists( 'letter', 'top_margin' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `top_margin` float NOT NULL DEFAULT 0.5 AFTER `notice_width` + }); + + say $out "Added column 'letter.top_margin'"; + } + + if( !column_exists( 'letter', 'left_margin' ) ) { + $dbh->do(q{ + ALTER TABLE letter ADD COLUMN `left_margin` float NOT NULL DEFAULT 0.5 AFTER `top_margin` + }); + + say $out "Added column 'letter.left_margin'"; + } + }, +}; diff --git a/installer/data/mysql/kohastructure.sql b/installer/data/mysql/kohastructure.sql index cba889d5e0f..d504b390f3e 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3856,6 +3856,12 @@ CREATE TABLE `letter` ( `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice', `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice', `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification', + `font_size` int(4) NOT NULL DEFAULT 10 COMMENT 'font size used when notice is printed', + `text_justify` char(1) NOT NULL DEFAULT 'L' COMMENT 'text justification used when notice is printed', + `units` char(20) NOT NULL DEFAULT 'INCH' COMMENT 'units to use for print measurements', + `notice_width` float NOT NULL DEFAULT 8.5 COMMENT 'width of notice', + `top_margin` float NOT NULL DEFAULT 0.5 COMMENT 'top margin for notice', + `left_margin` float NOT NULL DEFAULT 0.5 COMMENT 'left margin for notice', PRIMARY KEY (`id`), UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`), KEY `message_transport_type_fk` (`message_transport_type`), -- 2.30.2