Revision e5f53eb5
Von Moritz Bunkus vor etwa 4 Jahren hinzugefügt
bin/mozilla/generictranslations.pl | ||
---|---|---|
210 | 210 |
$main::lxdebug->leave_sub(); |
211 | 211 |
} |
212 | 212 |
|
213 |
sub edit_zugferd_notes { |
|
214 |
$::auth->assert('config'); |
|
215 |
|
|
216 |
$::form->get_lists('languages' => 'LANGUAGES'); |
|
217 |
|
|
218 |
my $translation_list = GenericTranslations->list(translation_type => 'ZUGFeRD/notes'); |
|
219 |
my %translations = map { ( ($_->{language_id} || 'default') => $_->{translation} ) } @{ $translation_list }; |
|
220 |
|
|
221 |
unshift @{ $::form->{LANGUAGES} }, { 'id' => 'default', }; |
|
222 |
|
|
223 |
foreach my $language (@{ $::form->{LANGUAGES} }) { |
|
224 |
$language->{translation} = $translations{$language->{id}}; |
|
225 |
} |
|
226 |
|
|
227 |
setup_generictranslations_edit_zugferd_notes_action_bar(); |
|
228 |
|
|
229 |
$::form->{title} = $::locale->text('Edit ZUGFeRD notes'); |
|
230 |
$::form->header; |
|
231 |
print $::form->parse_html_template('generictranslations/edit_zugferd_notes'); |
|
232 |
} |
|
233 |
|
|
234 |
sub save_zugferd_notes { |
|
235 |
$::auth->assert('config'); |
|
236 |
|
|
237 |
$::form->get_lists('languages' => 'LANGUAGES'); |
|
238 |
|
|
239 |
unshift @{ $::form->{LANGUAGES} }, { }; |
|
240 |
|
|
241 |
foreach my $language (@{ $::form->{LANGUAGES} }) { |
|
242 |
GenericTranslations->save( |
|
243 |
translation_type => 'ZUGFeRD/notes', |
|
244 |
translation_id => undef, |
|
245 |
language_id => $language->{id}, |
|
246 |
translation => $::form->{"translation__" . ($language->{id} || 'default')}, |
|
247 |
); |
|
248 |
} |
|
249 |
|
|
250 |
$::form->{message} = $::locale->text('The ZUGFeRD notes have been saved.'); |
|
251 |
|
|
252 |
edit_zugferd_notes(); |
|
253 |
} |
|
254 |
|
|
213 | 255 |
sub setup_generictranslations_edit_greetings_action_bar { |
214 | 256 |
my %params = @_; |
215 | 257 |
|
... | ... | |
237 | 279 |
); |
238 | 280 |
} |
239 | 281 |
} |
282 |
|
|
240 | 283 |
sub setup_generictranslations_edit_email_strings_action_bar { |
241 | 284 |
my %params = @_; |
242 | 285 |
|
... | ... | |
251 | 294 |
} |
252 | 295 |
} |
253 | 296 |
|
297 |
sub setup_generictranslations_edit_zugferd_notes_action_bar { |
|
298 |
my %params = @_; |
|
299 |
|
|
300 |
for my $bar ($::request->layout->get('actionbar')) { |
|
301 |
$bar->add( |
|
302 |
action => [ |
|
303 |
t8('Save'), |
|
304 |
submit => [ '#form', { action => "save_zugferd_notes" } ], |
|
305 |
accesskey => 'enter', |
|
306 |
], |
|
307 |
); |
|
308 |
} |
|
309 |
} |
|
310 |
|
|
254 | 311 |
1; |
Auch abrufbar als: Unified diff
ZUGFeRD: allgemeine Notizen für alle Rechnungen in Übersetzungen anlegen können