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

(-)a/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl (+138 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' ) ) {
11
          $dbh->do(q{
12
              ALTER TABLE letter ADD COLUMN `font` char(10) NOT NULL DEFAULT 'TR' AFTER `updated_on`
13
          });
14
15
          say $out "Added column 'letter.font'";
16
        }
17
18
        if( !column_exists( 'letter', 'font_size' ) ) {
19
          $dbh->do(q{
20
              ALTER TABLE letter ADD COLUMN `font_size` int(4) NOT NULL DEFAULT 10 AFTER `font`
21
          });
22
23
          say $out "Added column 'letter.font_size'";
24
        }
25
26
        if( !column_exists( 'letter', 'text_justify' ) ) {
27
          $dbh->do(q{
28
              ALTER TABLE letter ADD COLUMN `text_justify` char(1) NOT NULL DEFAULT 'L' AFTER `font_size`
29
          });
30
31
          say $out "Added column 'letter.text_justify'";
32
        }
33
34
        if( !column_exists( 'letter', 'units' ) ) {
35
          $dbh->do(q{
36
              ALTER TABLE letter ADD COLUMN `units` char(20) NOT NULL DEFAULT 'INCH' AFTER `text_justify`
37
          });
38
39
          say $out "Added column 'letter.units'";
40
        }
41
42
        if( !column_exists( 'letter', 'notice_width' ) ) {
43
          $dbh->do(q{
44
              ALTER TABLE letter ADD COLUMN `notice_width` float NOT NULL DEFAULT 8.5 AFTER `units`
45
          });
46
47
          say $out "Added column 'letter.notice_width'";
48
        }
49
50
        if( !column_exists( 'letter', 'notice_length' ) ) {
51
          $dbh->do(q{
52
              ALTER TABLE letter ADD COLUMN `notice_length` float NOT NULL DEFAULT 11 AFTER `notice_width`
53
          });
54
55
          say $out "Added column 'letter.notice_length'";
56
        }
57
58
        if( !column_exists( 'letter', 'page_width' ) ) {
59
          $dbh->do(q{
60
              ALTER TABLE letter ADD COLUMN `page_width` float NOT NULL DEFAULT 8.5 AFTER `notice_width`
61
          });
62
63
          say $out "Added column 'letter.page_width'";
64
        }
65
66
        if( !column_exists( 'letter', 'page_length' ) ) {
67
          $dbh->do(q{
68
              ALTER TABLE letter ADD COLUMN `page_length` float NOT NULL DEFAULT 11 AFTER `page_width`
69
          });
70
71
          say $out "Added column 'letter.page_length'";
72
        }
73
74
        if( !column_exists( 'letter', 'top_text_margin' ) ) {
75
          $dbh->do(q{
76
              ALTER TABLE letter ADD COLUMN `top_text_margin` float NOT NULL DEFAULT 0 AFTER `page_length`
77
          });
78
79
          say $out "Added column 'letter.top_text_margin'";
80
        }
81
82
        if( !column_exists( 'letter', 'left_text_margin' ) ) {
83
          $dbh->do(q{
84
              ALTER TABLE letter ADD COLUMN `left_text_margin` float NOT NULL DEFAULT 0 AFTER `top_text_margin`
85
          });
86
87
          say $out "Added column 'letter.left_text_margin'";
88
        }
89
90
        if( !column_exists( 'letter', 'top_margin' ) ) {
91
          $dbh->do(q{
92
              ALTER TABLE letter ADD COLUMN `top_margin` float NOT NULL DEFAULT 0.5 AFTER `left_text_margin`
93
          });
94
95
          say $out "Added column 'letter.top_margin'";
96
        }
97
98
        if( !column_exists( 'letter', 'left_margin' ) ) {
99
          $dbh->do(q{
100
              ALTER TABLE letter ADD COLUMN `left_margin` float NOT NULL DEFAULT 0.5 AFTER `top_margin`
101
          });
102
103
          say $out "Added column 'letter.left_margin'";
104
        }
105
106
        if( !column_exists( 'letter', 'cols' ) ) {
107
          $dbh->do(q{
108
              ALTER TABLE letter ADD COLUMN `cols` float NOT NULL DEFAULT 1 AFTER `left_margin`
109
          });
110
111
          say $out "Added column 'letter.cols'";
112
        }
113
114
        if( !column_exists( 'letter', 'rows' ) ) {
115
          $dbh->do(q{
116
              ALTER TABLE letter ADD COLUMN `rows` float NOT NULL DEFAULT 1 AFTER `cols`
117
          });
118
119
          say $out "Added column 'letter.rows'";
120
        }
121
122
        if( !column_exists( 'letter', 'col_gap' ) ) {
123
          $dbh->do(q{
124
              ALTER TABLE letter ADD COLUMN `col_gap` float NOT NULL DEFAULT 0 AFTER `rows`
125
          });
126
127
          say $out "Added column 'letter.col_gap'";
128
        }
129
130
        if( !column_exists( 'letter', 'row_gap' ) ) {
131
          $dbh->do(q{
132
              ALTER TABLE letter ADD COLUMN `row_gap` float NOT NULL DEFAULT 0 AFTER `col_gap`
133
          });
134
135
          say $out "Added column 'letter.row_gap'";
136
        }
137
    },
138
};
(-)a/installer/data/mysql/kohastructure.sql (-1 / +16 lines)
Lines 3856-3861 CREATE TABLE `letter` ( Link Here
3856
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3856
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
3857
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3857
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
3858
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3858
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
3859
  `font` char(10) NOT NULL DEFAULT 'TR' COMMENT 'font used when notice is printed',
3860
  `font_size` int(4) NOT NULL DEFAULT 10 COMMENT 'font size used when notice is printed',
3861
  `text_justify` char(1) NOT NULL DEFAULT 'L' COMMENT 'text justification used when notice is printed',
3862
  `units` char(20) NOT NULL DEFAULT 'INCH' COMMENT 'units to use for print measurements',
3863
  `notice_width` float NOT NULL DEFAULT 8.5 COMMENT 'width of individual notice',
3864
  `notice_length` float NOT NULL DEFAULT 11 COMMENT 'length of individual notice',
3865
  `page_width` float NOT NULL DEFAULT 8.5 COMMENT 'width of printer page',
3866
  `page_length` float NOT NULL DEFAULT 11 COMMENT 'length of printer page',
3867
  `top_text_margin` float NOT NULL DEFAULT 0 COMMENT 'top margin for notice text',
3868
  `left_text_margin` float NOT NULL DEFAULT 0 COMMENT 'left margin for notice text',
3869
  `top_margin` float NOT NULL DEFAULT 0.5 COMMENT 'top margin for page',
3870
  `left_margin` float NOT NULL DEFAULT 0.5 COMMENT 'left margin for page',
3871
  `cols` float NOT NULL DEFAULT 1 COMMENT 'number of notices to print across the width of the page',
3872
  `rows` float NOT NULL DEFAULT 1 COMMENT 'number of notices to print down the length of the page',
3873
  `col_gap` float NOT NULL DEFAULT 0 COMMENT 'padding between notices across the width of the page',
3874
  `row_gap` float NOT NULL DEFAULT 0 COMMENT 'padding between notices down the length of the page',
3859
  PRIMARY KEY (`id`),
3875
  PRIMARY KEY (`id`),
3860
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3876
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
3861
  KEY `message_transport_type_fk` (`message_transport_type`),
3877
  KEY `message_transport_type_fk` (`message_transport_type`),
3862
- 

Return to bug 33478