X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgenerictranslations.pl;h=d4d59d8b090e2979d3be4e40e9ad4e64c419f0f5;hb=e286e6ca8a50f39829a4a83ab30b951ba2fd1329;hp=608611710333204b30764617d39492e442ba9194;hpb=98e3e57726bb6dbf55141ca6abc5cb74879d5c46;p=kivitendo-erp.git diff --git a/bin/mozilla/generictranslations.pl b/bin/mozilla/generictranslations.pl index 608611710..d4d59d8b0 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(); + + $main::auth->assert('config'); - $auth->assert('config'); + my $form = $main::form; + my $locale = $main::locale; $form->get_lists('languages' => 'LANGUAGES'); @@ -60,7 +68,67 @@ 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 }; + + my $translation_list_vc = GenericTranslations->list(translation_type => 'sepa_remittance_vc_no_pfx'); + my %translations_vc = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list_vc }; + + unshift @{ $form->{LANGUAGES} }, { 'id' => 'default', }; + + foreach my $language (@{ $form->{LANGUAGES} }) { + $language->{translation} = $translations{$language->{id}}; + $language->{translation_vc} = $translations_vc{$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')},); + GenericTranslations->save('translation_type' => 'sepa_remittance_vc_no_pfx', + 'translation_id' => undef, + 'language_id' => $language->{id}, + 'translation' => $form->{"translation__" . ($language->{id} || 'default') . "__vc" },); + } + + $form->{message} = $locale->text('The SEPA strings have been saved.'); + + edit_sepa_strings(); + + $main::lxdebug->leave_sub(); } 1;