X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgenerictranslations.pl;h=7b8d4a196a8d4f9358ca667ed9965d143f08fd82;hb=4bc7f0aadc85b49bd5bd57412f6de081eb733016;hp=608611710333204b30764617d39492e442ba9194;hpb=98e3e57726bb6dbf55141ca6abc5cb74879d5c46;p=kivitendo-erp.git diff --git a/bin/mozilla/generictranslations.pl b/bin/mozilla/generictranslations.pl index 608611710..7b8d4a196 100644 --- a/bin/mozilla/generictranslations.pl +++ b/bin/mozilla/generictranslations.pl @@ -2,10 +2,15 @@ use SL::Auth; use SL::Form; use SL::GenericTranslations; +use strict; + sub edit_greetings { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); + + $main::auth->assert('config'); - $auth->assert('config'); + my $form = $main::form; + my $locale = $main::locale; $form->get_lists('languages' => 'LANGUAGES'); @@ -33,13 +38,16 @@ sub edit_greetings { $form->header(); print $form->parse_html_template('generictranslations/edit_greetings'); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); } sub save_greetings { - $lxdebug->enter_sub(); + $main::lxdebug->enter_sub(); - $auth->assert('config'); + $main::auth->assert('config'); + + my $form = $main::form; + my $locale = $main::locale; $form->get_lists('languages' => 'LANGUAGES'); @@ -60,7 +68,59 @@ sub save_greetings { edit_greetings(); - $lxdebug->leave_sub(); + $main::lxdebug->leave_sub(); +} + +sub edit_sepa_strings { + $main::lxdebug->enter_sub(); + + $main::auth->assert('config'); + + my $form = $main::form; + my $locale = $main::locale; + + $form->get_lists('languages' => 'LANGUAGES'); + + my $translation_list = GenericTranslations->list(translation_type => 'sepa_remittance_info_pfx'); + my %translations = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list }; + + unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', }; + + foreach my $language (@{ $form->{LANGUAGES} }) { + $language->{translation} = $translations{$language->{id}}; + } + + $form->{title} = $locale->text('Edit SEPA strings'); + $form->header(); + print $form->parse_html_template('generictranslations/edit_sepa_strings'); + + $main::lxdebug->leave_sub(); +} + +sub save_sepa_strings { + $main::lxdebug->enter_sub(); + + $main::auth->assert('config'); + + my $form = $main::form; + my $locale = $main::locale; + + $form->get_lists('languages' => 'LANGUAGES'); + + unshift @{ $form->{LANGUAGES} }, { }; + + foreach my $language (@{ $form->{LANGUAGES} }) { + GenericTranslations->save('translation_type' => 'sepa_remittance_info_pfx', + 'translation_id' => undef, + 'language_id' => $language->{id}, + 'translation' => $form->{"translation__" . ($language->{id} || 'default')},); + } + + $form->{message} = $locale->text('The SEPA strings have been saved.'); + + edit_sepa_strings(); + + $main::lxdebug->leave_sub(); } 1;