diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt index 107bc47220..47606c98f0 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/letter.tt @@ -680,17 +680,17 @@
  1. - Headings - Tables - All text + Headings + Tables + All text
  2. -
  3. - - +
  4. + +
  5. -
  6. - - +
  7. + + Existing format settings will be overwritten.
@@ -719,23 +719,26 @@ var new_branchcode = '[% new_branchcode | html %]'; var table_settings = [% TablesSettings.GetTableSettings( 'tools', 'notices', 'lettert', 'json' ) | $raw %]; $(document).ready(function(){ - $("#headings").click(function(){ - $("#style").val(function(i, text) { + $(".headings").click(function(){ + var lang = $(this).data('lang'); + $("#style_"+lang).val(function(i, text) { return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' + '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6 {\n' + '// insert CSS here\n' + '}'; }); }); - $("#tables").click(function(){ - $("#style").val(function(i, text) { + $(".tables").click(function(){ + var lang = $(this).data('lang'); + $("#style_"+lang).val(function(i, text) { return text + '\nbody, table, th, td, th:last-child, td:last-child {\n' + '// insert CSS here\n' + '}'; }); }); - $("#text").click(function(){ - $("#style").val(function(i, text) { + $(".text").click(function(){ + var lang = $(this).data('lang'); + $("#style_"+lang).val(function(i, text) { return text + 'pre, #slip, #slip h1, #slip h2, #slip h3, #slip h4, #slip h5, #slip h6,\n' + '#receipt, #receipt h1, #receipt h2, #receipt h3, #receipt h4, #receipt h5, #receipt h6,\n' + 'table, th, td, th:last-child, td:last-child {\n' + diff --git a/koha-tmpl/intranet-tmpl/prog/js/letter.js b/koha-tmpl/intranet-tmpl/prog/js/letter.js index 5ea32df655..44524c0452 100644 --- a/koha-tmpl/intranet-tmpl/prog/js/letter.js +++ b/koha-tmpl/intranet-tmpl/prog/js/letter.js @@ -49,7 +49,7 @@ function confirmOverwrite( new_lettercode, new_branchcode ){ } function confirmFormatOverwrite( event ) { - if ( confirm(__("Existing format settings for all notices will be overwritten by these format settings.")) ) { + if ( confirm(__("Existing format settings for all notices of the same language will be overwritten by these format settings.")) ) { return true; } else { return false; @@ -94,7 +94,7 @@ $(document).ready(function() { }); $("#submit_form").on("click",function(e){ - if ( $("#format_all").is(":checked") ){ + if ( $(".format_all").is(":checked") ){ if ( confirmFormatOverwrite(e) ) { $("#add_notice").submit(); } else { diff --git a/tools/letter.pl b/tools/letter.pl index 430bc2e32e..dcd95fa613 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -307,18 +307,18 @@ sub add_validate { my $oldmodule = $input->param('oldmodule'); my $code = $input->param('code'); my $name = $input->param('name'); - my $style = $input->param('style'); - my $format_all = $input->param('format_all'); my @mtt = $input->multi_param('message_transport_type'); my @title = $input->multi_param('title'); my @content = $input->multi_param('content'); my @lang = $input->multi_param('lang'); for my $mtt ( @mtt ) { - my $lang = shift @lang; - if ( $format_all ) { - my @letters = Koha::Notice::Templates->search({ lang => $lang })->as_list; - foreach my $letter ( @letters ) { - $letter->set({ style => $style })->store; + my $lang = shift @lang; + my $style = $input->param("style_$lang"); + my $format_all = $input->param("format_all_$lang"); + if ($format_all) { + my @letters = Koha::Notice::Templates->search( { lang => $lang } )->as_list; + foreach my $letter (@letters) { + $letter->set( { style => $style } )->store; } } my $is_html = $input->param("is_html_$mtt\_$lang");