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/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-2 / +122 lines)
Lines 1-4 Link Here
1
[% USE raw %]
1
m% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE Koha %]
3
[% USE Koha %]
4
[% USE KohaDates %]
4
[% USE KohaDates %]
Lines 648-653 Link Here
648
                </div> <!-- /.panel-collapse -->
648
                </div> <!-- /.panel-collapse -->
649
            </div> <!-- /.panel.panel-default -->
649
            </div> <!-- /.panel.panel-default -->
650
        [% END # /FOR mtt %]
650
        [% END # /FOR mtt %]
651
652
        <div class="panel panel-default">
653
            <div class="panel-heading" role="tab" id="format_[% lang | html %]Heading">
654
                <h3 class="panel-title">
655
                    <a role="button" class="collapsed" data-toggle="collapse" data-parent="#group_[% lang | html %]" href="#format_[% lang | html %]" aria-expanded="false" aria-controls="format_[% lang | html %]">
656
                        <span>Print format</span>
657
                    </a>
658
                </h3>
659
            </div> <!-- /.panel-heading -->
660
            <div id="format_[% lang | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="format_[% lang | html %]Heading">
661
                <div class="panel-body">
662
                    <fieldset class="rows">
663
                        <input type="hidden" name="lang" value="[% lang | html %]" />
664
                        <ol>
665
                            <li>
666
                                <label for="text_justify">Text justification: </label>
667
                                <select name="text_justify" id="text_justify">
668
                                    [% FOREACH text_justification_type IN text_justification_types %]
669
                                    [% IF ( text_justification_type.selected ) %]
670
                                    <option value="[% text_justification_type.type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
671
                                    [% ELSE %]
672
                                    <option value="[% text_justification_type.type | html %]">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
673
                                    [% END %]
674
                                    [% END %]
675
                                </select>
676
                            </li>
677
                            <li>
678
                                <label for="font">Font: </label>
679
                                <select name="font" id="font">
680
                                    [% FOREACH font_type IN font_types %]
681
                                    [% IF ( font_type.selected ) %]
682
                                    <option value="[% font_type.type | html %]" selected="selected">[% font_type.name | html %]</option>
683
                                    [% ELSE %]
684
                                    <option value="[% font_type.type | html %]">[% font_type.name | html %]</option>
685
                                    [% END %]
686
                                    [% END %]
687
                                </select>
688
                            </li>
689
                            <li>
690
                                <label for="font_size">Font size: </label>
691
                                <input type="text" name="font_size" id="font_size" size="2" value="[% font_size | html %]" />
692
                            </li>
693
                            <li>
694
                                <label for="units">Units:</label>
695
                                <select id="units" name="units">
696
                                [% FOREACH unit IN units %]
697
                                    [% IF ( unit.selected ) %]
698
                                    <option value="[% unit.type | html %]" selected="selected">
699
                                    [% ELSE %]
700
                                    <option value="[% unit.type | html %]">
701
                                    [% END %]
702
703
                                        [% SWITCH unit.type %]
704
                                        [%   CASE 'POINT' %]
705
                                        <span>PostScript points</span>
706
                                        [%   CASE 'AGATE' %]
707
                                        <span>Agates</span>
708
                                        [%   CASE 'INCH' %]
709
                                        <span>US Inches</span>
710
                                        [%   CASE 'MM' %]
711
                                        <span>SI Millimeters</span>
712
                                        [%   CASE 'CM' %]
713
                                        <span>SI Centimeters</span>
714
                                        [% END %]
715
                                    </option>
716
                                [% END %]
717
                                </select>
718
                            </li>
719
                            <li>
720
                                <label for="page_height">Page height:</label>
721
                                <input type="text" size="4" name="page_height" id="page_height" value="[% page_height | html %]" />
722
                            </li>
723
                            <li>
724
                                <label for="page_width">Page width:</label>
725
                                <input type="text" size="4" name="page_width" id="page_width" value="[% page_width | html %]" />
726
                            </li>
727
                            <li>
728
                                <label for="label_width">Label width:</label>
729
                                <input type="text" size="4" name="label_width" id="label_width" value="[% label_width | html %]" />
730
                            </li>
731
                            <li>
732
                                <label for="label_height">Label height:</label>
733
                                <input type="text" size="4" name="label_height" id="label_height" value="[% label_height | html %]" />
734
                            </li>
735
                            <li>
736
                                <label for="top_margin">Top page margin:</label>
737
                                <input type="text" size="4" name="top_margin" id="top_margin" value="[% top_margin | html %]" />
738
                            </li>
739
                            <li>
740
                                <label for="left_margin">Left page margin:</label>
741
                                <input type="text" size="4" name="left_margin" id="left_margin" value="[% left_margin | html %]" />
742
                            </li>
743
                            <li>
744
                                <label for="top_text_margin">Top text margin:</label>
745
                                <input type="text" size="4" name="top_text_margin" id="top_text_margin" value="[% top_text_margin | html %]" />
746
                            </li>
747
                            <li>
748
                                <label for="left_text_margin">Left text margin:</label>
749
                                <input type="text" size="4" name="left_text_margin" id="left_text_margin" value="[% left_text_margin | html %]" />
750
                            </li>
751
                            <li>
752
                                <label for="cols">Number of columns:</label>
753
                                <input type="text" size="4" name="cols" id="cols" value="[% cols | html %]" />
754
                            </li>
755
                            <li>
756
                                <label for="rows">Number of rows:</label>
757
                                <input type="text" size="4" name="rows" id="rows" value="[% rows | html %]" />
758
                            </li>
759
                            <li>
760
                                <label for="col_gap">Gap between columns:</label>
761
                                <input type="text" size="4" name="col_gap" id="col_gap" value="[% col_gap | html %]" />
762
                            </li>
763
                            <li>
764
                                <label for="row_gap">Gap between rows:</label>
765
                                <input type="text" size="4" name="row_gap" id="row_gap" value="[% row_gap | html %]" />
766
                            </li>
767
                        </ol>
768
                    </fieldset> <!-- /.rows.mtt -->
769
                </div> <!-- /.panel-body -->
770
            </div> <!-- /.panel-collapse -->
771
        </div> <!-- /.panel.panel-default -->
651
    </div> <!-- /.panel-group#lang_lang -->
772
    </div> <!-- /.panel-group#lang_lang -->
652
[% END %]
773
[% END %]
653
774
654
- 

Return to bug 33478