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

(-)a/installer/data/mysql/atomicupdate/bug_33478-add_letter_columns.pl (-43 / +3 lines)
Lines 7-58 return { Link Here
7
        my ($args) = @_;
7
        my ($args) = @_;
8
        my ($dbh, $out) = @$args{qw(dbh out)};
8
        my ($dbh, $out) = @$args{qw(dbh out)};
9
9
10
        if( !column_exists( 'letter', 'font_size' ) ) {
10
        if( !column_exists( 'letter', 'style' ) ) {
11
          $dbh->do(q{
11
          $dbh->do(q{
12
              ALTER TABLE letter ADD COLUMN `font_size` int(4) NOT NULL DEFAULT 14 AFTER `updated_on`
12
              ALTER TABLE letter ADD COLUMN `style` mediumtext DEFAULT NULL AFTER `updated_on`
13
          });
13
          });
14
14
15
          say $out "Added column 'letter.font_size'";
15
          say $out "Added column 'letter.style'";
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
        }
16
        }
57
    },
17
    },
58
};
18
};
(-)a/installer/data/mysql/kohastructure.sql (-6 / +1 lines)
Lines 4231-4242 CREATE TABLE `letter` ( Link Here
4231
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
4231
  `message_transport_type` varchar(20) NOT NULL DEFAULT 'email' COMMENT 'transport type for this notice',
4232
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
4232
  `lang` varchar(25) NOT NULL DEFAULT 'default' COMMENT 'lang of the notice',
4233
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
4233
  `updated_on` timestamp NOT NULL DEFAULT current_timestamp() ON UPDATE current_timestamp() COMMENT 'last modification',
4234
  `font_size` int(4) NOT NULL DEFAULT 14 COMMENT 'font size used when notice is printed',
4234
  `style` mediumtext DEFAULT NULL COMMENT 'custom styles for this notice',
4235
  `text_justify` enum('L','C','R') NOT NULL DEFAULT 'L' COMMENT 'text justification used when notice is printed',
4236
  `units` enum('POINT','INCH','MM','CM') NOT NULL DEFAULT 'INCH' COMMENT 'units to use for print measurements',
4237
  `notice_width` float NOT NULL DEFAULT 8.5 COMMENT 'width of notice',
4238
  `top_margin` float NOT NULL DEFAULT 0 COMMENT 'top margin for notice',
4239
  `left_margin` float NOT NULL DEFAULT 0 COMMENT 'left margin for notice',
4240
  PRIMARY KEY (`id`),
4235
  PRIMARY KEY (`id`),
4241
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
4236
  UNIQUE KEY `letter_uniq_1` (`module`,`code`,`branchcode`,`message_transport_type`,`lang`),
4242
  KEY `message_transport_type_fk` (`message_transport_type`),
4237
  KEY `message_transport_type_fk` (`message_transport_type`),
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/printslip.tt (+1 lines)
Lines 29-34 Link Here
29
[% IF ( Koha.Preference('SlipCSS') ) %]
29
[% IF ( Koha.Preference('SlipCSS') ) %]
30
<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
30
<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
31
[% END %]
31
[% END %]
32
[% IF slip.style %]<style>[% slip.style | $raw %]</style>[% END %]
32
33
33
[% INCLUDE 'slip-print.inc' #printThenClose %]
34
[% INCLUDE 'slip-print.inc' #printThenClose %]
34
</head>
35
</head>
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printfeercpt.tt (+1 lines)
Lines 15-20 Link Here
15
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
15
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
16
16
17
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
17
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
18
[% IF slip.style %]<style>[% slip.style | $raw %]</style>[% END %]
18
[% INCLUDE 'blocking_errors.inc' %]
19
[% INCLUDE 'blocking_errors.inc' %]
19
</head>
20
</head>
20
21
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printinvoice.tt (+1 lines)
Lines 15-20 Link Here
15
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
15
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
16
16
17
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
17
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
18
[% IF slip.style %]<style>[% slip.style | $raw %]</style>[% END %]
18
[% INCLUDE 'blocking_errors.inc' %]
19
[% INCLUDE 'blocking_errors.inc' %]
19
</head>
20
</head>
20
21
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/members/printnotice.tt (+1 lines)
Lines 18-23 Link Here
18
[% IF ( Koha.Preference('SlipCSS') ) %]
18
[% IF ( Koha.Preference('SlipCSS') ) %]
19
<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
19
<link rel="stylesheet" type="text/css" href="[% Koha.Preference('SlipCSS') | $raw %]" />
20
[% END %]
20
[% END %]
21
[% IF slip.style %]<style>[% slip.style | $raw %]</style>[% END %]
21
</head>
22
</head>
22
23
23
<body id="members_printslip" class="member">
24
<body id="members_printslip" class="member">
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/pos/printreceipt.tt (+1 lines)
Lines 14-19 Link Here
14
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
14
<link rel="shortcut icon" href="[% IF ( IntranetFavicon ) %][% IntranetFavicon | url %][% ELSE %][% interface | html %]/[% theme | html %]/img/favicon.ico[% END %]" type="image/x-icon" />
15
15
16
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
16
[% Asset.css("css/printreceiptinvoice.css") | $raw %]
17
[% IF slip.style %]<style>[% slip.style | $raw %]</style>[% END %]
17
[% INCLUDE 'blocking_errors.inc' %]
18
[% INCLUDE 'blocking_errors.inc' %]
18
</head>
19
</head>
19
20
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-73 / +51 lines)
Lines 51-79 Link Here
51
        .panel-group {
51
        .panel-group {
52
            margin-top: 3px;
52
            margin-top: 3px;
53
        }
53
        }
54
        .css-helper::after {
55
            content: " | ";
56
        }
57
        .css-helper:last-child::after {
58
            content: none;
59
        }
54
    </style>
60
    </style>
55
[% END %]
61
[% END %]
56
</head>
62
</head>
57
63
58
[% text_justification_types = [ 'L','C','R' ] %]
59
[% BLOCK translate_justification_types %]
60
    [%  SWITCH type %]
61
        [%   CASE 'L' %]<span>Left</span>
62
        [%   CASE 'C' %]<span>Center</span>
63
        [%   CASE 'R' %]<span>Right</span>
64
    [%  END %]
65
[% END %]
66
67
[% units = [ 'POINT','INCH','MM','CM' ] %]
68
[% BLOCK translate_unit_types %]
69
    [% SWITCH type %]
70
        [%   CASE 'POINT' %]<span>PostScript points</span>
71
        [%   CASE 'INCH' %]<span>US Inches</span>
72
        [%   CASE 'MM' %]<span>SI Millimeters</span>
73
        [%   CASE 'CM' %]<span>SI Centimeters</span>
74
    [% END %]
75
[% END %]
76
77
<body id="tools_letter" class="tools">
64
<body id="tools_letter" class="tools">
78
    [% WRAPPER 'header.inc' %]
65
    [% WRAPPER 'header.inc' %]
79
    [% INCLUDE 'letters-search.inc' %]
66
    [% INCLUDE 'letters-search.inc' %]
Lines 689-748 Link Here
689
                <div class="panel-body">
676
                <div class="panel-body">
690
                    <fieldset class="rows">
677
                    <fieldset class="rows">
691
                    <div class="dialog message">These format settings apply when a notice is printed.</div>
678
                    <div class="dialog message">These format settings apply when a notice is printed.</div>
692
                        [% SET param = letters.$lang.params %]
679
                    <div class="col-md-12">
693
                        <div class="col-md-6">
680
                        <ol>
694
                            <ol>
681
                            <li id="css-helpers">
695
                                <li>
682
                                <label>Insert selectors to apply styles to: </label>
696
                                    <label for="text_justify">Text justification: </label>
683
                                <a class="css-helper" id="headings">Headings</a>
697
                                    <select name="text_justify" id="text_justify">
684
                                <a class="css-helper" id="tables">Tables</a>
698
                                        [% FOREACH text_justification_type IN text_justification_types %]
685
                                <a class="css-helper" id="text">All text</a>
699
                                            [% IF ( text_justification_type == param.text_justify ) %]
686
                            </li>
700
                                            <option value="[% text_justification_type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type %]</option>
687
                            <li>
701
                                            [% ELSE %]
688
                                <label for="style">Style (CSS): </label>
702
                                            <option value="[% text_justification_type | html %]">[% PROCESS translate_justification_types type=text_justification_type %]</option>
689
                                <textarea id="style" name="style" rows="15" cols="80">[% letters.$lang.params.style | $raw %]</textarea>
703
                                            [% END %]
690
                            </li>
704
                                        [% END %]
691
                            <li>
705
                                    </select>
692
                                <label for="format_all">Apply format settings to all notices:</label>
706
                                </li>
693
                                <input type="checkbox" name="format_all" id="format_all" value="1" />
707
                                <li>
694
                                <span class="hint">Existing format settings will be overwritten.</span>
708
                                    <label for="font_size">Font size: </label>
695
                            </li>
709
                                    <input type="text" name="font_size" id="font_size" size="2" value="[% param.font_size | html %]" />
696
                        </ol>
710
                                </li>
697
                    </div>
711
                                <li>
712
                                    <label for="format_all">Apply format settings to all notices:</label>
713
                                    <input type="checkbox" name="format_all" id="format_all" value="1" />
714
                                    <span class="hint">Existing format settings will be overwritten.</span>
715
                                </li>
716
                            </ol>
717
                        </div>
718
                        <div class="col-md-6">
719
                            <ol>
720
                                <li>
721
                                    <label for="units">Units:</label>
722
                                    <select id="units" name="units">
723
                                        [% FOREACH unit IN units %]
724
                                            [% IF ( unit == param.units ) %]
725
                                            <option value="[% unit | html %]" selected="selected">[% PROCESS translate_unit_types type=unit %]</option>
726
                                            [% ELSE %]
727
                                            <option value="[% unit | html %]">[% PROCESS translate_unit_types type=unit %]</option>
728
                                            [% END %]
729
                                        [% END %]
730
                                    </select>
731
                                </li>
732
                                <li>
733
                                    <label for="notice_width">Notice width:</label>
734
                                    <input type="text" size="4" name="notice_width" id="notice_width" value="[% param.notice_width | html %]" />
735
                                </li>
736
                                <li>
737
                                    <label for="top_margin">Top margin:</label>
738
                                    <input type="text" size="4" name="top_margin" id="top_margin" value="[% param.top_margin | html %]" />
739
                                </li>
740
                                <li>
741
                                    <label for="left_margin">Left margin:</label>
742
                                    <input type="text" size="4" name="left_margin" id="left_margin" value="[% param.left_margin | html %]" />
743
                                </li>
744
                            </ol>
745
                        </div>
746
                    </fieldset> <!-- /.rows.mtt -->
698
                    </fieldset> <!-- /.rows.mtt -->
747
                </div> <!-- /.panel-body -->
699
                </div> <!-- /.panel-body -->
748
            </div> <!-- /.panel-collapse -->
700
            </div> <!-- /.panel-collapse -->
Lines 767-772 Link Here
767
        var new_lettercode = '[% new_lettercode | html %]';
719
        var new_lettercode = '[% new_lettercode | html %]';
768
        var new_branchcode = '[% new_branchcode | html %]';
720
        var new_branchcode = '[% new_branchcode | html %]';
769
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %];
721
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %];
722
        $(document).ready(function(){
723
            $("#headings").click(function(){
724
                $("#style").val(function(i, text) {
725
                    return text + '\nbody, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
726
                    '#receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6 {\n' +
727
                    '// insert CSS here\n' +
728
                    '}';
729
                });
730
            });
731
            $("#tables").click(function(){
732
                $("#style").val(function(i, text) {
733
                    return text + '\nbody, table, th, td, th:last-child, td:last-child {\n' +
734
                    '// insert CSS here\n' +
735
                    '}';
736
                });
737
            });
738
            $("#text").click(function(){
739
                $("#style").val(function(i, text) {
740
                    return text + '\nbody, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
741
                    '#receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6,\n' +
742
                    'table, th, td, th:last-child, td:last-child {\n' +
743
                    '// insert CSS here\n' +
744
                    '}';
745
                });
746
            });
747
        });
