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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (+74 lines)
Lines 49-54 Link Here
49
[% END %]
49
[% END %]
50
</head>
50
</head>
51
51
52
[% BLOCK translate_justification_types %]
53
    [%  SWITCH type %]
54
        [%   CASE 'L' %]<span>Left</span>
55
        [%   CASE 'C' %]<span>Center</span>
56
        [%   CASE 'R' %]<span>Right</span>
57
    [%  END %]
58
[% END %]
59
60
[% BLOCK translate_unit_types %]
61
    [% SWITCH type %]
62
        [%   CASE 'POINT' %]<span>PostScript points</span>
63
        [%   CASE 'INCH' %]<span>US Inches</span>
64
        [%   CASE 'MM' %]<span>SI Millimeters</span>
65
        [%   CASE 'CM' %]<span>SI Centimeters</span>
66
    [% END %]
67
[% END %]
68
52
<body id="tools_letter" class="tools">
69
<body id="tools_letter" class="tools">
53
    [% WRAPPER 'header.inc' %]
70
    [% WRAPPER 'header.inc' %]
54
    [% INCLUDE 'letters-search.inc' %]
71
    [% INCLUDE 'letters-search.inc' %]
Lines 643-653 Link Here
643
                                    </li>
660
                                    </li>
644
                                [% END %]
661
                                [% END %]
645
                            </ol>
662
                            </ol>
663
                            [% IF letter.message_transport_type == "print" && CAN_user_tools_format_notices %]
664
                                [% SET param = letters.$lang.params %]
665
                                <div class="col-md-6">
666
                                    <ol>
667
                                        <li>
668
                                            <label for="text_justify">Text justification: </label>
669
                                            <select name="text_justify" id="text_justify">
670
                                                [% FOREACH text_justification_type IN text_justification_types %]
671
                                                    [% IF ( text_justification_type.type == param.text_justify ) %]
672
                                                    <option value="[% text_justification_type.type | html %]" selected="selected">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
673
                                                    [% ELSE %]
674
                                                    <option value="[% text_justification_type.type | html %]">[% PROCESS translate_justification_types type=text_justification_type.type %]</option>
675
                                                    [% END %]
676
                                                [% END %]
677
                                            </select>
678
                                        </li>
679
                                        <li>
680
                                            <label for="font_size">Font size: </label>
681
                                            <input type="text" name="font_size" id="font_size" size="2" value="[% param.font_size | html %]" />
682
                                        </li>
683
                                        <li>
684
                                            <label for="format_all">Apply format settings to all notices:</label>
685
                                            <input type="checkbox" name="format_all" id="format_all" value="1" />
686
                                            <span class="hint">Existing format settings will be overwritten.</span>
687
                                        </li>
688
                                    </ol>
689
                                </div>
690
                                <div class="col-md-6">
691
                                    <ol>
692
                                        <li>
693
                                            <label for="units">Units:</label>
694
                                            <select id="units" name="units">
695
                                                [% FOREACH unit IN units %]
696
                                                    [% IF ( unit.type == param.units ) %]
697
                                                    <option value="[% unit.type | html %]" selected="selected">[% PROCESS translate_unit_types type=unit.type %]</option>
698
                                                    [% ELSE %]
699
                                                    <option value="[% unit.type | html %]">[% PROCESS translate_unit_types type=unit.type %]</option>
700
                                                    [% END %]
701
                                                [% END %]
702
                                            </select>
703
                                        </li>
704
                                        <li>
705
                                            <label for="notice_width">Notice width:</label>
706
                                            <input type="text" size="4" name="notice_width" id="notice_width" value="[% param.notice_width | html %]" />
707
                                        </li>
708
                                        <li>
709
                                            <label for="top_margin">Top margin:</label>
710
                                            <input type="text" size="4" name="top_margin" id="top_margin" value="[% param.top_margin | html %]" />
711
                                        </li>
712
                                        <li>
713
                                            <label for="left_margin">Left margin:</label>
714
                                            <input type="text" size="4" name="left_margin" id="left_margin" value="[% param.left_margin | html %]" />
715
                                        </li>
716
                                    </ol>
717
                                </div>
