Revision e5f53eb5
Von Moritz Bunkus vor fast 5 Jahren hinzugefügt
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
use parent qw(Exporter);
|
||
our @EXPORT = qw(create_zugferd_data create_zugferd_xmp_data);
|
||
|
||
use SL::DB::GenericTranslation;
|
||
use SL::DB::Tax;
|
||
use SL::DB::TaxKey;
|
||
use SL::Helper::ISO3166;
|
||
... | ... | |
use Carp;
|
||
use Encode qw(encode);
|
||
use List::MoreUtils qw(pairwise);
|
||
use List::Util qw(sum);
|
||
use List::Util qw(first sum);
|
||
use Template;
|
||
use XML::Writer;
|
||
|
||
... | ... | |
# </rsm:ExchangedDocumentContext>
|
||
}
|
||
|
||
sub _included_note {
|
||
my ($self, %params) = @_;
|
||
|
||
$params{xml}->startTag("ram:IncludedNote");
|
||
$params{xml}->dataElement("ram:Content", _u8($params{note}));
|
||
$params{xml}->endTag;
|
||
}
|
||
|
||
sub _exchanged_document {
|
||
my ($self, %params) = @_;
|
||
|
||
... | ... | |
$params{xml}->dataElement("ram:LanguageID", uc($1));
|
||
}
|
||
|
||
if ($self->transaction_description) {
|
||
$params{xml}->startTag("ram:IncludedNote");
|
||
$params{xml}->dataElement("ram:Content", _u8($self->transaction_description));
|
||
$params{xml}->endTag;
|
||
}
|
||
my $std_notes = SL::DB::Manager::GenericTranslation->get_all(
|
||
where => [
|
||
translation_type => 'ZUGFeRD/notes',
|
||
or => [
|
||
language_id => undef,
|
||
language_id => $self->language_id,
|
||
],
|
||
'!translation' => undef,
|
||
'!translation' => '',
|
||
],
|
||
);
|
||
|
||
my $std_note = first { $_->language_id == $self->language_id } @{ $std_notes };
|
||
$std_note //= first { !defined $_->language_id } @{ $std_notes };
|
||
|
||
my $notes = $self->notes_as_stripped_html;
|
||
if ($notes) {
|
||
$params{xml}->startTag("ram:IncludedNote");
|
||
$params{xml}->dataElement("ram:Content", _u8($notes));
|
||
$params{xml}->endTag;
|
||
}
|
||
|
||
_included_note($self, %params, note => $self->transaction_description) if $self->transaction_description;
|
||
_included_note($self, %params, note => $notes) if $notes;
|
||
_included_note($self, %params, note => $std_note->translation) if $std_note;
|
||
|
||
$params{xml}->endTag;
|
||
# </rsm:ExchangedDocument>
|
bin/mozilla/generictranslations.pl | ||
---|---|---|
$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 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 ZUGFeRD notes have been saved.');
|
||
|
||
edit_zugferd_notes();
|
||
}
|
||
|
||
sub setup_generictranslations_edit_greetings_action_bar {
|
||
my %params = @_;
|
||
|
||
... | ... | |
);
|
||
}
|
||
}
|
||
|
||
sub setup_generictranslations_edit_email_strings_action_bar {
|
||
my %params = @_;
|
||
|
||
... | ... | |
}
|
||
}
|
||
|
||
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;
|
locale/de/all | ||
---|---|---|
'Edit Vendor' => 'Lieferant editieren',
|
||
'Edit Vendor Invoice' => 'Einkaufsrechnung bearbeiten',
|
||
'Edit Warehouse' => 'Lager bearbeiten',
|
||
'Edit ZUGFeRD notes' => 'ZUGFeRD-Notizen bearbeiten',
|
||
'Edit acceptance status' => 'Abnahmestatus bearbeiten',
|
||
'Edit additional articles' => 'Zusätzliche Artikel bearbeiten',
|
||
'Edit all drafts' => 'Entwürfe von allen Benutzern bearbeiten',
|
||
... | ... | |
'The SQL query does not contain any parameter that need to be configured.' => 'Die SQL-Abfrage enthält keine Parameter, die angegeben werden müssten.',
|
||
'The URL is missing.' => 'URL fehlt',
|
||
'The WebDAV feature has been used.' => 'Das WebDAV-Feature wurde benutzt.',
|
||
'The ZUGFeRD notes have been saved.' => 'Die ZUGFeRD-Notizen wurden gespeichert.',
|
||
'The abbreviation is missing.' => 'Abkürzung fehlt',
|
||
'The access rights a user has within a client instance is still governed by his group membership.' => 'Welche Zugriffsrechte ein Benutzer innerhalb eines Mandanten hat, wird weiterhin über Gruppenmitgliedschaften geregelt.',
|
||
'The access rights have been saved.' => 'Die Zugriffsrechte wurden gespeichert.',
|
||
... | ... | |
'Your import is being processed.' => 'Ihr Import wird verarbeitet',
|
||
'Your target quantity will be added to the stocked quantity.' => 'Ihre gezählte Zielmenge wird zum Lagerbestand hinzugezählt.',
|
||
'ZUGFeRD invoice' => 'ZUGFeRD-Rechnung',
|
||
'ZUGFeRD notes for each invoice' => 'ZUGFeRD-Notizen für jede Rechnung',
|
||
'Zeitraum' => 'Zeitraum',
|
||
'Zero amount posting!' => 'Buchung ohne Wert',
|
||
'Zip' => 'PLZ',
|
menus/user/00-erp.yaml | ||
---|---|---|
module: generictranslations.pl
|
||
params:
|
||
action: edit_sepa_strings
|
||
- parent: system_languages_and_translations
|
||
id: system_languages_and_translations_zugferd_notes
|
||
name: ZUGFeRD notes for each invoice
|
||
order: 450
|
||
module: generictranslations.pl
|
||
params:
|
||
action: edit_zugferd_notes
|
||
- parent: system_languages_and_translations
|
||
id: system_languages_and_translations_email_strings
|
||
name: Preset email strings
|
templates/webpages/generictranslations/edit_zugferd_notes.html | ||
---|---|---|
[%- USE T8 %]
|
||
[%- USE HTML %]
|
||
<h1>[% HTML.escape(title) %]</h1>
|
||
|
||
[%- IF message %]
|
||
<p>
|
||
[% HTML.escape(message) %]
|
||
</p>
|
||
[%- END %]
|
||
|
||
<form method="post" action="generictranslations.pl" id="form">
|
||
|
||
<table>
|
||
|
||
<tr>
|
||
<th class="listheading"> </th>
|
||
<th class="listheading">[% 'ZUGFeRD notes for each invoice' | $T8 %]</th>
|
||
</tr>
|
||
|
||
[%- FOREACH language = LANGUAGES %]
|
||
<tr>
|
||
<td>
|
||
[%- IF language.id == 'default' %]
|
||
[% 'Default (no language selected)' | $T8 %]
|
||
[%- ELSE %]
|
||
[%- HTML.escape(language.description) %]
|
||
[%- END %]
|
||
</td>
|
||
<td><input name="translation__[% language.id %]" size="40" value="[% HTML.escape(language.translation) %]"></td>
|
||
</tr>
|
||
[%- END %]
|
||
</table>
|
||
</form>
|
Auch abrufbar als: Unified diff
ZUGFeRD: allgemeine Notizen für alle Rechnungen in Übersetzungen anlegen können