From 73953245ed8615415ec216e12739ea4cc44fdf3e Mon Sep 17 00:00:00 2001 From: Bin Wen Date: Tue, 8 Oct 2019 11:46:58 -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'. Signed-off-by: Katrin Fischer --- tools/letter.pl | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/tools/letter.pl b/tools/letter.pl index a673fa96a9..a7ae9c93a1 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.11.0