From 77462560d6cfa4de69cf26d4fd99c09c3bb37a8a 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 Signed-off-by: Sam Lau --- .../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 0000000000..772413026b --- /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 14 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` enum('L','C','R') 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` enum('POINT','INCH','MM','CM') 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 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 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 9ae8fd76e3..27d45d04d0 100644 --- a/installer/data/mysql/kohastructure.sql +++ b/installer/data/mysql/kohastructure.sql @@ -3900,6 +3900,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 14 COMMENT 'font size used when notice is printed', + `text_justify` enum('L','C','R') NOT NULL DEFAULT 'L' COMMENT 'text justification used when notice is printed', + `units` enum('POINT','INCH','MM','CM') 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 COMMENT 'top margin for notice', + `left_margin` float NOT NULL DEFAULT 0 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