X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=bin%2Fmozilla%2Fgenerictranslations.pl;h=de7d924bd22a94697aac0b20d91df272f7f93c9a;hb=e4d533e65a92149137848134f8a97efb67d89a23;hp=d3341f2125af84726d0f647cd1d5a98e6bc8b2a9;hpb=ee056f2390b1c698e70b1914a73f1a6f0c016f4b;p=kivitendo-erp.git diff --git a/bin/mozilla/generictranslations.pl b/bin/mozilla/generictranslations.pl index d3341f212..de7d924bd 100644 --- a/bin/mozilla/generictranslations.pl +++ b/bin/mozilla/generictranslations.pl @@ -10,16 +10,19 @@ use strict; # and will be preset in $form email dialog if the form name matches my %mail_strings = ( - salutation_male => t8('Salutation male'), - salutation_female => t8('Salutation female'), - salutation_general => t8('Salutation general'), - salutation_punctuation_mark => t8('Salutation punctuation mark'), - preset_text_sales_quotation => t8('Preset email text for sales quotations'), - preset_text_sales_order => t8('Preset email text for sales orders'), - preset_text_sales_delivery_order => t8('Preset email text for sales delivery orders'), - preset_text_invoice => t8('Preset email text for sales invoices'), - preset_text_request_quotation => t8('Preset email text for requests (rfq)'), - preset_text_purchase_order => t8('Preset email text for purchase orders'), + salutation_male => t8('Salutation male'), + salutation_female => t8('Salutation female'), + salutation_general => t8('Salutation general'), + salutation_punctuation_mark => t8('Salutation punctuation mark'), + preset_text_sales_quotation => t8('Preset email text for sales quotations'), + preset_text_sales_order => t8('Preset email text for sales orders'), + preset_text_sales_delivery_order => t8('Preset email text for sales delivery orders'), + preset_text_invoice => t8('Preset email text for sales invoices'), + preset_text_invoice_direct_debit => t8('Preset email text for sales invoices with direct debit'), + preset_text_request_quotation => t8('Preset email text for requests (rfq)'), + preset_text_purchase_order => t8('Preset email text for purchase orders'), + preset_text_periodic_invoices_email_body => t8('Preset email body for periodic invoices'), + preset_text_periodic_invoices_email_subject => t8('Preset email subject for periodic invoices'), ); sub edit_greetings { @@ -175,6 +178,7 @@ sub edit_email_strings { setup_generictranslations_edit_email_strings_action_bar(); $form->{title} = $locale->text('Edit preset email strings'); + $::request->{layout}->use_javascript(map { "${_}.js" } qw(ckeditor/ckeditor ckeditor/adapters/jquery)); $form->header(); print $form->parse_html_template('generictranslations/edit_email_strings',{ 'MAIL_STRINGS' => \%mail_strings }); @@ -208,6 +212,48 @@ sub save_email_strings { $main::lxdebug->leave_sub(); } +sub edit_zugferd_notes { + $::auth->assert('config'); + + $::form->get_lists('languages' => 'LANGUAGES'); + + my $translation_list = GenericTranslations->list(translation_type => 'ZUGFeRD/notes'); + my %translations = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list }; + + unshift @{ $::form->{LANGUAGES} }, { 'id' => 'default', }; + + foreach my $language (@{ $::form->{LANGUAGES} }) { + $language->{translation} = $translations{$language->{id}}; + } + + setup_generictranslations_edit_zugferd_notes_action_bar(); + + $::form->{title} = $::locale->text('Edit Factur-X/ZUGFeRD notes'); + $::form->header; + print $::form->parse_html_template('generictranslations/edit_zugferd_notes'); +} + +sub save_zugferd_notes { + $::auth->assert('config'); + + $::form->get_lists('languages' => 'LANGUAGES'); + + unshift @{ $::form->{LANGUAGES} }, { }; + + foreach my $language (@{ $::form->{LANGUAGES} }) { + GenericTranslations->save( + translation_type => 'ZUGFeRD/notes', + translation_id => undef, + language_id => $language->{id}, + translation => $::form->{"translation__" . ($language->{id} || 'default')}, + ); + } + + $::form->{message} = $::locale->text('The Factur-X/ZUGFeRD notes have been saved.'); + + edit_zugferd_notes(); +} + sub setup_generictranslations_edit_greetings_action_bar { my %params = @_; @@ -235,6 +281,7 @@ sub setup_generictranslations_edit_sepa_strings_action_bar { ); } } + sub setup_generictranslations_edit_email_strings_action_bar { my %params = @_; @@ -249,4 +296,18 @@ sub setup_generictranslations_edit_email_strings_action_bar { } } +sub setup_generictranslations_edit_zugferd_notes_action_bar { + my %params = @_; + + for my $bar ($::request->layout->get('actionbar')) { + $bar->add( + action => [ + t8('Save'), + submit => [ '#form', { action => "save_zugferd_notes" } ], + accesskey => 'enter', + ], + ); + } +} + 1;