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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+91 lines)
Lines 55-60 Link Here
55
[% END %]
55
[% END %]
56
</head>
56
</head>
57
57
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
58
<body id="tools_letter" class="tools">
77
<body id="tools_letter" class="tools">
59
    [% WRAPPER 'header.inc' %]
78
    [% WRAPPER 'header.inc' %]
60
    [% INCLUDE 'letters-search.inc' %]
79
    [% INCLUDE 'letters-search.inc' %]
Lines 657-662 Link Here
657
                </div> <!-- /.panel-collapse -->
676
                </div> <!-- /.panel-collapse -->
658
            </div> <!-- /.panel.panel-default -->
677
            </div> <!-- /.panel.panel-default -->
659
        [% END # /FOR mtt %]
678
        [% END # /FOR mtt %]
679
680
        <div class="panel panel-default">
681
            <div class="panel-heading" role="tab" id="format_[% lang | html %]Heading">
682
                <h3 class="panel-title">
683
                    <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 %]">
684
                        <span>Format</span>
685
                    </a>
686
                </h3>
687
            </div> <!-- /.panel-heading -->
688
            <div id="format_[% lang | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="format_[% lang | html %]Heading">
689
                <div class="panel-body">
690
                    <fieldset class="rows">
691
                    <div class="dialog message">These format settings apply when a notice is printed.</div>
692
                        [% SET param = letters.$lang.params %]
693
                        <div class="col-md-6">
694
                            <ol>
695
                                <li>
696
                                    <label for="text_justify">Text justification: </label>
697
                                    <select name="text_justify" id="text_justify">
698
                                        [% FOREACH text_justification_type IN text_justification_types %]
699
                                            [% IF ( text_justification_type == param.text_justify ) %]
700
                                            <option value="[% text_justification_type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type %]</option>
701
                                            [% ELSE %]
702
                                            <option value="[% text_justification_type | html %]">[% PROCESS translate_justification_types type=text_justification_type %]</option>
703
                                            [% END %]
704
                                        [% END %]
705
                                    </select>
706
                                </li>
707
                                <li>
708
                                    <label for="font_size">Font size: </label>
709
                                    <input type="text" name="font_size" id="font_size" size="2" value="[% param.font_size | html %]" />
710
                                </li>
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 -->
747
                </div> <!-- /.panel-body -->
748
            </div> <!-- /.panel-collapse -->
749
        </div> <!-- /.panel.panel-default -->
750
660
    </div> <!-- /.panel-group#lang_lang -->
751
    </div> <!-- /.panel-group#lang_lang -->
661
[% END %]
752
[% END %]
662
753
(-)a/koha-tmpl/intranet-tmpl/prog/js/letter.js (-2 / +18 lines)
Lines 48-53 function confirmOverwrite( new_lettercode, new_branchcode ){ Link Here
48
    }
48
    }
49
}
49
}
50
50
51
function confirmFormatOverwrite( event ) {
52
    if ( confirm(__("Existing format settings for all notices will be overwritten by these format settings.")) ) {
53
        return true;
54
    } else {
55
        return false;
56
    }
57
}
58
51
var Sticky;
59
var Sticky;
52
60
53
$(document).ready(function() {
61
$(document).ready(function() {
Lines 85-92 $(document).ready(function() { Link Here
85
        window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
93
        window.location.href = "/cgi-bin/koha/tools/letter.pl?op=add_form&module=" + $(this).val() + "&branchcode=" + branchcode;
86
    });
94
    });
87
95
88
    $("#submit_form").on("click",function(){
96
    $("#submit_form").on("click",function(e){
89
        $("#add_notice").submit();
97
        if ( $("#format_all").is(":checked") ){
98
            if ( confirmFormatOverwrite(e) ) {
99
                $("#add_notice").submit();
100
            } else {
101
                e.preventDefault();
102
            }
103
        } else {
104
            $("#add_notice").submit();
105
        }
90
    });
106
    });
91
107
92
    $("#add_notice").validate({
108
    $("#add_notice").validate({
(-)a/tools/letter.pl (-4 / +37 lines)
Lines 49-55 use C4::Context; Link Here
49
use C4::Output qw( output_html_with_http_headers );
49
use C4::Output qw( output_html_with_http_headers );
50
use C4::Letters qw( GetMessageTransportTypes );
50
use C4::Letters qw( GetMessageTransportTypes );
51
use C4::Log qw( logaction );
51
use C4::Log qw( logaction );
52
53
use Koha::Notice::Templates;
52
use Koha::Notice::Templates;
54
use Koha::Patron::Attribute::Types;
53
use Koha::Patron::Attribute::Types;
55
54
Lines 228-233 sub add_form { Link Here
228
                content    => $letter->{content} // '',
227
                content    => $letter->{content} // '',
229
                tt_error   => $letter->{tt_error},
228
                tt_error   => $letter->{tt_error},
230
            };
229
            };
230
            $letters{ $lang }{params} = $letter;
231
        }
231
        }
232
    }
232
    }
233
    else {
233
    else {
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');
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');
310
    my @mtt           = $input->multi_param('message_transport_type');
317
    my @mtt           = $input->multi_param('message_transport_type');
311
    my @title         = $input->multi_param('title');
318
    my @title         = $input->multi_param('title');
312
    my @content       = $input->multi_param('content');
319
    my @content       = $input->multi_param('content');
313
    my @lang          = $input->multi_param('lang');
320
    my @lang          = $input->multi_param('lang');
314
    for my $mtt ( @mtt ) {
321
    for my $mtt ( @mtt ) {
315
        my $lang = shift @lang;
322
        my $lang = shift @lang;
323
        if ( $format_all ) {
324
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
325
            foreach my $letter ( @letters ) {
326
                $letter->set(
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
            }
337
        }
316
        my $is_html = $input->param("is_html_$mtt\_$lang");
338
        my $is_html = $input->param("is_html_$mtt\_$lang");
317
        my $title   = shift @title;
339
        my $title   = shift @title;
318
        my $content = shift @content;
340
        my $content = shift @content;
Lines 345-351 sub add_validate { Link Here
345
                    is_html    => $is_html || 0,
367
                    is_html    => $is_html || 0,
346
                    title      => $title,
368
                    title      => $title,
347
                    content    => $content,
369
                    content    => $content,
348
                    lang       => $lang
370
                    lang       => $lang,
371
                    text_justify  => $text_justify,
372
                    font_size  => $font_size,
373
                    units      => $units,
374
                    notice_width  => $notice_width,
375
                    top_margin    => $top_margin,
376
                    left_margin   => $left_margin,
349
                }
377
                }
350
            )->store;
378
            )->store;
351
379
Lines 360-366 sub add_validate { Link Here
360
                    title                  => $title,
388
                    title                  => $title,
361
                    content                => $content,
389
                    content                => $content,
362
                    message_transport_type => $mtt,
390
                    message_transport_type => $mtt,
363
                    lang                   => $lang
391
                    lang                   => $lang,
392
                    text_justify  => $text_justify,
393
                    font_size  => $font_size,
394
                    units      => $units,
395
                    notice_width  => $notice_width,
396
                    top_margin    => $top_margin,
397
                    left_margin   => $left_margin,
364
                }
398
                }
365
            )->store;
399
            )->store;
366
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
400
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
367
- 

Return to bug 33478