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

(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt (-15 / +18 lines)
Lines 686-702 Link Here
686
                        <ol>
686
                        <ol>
687
                            <li id="css-helpers">
687
                            <li id="css-helpers">
688
                                <label>Insert selectors to apply styles to: </label>
688
                                <label>Insert selectors to apply styles to: </label>
689
                                <a class="css-helper" id="headings">Headings</a>
689
                                <a class="css-helper headings" data-lang="[% lang | html %]">Headings</a>
690
                                <a class="css-helper" id="tables">Tables</a>
690
                                <a class="css-helper tables" data-lang="[% lang | html %]">Tables</a>
691
                                <a class="css-helper" id="text">All text</a>
691
                                <a class="css-helper text" data-lang="[% lang | html %]">All text</a>
692
                            </li>
692
                            </li>
693
                            <li>
693
                            <li class="style_notices_option">
694
                                <label for="style">Style (CSS): </label>
694
                                <label for="style_[% lang | html %]">Style (CSS): </label>
695
                                <textarea id="style" name="style" rows="15" cols="80">[% letters.$lang.params.style | $raw %]</textarea>
695
                                <textarea id="style_[% lang | html %]" name="style_[% lang | html %]" rows="15" cols="80">[% letters.$lang.params.style | $raw %]</textarea>
696
                            </li>
696
                            </li>
697
                            <li>
697
                            <li class="format_all_notices_option">
698
                                <label for="format_all">Apply format settings to all notices:</label>
698
                                <label for="format_all_[% lang | html %]">Apply format settings to all notices[% IF Koha.Preference('TranslateNotices') %] for this language[% END %]:</label>
699
                                <input type="checkbox" name="format_all" id="format_all" value="1" />
699
                                <input type="checkbox" name="format_all_[% lang | html %]" id="format_all_[% lang | html %]" class="format_all" value="1" />
700
                                <span class="hint">Existing format settings will be overwritten.</span>
700
                                <span class="hint">Existing format settings will be overwritten.</span>
701
                            </li>
701
                            </li>
702
                        </ol>
702
                        </ol>
Lines 726-748 Link Here
726
        var new_branchcode = '[% new_branchcode | html %]';
726
        var new_branchcode = '[% new_branchcode | html %]';
727
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %];
727
        var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %];
728
        $(document).ready(function(){
728
        $(document).ready(function(){
729
            $("#headings").click(function(){
729
            $(".headings").click(function(){
730
                $("#style").val(function(i, text) {
730
                var lang = $(this).data('lang');
731
                $("#style_"+lang).val(function(i, text) {
731
                    return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
732
                    return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
732
                    '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6 {\n' +
733
                    '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6 {\n' +
733
                    '// insert CSS here\n' +
734
                    '// insert CSS here\n' +
734
                    '}';
735
                    '}';
735
                });
736
                });
736
            });
737
            });
737
            $("#tables").click(function(){
738
            $(".tables").click(function(){
738
                $("#style").val(function(i, text) {
739
                var lang = $(this).data('lang');
740
                $("#style_"+lang).val(function(i, text) {
739
                    return text + '\nbody, table, th, td, th:last-child, td:last-child {\n' +
741
                    return text + '\nbody, table, th, td, th:last-child, td:last-child {\n' +
740
                    '// insert CSS here\n' +
742
                    '// insert CSS here\n' +
741
                    '}';
743
                    '}';
742
                });
744
                });
743
            });
745
            });
744
            $("#text").click(function(){
746
            $(".text").click(function(){
745
                $("#style").val(function(i, text) {
747
                var lang = $(this).data('lang');
748
                $("#style_"+lang).val(function(i, text) {
746
                    return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
749
                    return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' +
747
                    '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6,\n' +
750
                    '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6,\n' +
748
                    'table, th, td, th:last-child, td:last-child {\n' +
751
                    'table, th, td, th:last-child, td:last-child {\n' +
(-)a/koha-tmpl/intranet-tmpl/prog/js/letter.js (-2 / +2 lines)
Lines 49-55 function confirmOverwrite( new_lettercode, new_branchcode ){ Link Here
49
}
49
}
50
50
51
function confirmFormatOverwrite( event ) {
51
function confirmFormatOverwrite( event ) {
52
    if ( confirm(__("Existing format settings for all notices will be overwritten by these format settings.")) ) {
52
    if ( confirm(__("Existing format settings for all notices of the same language will be overwritten by these format settings.")) ) {
53
        return true;
53
        return true;
54
    } else {
54
    } else {
55
        return false;
55
        return false;
Lines 94-100 $(document).ready(function() { Link Here
94
    });
94
    });
95
95
96
    $("#submit_form").on("click",function(e){
96
    $("#submit_form").on("click",function(e){
97
        if ( $("#format_all").is(":checked") ){
97
        if ( $(".format_all").is(":checked") ){
98
            if ( confirmFormatOverwrite(e) ) {
98
            if ( confirmFormatOverwrite(e) ) {
99
                $("#add_notice").submit();
99
                $("#add_notice").submit();
100
            } else {
100
            } else {
(-)a/tools/letter.pl (-8 / +7 lines)
Lines 307-324 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 $style         = $input->param('style');
311
    my $format_all    = $input->param('format_all');
312
    my @mtt           = $input->multi_param('message_transport_type');
310
    my @mtt           = $input->multi_param('message_transport_type');
313
    my @title         = $input->multi_param('title');
311
    my @title         = $input->multi_param('title');
314
    my @content       = $input->multi_param('content');
312
    my @content       = $input->multi_param('content');
315
    my @lang          = $input->multi_param('lang');
313
    my @lang          = $input->multi_param('lang');
316
    for my $mtt ( @mtt ) {
314
    for my $mtt ( @mtt ) {
317
        my $lang = shift @lang;
315
        my $lang       = shift @lang;
318
        if ( $format_all ) {
316
        my $style      = $input->param("style_$lang");
319
            my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list;
317
        my $format_all = $input->param("format_all_$lang");
320
            foreach my $letter ( @letters ) {
318
        if ($format_all) {
321
                $letter->set({ style => $style })->store;
319
            my @letters = Koha::Notice::Templates->search( { lang => $lang } )->as_list;
320
            foreach my $letter (@letters) {
321
                $letter->set( { style => $style } )->store;
322
            }
322
            }
323
        }
323
        }
324
        my $is_html = $input->param("is_html_$mtt\_$lang");
324
        my $is_html = $input->param("is_html_$mtt\_$lang");
325
- 

Return to bug 33478