Revision 3f93bd6c
Von Johannes Grassler vor mehr als 1 Jahr hinzugefügt
SL/XMLInvoice.pm | ||
---|---|---|
5 | 5 |
|
6 | 6 |
use XML::LibXML; |
7 | 7 |
|
8 |
use SL::XMLInvoice::UBL;
|
|
9 |
use SL::XMLInvoice::CrossIndustryInvoice;
|
|
8 |
require SL::XMLInvoice::UBL;
|
|
9 |
require SL::XMLInvoice::CrossIndustryInvoice;
|
|
10 | 10 |
|
11 | 11 |
use constant RES_OK => 0; |
12 | 12 |
use constant RES_XML_PARSING_FAILED => 1; |
... | ... | |
92 | 92 |
|
93 | 93 |
=cut |
94 | 94 |
|
95 |
sub data_keys {
|
|
95 |
sub data_keys { |
|
96 | 96 |
my @keys = ( |
97 | 97 |
'currency', # The bill's currency, such as "EUR" |
98 | 98 |
'direct_debit', # Boolean: whether the bill will get paid by direct debit (1) or not (0) |
... | ... | |
267 | 267 |
$self->{dom} = eval { XML::LibXML->load_xml(string => $xml_data) }; |
268 | 268 |
|
269 | 269 |
if ( ! $self->{dom} ) { |
270 |
$self->{message} = $::locale->text("Parsing the XML data failed: $xml_data");
|
|
270 |
$self->{message} = t8("Parsing the XML data failed: #1", $xml_data);
|
|
271 | 271 |
$self->{result} = RES_XML_PARSING_FAILED; |
272 | 272 |
return $self; |
273 | 273 |
} |
... | ... | |
280 | 280 |
|
281 | 281 |
unless ( $type ) { |
282 | 282 |
$self->{result} = RES_UNKNOWN_ROOT_NODE_TYPE; |
283 |
my $node_types = keys %{ $self->_document_nodenames };
|
|
283 |
my $node_types = join(",", keys %{ $self->_document_nodenames });
|
|
284 | 284 |
$self->{message} = t8("Could not parse XML Invoice: unknown root node name (#1) (supported: (#2))", |
285 |
$document_nodename, |
|
285 | 286 |
$node_types, |
286 |
$document_nodename);
|
|
287 |
); |
|
287 | 288 |
return $self; |
288 | 289 |
} |
289 | 290 |
|
... | ... | |
291 | 292 |
|
292 | 293 |
# Implementation sanity check for child classes: make sure they are aware of |
293 | 294 |
# the keys the hash returned by their metadata() method must contain. |
294 |
my @missing_data_keys = grep { !${$self->_data_keys}{$data_key} } @{ $self->data_keys };
|
|
295 |
my @missing_data_keys = grep { !${$self->_data_keys}{$_} } @{ $self->data_keys };
|
|
295 | 296 |
if ( scalar(@missing_data_keys) > 0 ) { |
296 | 297 |
die "Incomplete implementation: the following metadata keys appear to be missing from $type: " . join(", ", @missing_data_keys); |
297 | 298 |
} |
Auch abrufbar als: Unified diff
ZUGFeRD-Import: verschiedene behoben