From 2e74a9df1e4afde763e869241b70bfb1bbe3dc30 Mon Sep 17 00:00:00 2001 From: Bin Wen Date: Tue, 8 Oct 2019 11:20:11 -0400 Subject: [PATCH] Bug 23765 - After TranslateNotices is set to 'Don't allow', email settings still show multiple languages To test: 1. Enable multi-languages 2. Set the preference 'TranslateNotices' on 'Allow' 3. Go to: tools==>Notices & slips==>Edit, make sure it has multilingual email templates. 4. Set the preference TranslateNotices on 'Don't allow'. 5. Go to: tools==>Notices & slips==>Edit ,the template still shows all the languages. 6. Apply the patch. 7. Repeat the steps 4 and 5 8. Success. It only shows the default template when TranslateNotices is 'Dont allow'. https://bugs.koha-community.org/show_bug.cgi?id=23675 --- tools/letter.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/letter.pl b/tools/letter.pl index a673fa96a9..8c61248bb5 100755 --- a/tools/letter.pl +++ b/tools/letter.pl @@ -205,12 +205,17 @@ sub add_form { my $lang = $letter->{lang}; my $mtt = $letter->{message_transport_type}; - $letters{ $lang }{templates}{$mtt} = { - message_transport_type => $letter->{message_transport_type}, - is_html => $letter->{is_html}, - title => $letter->{title}, - content => $letter->{content} // '', - }; + if( $lang ne 'default' && !C4::Context->preference('TranslateNotices')) { + next; + } + else { + $letters{ $lang }{templates}{$mtt} = { + message_transport_type => $letter->{message_transport_type}, + is_html => $letter->{is_html}, + title => $letter->{title}, + content => $letter->{content} // '', + }; + } } } else { -- 2.17.1