View | Details | Raw Unified | Return to bug 33478
Collapse All | Expand All

(-)a/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl (+58 lines)
Line 0 Link Here
1
use Modern::Perl;
2
3
return {
4
    bug_number => "33478",
5
    description => "Customise the format of notices when they are printed",
6
    up => sub {
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
10
        if( !column_exists( 'letter', 'font_size' ) ) {
11
          $dbh->do(q{
12
              ALTER TABLE letter ADD COLUMN `font_size` int(4) NOT NULL DEFAULT 14 AFTER `updated_on`
13
          });
14
15
          say $out "Added column 'letter.font_size'";
16
        }
17
18
        if( !column_exists( 'letter', 'text_justify' ) ) {
19
          $dbh->do(q{
20
              ALTER TABLE letter ADD COLUMN `text_justify` enum('L','C','R') NOT NULL DEFAULT 'L' AFTER `font_size`
21
          });
22
23
          say $out "Added column 'letter.text_justify'";
24
        }
25
26
        if( !column_exists( 'letter', 'units' ) ) {
27
          $dbh->do(q{
28
              ALTER TABLE letter ADD COLUMN `units` enum('POINT','INCH','MM','CM') NOT NULL DEFAULT 'INCH' AFTER `text_justify`
29
          });
30
31
          say $out "Added column 'letter.units'";
32
        }
33
34
        if( !column_exists( 'letter', 'notice_width' ) ) {
35
          $dbh->do(q{
36
              ALTER TABLE letter ADD COLUMN `notice_width` float NOT NULL DEFAULT 8.5 AFTER `units`
37
          });
38
39
          say $out "Added column 'letter.notice_width'";
40
        }
41
42
        if( !column_exists( 'letter', 'top_margin' ) ) {
43
          $dbh->do(q{
44
              ALTER TABLE letter ADD COLUMN `top_margin` float NOT NULL DEFAULT 0 AFTER `notice_width`
45
          });
46
47
          say $out "Added column 'letter.top_margin'";
48
        }
49
50
        if( !column_exists( 'letter', 'left_margin' ) ) {
51
          $dbh->do(q{
52
              ALTER TABLE letter ADD COLUMN `left_margin` float NOT NULL DEFAULT 0 AFTER `top_margin`
53
          });
54
55
          say $out "Added column 'letter.left_margin'";
56
        }
57
    },
58
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +6 lines)
Lines 3900-3905 CREATE TABLE `letter` ( Link Here
3900
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3900
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3901
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3901
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3902
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3902
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3903
  `font_size` int(4) NOT NULL DEFAULT 14 COMMENT 'font size used when notice is printed',
3904
  `text_justify` enum('L','C','R') NOT NULL DEFAULT 'L' COMMENT 'text justification used when notice is printed',
3905
  `units` enum('POINT','INCH','MM','CM') NOT NULL DEFAULT 'INCH' COMMENT 'units to use for print measurements',
3906
  `notice_width` float NOT NULL DEFAULT 8.5 COMMENT 'width of notice',
3907
  `top_margin` float NOT NULL DEFAULT 0 COMMENT 'top margin for notice',
3908
  `left_margin` float NOT NULL DEFAULT 0 COMMENT 'left margin for notice',
3903
  PRIMARY KEY (`id`),
3909
  PRIMARY KEY (`id`),
3904
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3910
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3905
  KEY `message_transport_type_fk` (`message_transport_type`),
3911
  KEY `message_transport_type_fk` (`message_transport_type`),
3906
- 

Return to bug 33478