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 636-641 Link Here
636
                </div> <!-- /.panel-collapse -->
655
                </div> <!-- /.panel-collapse -->
637
            </div> <!-- /.panel.panel-default -->
656
            </div> <!-- /.panel.panel-default -->
638
        [% END # /FOR mtt %]
657
        [% END # /FOR mtt %]
658
659
        <div class="panel panel-default">
660
            <div class="panel-heading" role="tab" id="format_[% lang | html %]Heading">
661
                <h3 class="panel-title">
662
                    <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 %]">
663
                        <span>Format</span>
664
                    </a>
665
                </h3>
666
            </div> <!-- /.panel-heading -->
667
            <div id="format_[% lang | html %]" class="panel-collapse collapse" role="tabpanel" aria-labelledby="format_[% lang | html %]Heading">
668
                <div class="panel-body">
669
                    <fieldset class="rows">
670
                    <div class="dialog message">These format settings apply when a notice is printed.</div>
671
                        [% SET param = letters.$lang.params %]
672
                        <div class="col-md-6">
673
                            <ol>
674
                                <li>
675
                                    <label for="text_justify">Text justification: </label>
676
                                    <select name="text_justify" id="text_justify">
677
                                        [% FOREACH text_justification_type IN text_justification_types %]
678
                                            [% IF ( text_justification_type == param.text_justify ) %]
679
                                            <option value="[% text_justification_type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type %]</option>
680
                                            [% ELSE %]
681
                                            <option value="[% text_justification_type | html %]">[% PROCESS translate_justification_types type=text_justification_type %]</option>
682
                                            [% END %]
683
                                        [% END %]
684
                                    </select>
685
                                </li>
686
                                <li>
687
                                    <label for="font_size">Font size: </label>
688
                                    <input type="text" name="font_size" id="font_size" size="2" value="[% param.font_size | html %]" />
689
                                </li>
690
                                <li>
691
                                    <label for="format_all">Apply format settings to all notices:</label>
692
                                    <input type="checkbox" name="format_all" id="format_all" value="1" />
693
                                    <span class="hint">Existing format settings will be overwritten.</span>
694
                                </li>
695
                            </ol>
696
                        </div>
697
                        <div class="col-md-6">
698
                            <ol>
699
                                <li>
700
                                    <label for="units">Units:</label>
701
                                    <select id="units" name="units">
702
                                        [% FOREACH unit IN units %]
703
                                            [% IF ( unit == param.units ) %]
704
                                            <option value="[% unit | html %]" selected="selected">[% PROCESS translate_unit_types type=unit %]</option>
705
                                            [% ELSE %]
706
                                            <option value="[% unit | html %]">[% PROCESS translate_unit_types type=unit %]</option>
707
                                            [% END %]
708
                                        [% END %]
709
                                    </select>
710
                                </li>
711
                                <li>
712
                                    <label for="notice_width">Notice width:</label>
713
                                    <input type="text" size="4" name="notice_width" id="notice_width" value="[% param.notice_width | html %]" />
714
                                </li>
715
                                <li>
716
                                    <label for="top_margin">Top margin:</label>
717
                                    <input type="text" size="4" name="top_margin" id="top_margin" value="[% param.top_margin | html %]" />
718
                                </li>
719
                                <li>
720
                                    <label for="left_margin">Left margin:</label>
721
                                    <input type="text" size="4" name="left_margin" id="left_margin" value="[% param.left_margin | html %]" />
722
                                </li>
723
                            </ol>
724
                        </div>
725
                    </fieldset> <!-- /.rows.mtt -->
726
                </div> <!-- /.panel-body -->
727
            </div> <!-- /.panel-collapse -->
728
        </div> <!-- /.panel.panel-default -->
729
639
    </div> <!-- /.panel-group#lang_lang -->
730
    </div> <!-- /.panel-group#lang_lang -->
640
[% END %]
731
[% END %]
641
732
(-)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 310-321 sub add_validate { Link Here
310
    my $oldmodule     = $input->param('oldmodule');
310
    my $oldmodule     = $input->param('oldmodule');
311
    my $code          = $input->param('code');
311
    my $code          = $input->param('code');
312
    my $name          = $input->param('name');
312
    my $name          = $input->param('name');
313
    my $text_justify  = $input->param('text_justify');
314
    my $font_size     = $input->param('font_size');
315
    my $units         = $input->param('units');
316
    my $notice_width  = $input->param('notice_width');
317
    my $top_margin    = $input->param('top_margin');
318
    my $left_margin   = $input->param('left_margin');
319
    my $format_all    = $input->param('format_all');
313
    my @mtt           = $input->multi_param('message_transport_type');
320
    my @mtt           = $input->multi_param('message_transport_type');
314
    my @title         = $input->multi_param('title');
321
    my @title         = $input->multi_param('title');
315
    my @content       = $input->multi_param('content');
322
    my @content       = $input->multi_param('content');
316
    my @lang          = $input->multi_param('lang');
323
    my @lang          = $input->multi_param('lang');
317
    for my $mtt ( @mtt ) {
324
    for my $mtt ( @mtt ) {
318
        my $lang = shift @lang;
325
        my $lang = shift @lang;
326
        if ( $format_all ) {
327
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
328
            foreach my $letter ( @letters ) {
329
                $letter->set(
330
                    {
331
                        text_justify  => $text_justify,
332
                        font_size  => $font_size,
333
                        units      => $units,
334
                        notice_width  => $notice_width,
335
                        top_margin    => $top_margin,
336
                        left_margin   => $left_margin,
337
                    }
338
                )->store;
339
            }
340
        }
319
        my $is_html = $input->param("is_html_$mtt\_$lang");
341
        my $is_html = $input->param("is_html_$mtt\_$lang");
320
        my $title   = shift @title;
342
        my $title   = shift @title;
321
        my $content = shift @content;
343
        my $content = shift @content;
Lines 348-354 sub add_validate { Link Here
348
                    is_html    => $is_html || 0,
370
                    is_html    => $is_html || 0,
349
                    title      => $title,
371
                    title      => $title,
350
                    content    => $content,
372
                    content    => $content,
351
                    lang       => $lang
373
                    lang       => $lang,
374
                    text_justify  => $text_justify,
375
                    font_size  => $font_size,
376
                    units      => $units,
377
                    notice_width  => $notice_width,
378
                    top_margin    => $top_margin,
379
                    left_margin   => $left_margin,
352
                }
380
                }
353
            )->store;
381
            )->store;
354
382
Lines 363-369 sub add_validate { Link Here
363
                    title                  => $title,
391
                    title                  => $title,
364
                    content                => $content,
392
                    content                => $content,
365
                    message_transport_type => $mtt,
393
                    message_transport_type => $mtt,
366
                    lang                   => $lang
394
                    lang                   => $lang,
395
                    text_justify  => $text_justify,
396
                    font_size  => $font_size,
397
                    units      => $units,
398
                    notice_width  => $notice_width,
399
                    top_margin    => $top_margin,
400
                    left_margin   => $left_margin,
367
                }
401
                }
368
            )->store;
402
            )->store;
369
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
403
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
370
- 

Return to bug 33478