Revision ba40069b
Von Moritz Bunkus vor mehr als 3 Jahren hinzugefügt
SL/DB/Helper/ZUGFeRD.pm | ||
---|---|---|
14 | 14 |
use SL::Helper::ISO4217; |
15 | 15 |
use SL::Helper::UNECERecommendation20; |
16 | 16 |
use SL::VATIDNr; |
17 |
use SL::ZUGFeRD qw(:PROFILES); |
|
17 | 18 |
|
18 | 19 |
use Carp; |
19 | 20 |
use Encode qw(encode); |
... | ... | |
24 | 25 |
|
25 | 26 |
my @line_names = qw(LineOne LineTwo LineThree); |
26 | 27 |
|
28 |
my %standards_ids = ( |
|
29 |
PROFILE_FACTURX_EXTENDED() => 'urn:cen.eu:en16931:2017#conformant#urn:factur-x.eu:1p0:extended', |
|
30 |
sub _is_profile { |
|
31 |
my ($self, @profiles) = @_; |
|
32 |
return any { $self->{_zugferd}->{profile} == $_ } @profiles; |
|
33 |
} |
|
34 |
|
|
27 | 35 |
sub _u8 { |
28 | 36 |
my ($value) = @_; |
29 | 37 |
return encode('UTF-8', $value // ''); |
... | ... | |
340 | 348 |
# <rsm:ExchangedDocumentContext> |
341 | 349 |
$params{xml}->startTag("rsm:ExchangedDocumentContext"); |
342 | 350 |
|
343 |
if ($self->customer->create_zugferd_invoices_for_this_customer == 2) {
|
|
351 |
if ($self->{_zugferd}->{test_mode}) {
|
|
344 | 352 |
$params{xml}->startTag("ram:TestIndicator"); |
345 | 353 |
$params{xml}->dataElement("udt:Indicator", "true"); |
346 | 354 |
$params{xml}->endTag; |
347 | 355 |
} |
348 | 356 |
|
349 | 357 |
$params{xml}->startTag("ram:GuidelineSpecifiedDocumentContextParameter"); |
350 |
$params{xml}->dataElement("ram:ID", "urn:cen.eu:en16931:2017#conformant#urn:zugferd.de:2p0:extended");
|
|
358 |
$params{xml}->dataElement("ram:ID", $standards_ids{ $self->{_zugferd}->{profile} });
|
|
351 | 359 |
$params{xml}->endTag; |
352 | 360 |
$params{xml}->endTag; |
353 | 361 |
# </rsm:ExchangedDocumentContext> |
... | ... | |
608 | 616 |
$result{bank_account} = scalar(@{ $bank_accounts }) == 1 ? $bank_accounts->[0] : first { $_->use_for_zugferd } @{ $bank_accounts }; |
609 | 617 |
|
610 | 618 |
if (!$result{bank_account}) { |
611 |
SL::X::ZUGFeRDValidation->throw(message => $prefix . $::locale->text('No bank account flagged for ZUGFeRD usage was found.')); |
|
619 |
SL::X::ZUGFeRDValidation->throw(message => $prefix . $::locale->text('No bank account flagged for Factur-X/ZUGFeRD usage was found.'));
|
|
612 | 620 |
} |
613 | 621 |
} |
614 | 622 |
|
... | ... | |
617 | 625 |
|
618 | 626 |
sub create_zugferd_data { |
619 | 627 |
my ($self) = @_; |
628 |
$self->{_zugferd} = { SL::ZUGFeRD->convert_customer_setting($self->customer->create_zugferd_invoices_for_this_customer) }; |
|
629 |
|
|
630 |
if (!$standards_ids{ $self->{_zugferd}->{profile} }) { |
|
631 |
croak "Profile '" . $self->{_zugferd}->{profile} . "' is not supported"; |
|
632 |
} |
|
620 | 633 |
|
621 | 634 |
my $output = ''; |
622 | 635 |
|
... | ... | |
655 | 668 |
|
656 | 669 |
return { |
657 | 670 |
conformance_level => 'EXTENDED', |
658 |
document_file_name => 'ZUGFeRD-invoice.xml',
|
|
671 |
document_file_name => 'factur-x.xml',
|
|
659 | 672 |
document_type => 'INVOICE', |
660 | 673 |
version => '1.0', |
661 | 674 |
}; |
Auch abrufbar als: Unified diff
Factur-X/ZUGFeRD: in »Factur-X/ZUGFeRD« umbenannt
Mit ZUGFeRD-Standard Version 2.1.1 ist der offizielle Name des
EU-Standards schlicht Factur-X. ZUGFeRD ist nur noch der tolerierte
alte Name.
In der Oberfläche ist nun überall von »Factur-X/ZUGFeRD« die Rede.
Im Quellcode heißen die Module hingegen weiterhin `SL::…::ZUGFeRD`,
weil die Umstellung ansonsten zu groß und irgendwo auch nicht so nötig
ist.
Es ändern sich auch die ganzen Namen in den Metadaten des PDFs und der
XML-Datei:
• Namensraum in der für Factur-X/ZUGFeRD relevanten XML-Elemente in
den XMP-Metadaten im PDF
• Name des Dateianhangs der Rechnungs-XML im PDF (»factur-x.xml«)
• Standard-Identifier in der Rechnungs-XML