770
     </script>
748
     </script>
771
    [% Asset.js("js/letter.js") | $raw %]
749
    [% Asset.js("js/letter.js") | $raw %]
772
[% END %]
750
[% END %]
(-)a/tools/letter.pl (-29 / +4 lines)
Lines 307-318 sub add_validate { Link Here
307
    my $oldmodule     = $input->param('oldmodule');
307
    my $oldmodule     = $input->param('oldmodule');
308
    my $code          = $input->param('code');
308
    my $code          = $input->param('code');
309
    my $name          = $input->param('name');
309
    my $name          = $input->param('name');
310
    my $text_justify  = $input->param('text_justify');
310
    my $style         = $input->param('style');
311
    my $font_size     = $input->param('font_size');
312
    my $units         = $input->param('units');
313
    my $notice_width  = $input->param('notice_width');
314
    my $top_margin    = $input->param('top_margin');
315
    my $left_margin   = $input->param('left_margin');
316
    my $format_all    = $input->param('format_all');
311
    my $format_all    = $input->param('format_all');
317
    my @mtt           = $input->multi_param('message_transport_type');
312
    my @mtt           = $input->multi_param('message_transport_type');
318
    my @title         = $input->multi_param('title');
313
    my @title         = $input->multi_param('title');
Lines 323-338 sub add_validate { Link Here
323
        if ( $format_all ) {
318
        if ( $format_all ) {
324
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
319
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
325
            foreach my $letter ( @letters ) {
320
            foreach my $letter ( @letters ) {
326
                $letter->set(
321
                $letter->set({ style => $style })->store;
327
                    {
328
                        text_justify  => $text_justify,
329
                        font_size  => $font_size,
330
                        units      => $units,
331
                        notice_width  => $notice_width,
332
                        top_margin    => $top_margin,
333
                        left_margin   => $left_margin,
334
                    }
335
                )->store;
336
            }
322
            }
337
        }
323
        }
338
        my $is_html = $input->param("is_html_$mtt\_$lang");
324
        my $is_html = $input->param("is_html_$mtt\_$lang");
Lines 368-379 sub add_validate { Link Here
368
                    title      => $title,
354
                    title      => $title,
369
                    content    => $content,
355
                    content    => $content,
370
                    lang       => $lang,
356
                    lang       => $lang,
371
                    text_justify  => $text_justify,
357
                    style      => $style
372
                    font_size  => $font_size,
373
                    units      => $units,
374
                    notice_width  => $notice_width,
375
                    top_margin    => $top_margin,
376
                    left_margin   => $left_margin,
377
                }
358
                }
378
            )->store;
359
            )->store;
379
360
Lines 389-400 sub add_validate { Link Here
389
                    content                => $content,
370
                    content                => $content,
390
                    message_transport_type => $mtt,
371
                    message_transport_type => $mtt,
391
                    lang                   => $lang,
372
                    lang                   => $lang,
392
                    text_justify  => $text_justify,
373
                    style                  => $style
393
                    font_size  => $font_size,
394
                    units      => $units,
395
                    notice_width  => $notice_width,
396
                    top_margin    => $top_margin,
397
                    left_margin   => $left_margin,
398
                }
374
                }
399
            )->store;
375
            )->store;
400
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
376
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
401
- 

Return to bug 33478