718
                            [% END # letter.message_transport_type == "print" && CAN_user_tools_format_notices %]
646
                        </fieldset> <!-- /.rows.mtt -->
719
                        </fieldset> <!-- /.rows.mtt -->
647
                    </div> <!-- /.panel-body -->
720
                    </div> <!-- /.panel-body -->
648
                </div> <!-- /.panel-collapse -->
721
                </div> <!-- /.panel-collapse -->
649
            </div> <!-- /.panel.panel-default -->
722
            </div> <!-- /.panel.panel-default -->
650
        [% END # /FOR mtt %]
723
        [% END # /FOR mtt %]
724
651
    </div> <!-- /.panel-group#lang_lang -->
725
    </div> <!-- /.panel-group#lang_lang -->
652
[% END %]
726
[% END %]
653
727
(-)a/tools/letter.pl (-4 / +43 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
52
use C4::Creators qw(
53
    get_text_justification_types
54
    get_unit_values
55
);
53
use Koha::Notice::Templates;
56
use Koha::Notice::Templates;
54
use Koha::Patron::Attribute::Types;
57
use Koha::Patron::Attribute::Types;
55
58
Lines 228-233 sub add_form { Link Here
228
                content    => $letter->{content} // '',
231
                content    => $letter->{content} // '',
229
                tt_error   => $letter->{tt_error},
232
                tt_error   => $letter->{tt_error},
230
            };
233
            };
234
            $letters{ $lang }{params} = $letter;
231
        }
235
        }
232
    }
236
    }
233
    else {
237
    else {
Lines 299-304 sub add_form { Link Here
299
        SQLfieldnames => $field_selection,
303
        SQLfieldnames => $field_selection,
300
        branchcode => $branchcode,
304
        branchcode => $branchcode,
301
        preview_is_available => $preview_is_available,
305
        preview_is_available => $preview_is_available,
306
        text_justification_types => get_text_justification_types(),
307
        units => get_unit_values(),
302
    );
308
    );
303
    return;
309
    return;
304
}
310
}
Lines 310-321 sub add_validate { Link Here
310
    my $oldmodule     = $input->param('oldmodule');
316
    my $oldmodule     = $input->param('oldmodule');
311
    my $code          = $input->param('code');
317
    my $code          = $input->param('code');
312
    my $name          = $input->param('name');
318
    my $name          = $input->param('name');
319
    my $text_justify  = $input->param('text_justify');
320
    my $font_size     = $input->param('font_size');
321
    my $units         = $input->param('units');
322
    my $notice_width  = $input->param('notice_width');
323
    my $top_margin    = $input->param('top_margin');
324
    my $left_margin   = $input->param('left_margin');
325
    my $format_all    = $input->param('format_all');
313
    my @mtt           = $input->multi_param('message_transport_type');
326
    my @mtt           = $input->multi_param('message_transport_type');
314
    my @title         = $input->multi_param('title');
327
    my @title         = $input->multi_param('title');
315
    my @content       = $input->multi_param('content');
328
    my @content       = $input->multi_param('content');
316
    my @lang          = $input->multi_param('lang');
329
    my @lang          = $input->multi_param('lang');
317
    for my $mtt ( @mtt ) {
330
    for my $mtt ( @mtt ) {
318
        my $lang = shift @lang;
331
        my $lang = shift @lang;
332
        if ( $format_all ) {
333
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
334
            foreach my $letter ( @letters ) {
335
                $letter->set(
336
                    {
337
                        text_justify  => $text_justify,
338
                        font_size  => $font_size,
339
                        units      => $units,
340
                        notice_width  => $notice_width,
341
                        top_margin    => $top_margin,
342
                        left_margin   => $left_margin,
343
                    }
344
                )->store;
345
            }
346
        }
319
        my $is_html = $input->param("is_html_$mtt\_$lang");
347
        my $is_html = $input->param("is_html_$mtt\_$lang");
320
        my $title   = shift @title;
348
        my $title   = shift @title;
321
        my $content = shift @content;
349
        my $content = shift @content;
Lines 348-354 sub add_validate { Link Here
348
                    is_html    => $is_html || 0,
376
                    is_html    => $is_html || 0,
349
                    title      => $title,
377
                    title      => $title,
350
                    content    => $content,
378
                    content    => $content,
351
                    lang       => $lang
379
                    lang       => $lang,
380
                    text_justify  => $text_justify,
381
                    font_size  => $font_size,
382
                    units      => $units,
383
                    notice_width  => $notice_width,
384
                    top_margin    => $top_margin,
385
                    left_margin   => $left_margin,
352
                }
386
                }
353
            )->store;
387
            )->store;
354
388
Lines 363-369 sub add_validate { Link Here
363
                    title                  => $title,
397
                    title                  => $title,
364
                    content                => $content,
398
                    content                => $content,
365
                    message_transport_type => $mtt,
399
                    message_transport_type => $mtt,
366
                    lang                   => $lang
400
                    lang                   => $lang,
401
                    text_justify  => $text_justify,
402
                    font_size  => $font_size,
403
                    units      => $units,
404
                    notice_width  => $notice_width,
405
                    top_margin    => $top_margin,
406
                    left_margin   => $left_margin,
367
                }
407
                }
368
            )->store;
408
            )->store;
369
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
409
            logaction( 'NOTICES', 'CREATE', $letter->id, $letter->content,
370
- 

Return to bug 33478