Revision ee75882d
Von Jan Büren vor 10 Monaten hinzugefügt
SL/DATEV.pm | ||
---|---|---|
33 | 33 |
use SL::DBUtils; |
34 | 34 |
use SL::DATEV::CSV; |
35 | 35 |
use SL::DB; |
36 |
use Encode qw(encode); |
|
36 | 37 |
use SL::HTML::Util (); |
37 | 38 |
use SL::Iconv; |
38 | 39 |
use SL::Locale::String qw(t8); |
... | ... | |
350 | 351 |
$csv_file->close; |
351 | 352 |
$self->{warnings} = $datev_csv->warnings; |
352 | 353 |
|
353 |
$self->_create_xml_and_documents if $self->{documents} && scalar @{ $self->{guids} };
|
|
354 |
$self->_create_xml_and_documents if $self->{documents} && %{ $self->{guids} };
|
|
354 | 355 |
|
355 | 356 |
# convert utf-8 to cp1252//translit if set |
356 | 357 |
if ($::instance_conf->get_datev_export_format eq 'cp1252-translit') { |
... | ... | |
417 | 418 |
sub _create_xml_and_documents { |
418 | 419 |
my $self = shift; |
419 | 420 |
|
420 |
die "No guids" unless scalar @{ $self->{guids} };
|
|
421 |
die "No guids" unless %{ $self->{guids} };
|
|
421 | 422 |
|
422 | 423 |
my $today = DateTime->now_local; |
423 | 424 |
my $doc = XML::LibXML::Document->new('1.0', 'utf-8'); |
... | ... | |
443 | 444 |
my $content_node = $doc->createElement('content'); |
444 | 445 |
$root->appendChild($content_node); |
445 | 446 |
# we have n document childs |
446 |
foreach my $guid (@{ $self->{guids} }) {
|
|
447 |
foreach my $guid (keys %{ $self->{guids} }) {
|
|
447 | 448 |
# 1. get filename and file location |
448 | 449 |
my $file_version = SL::DB::Manager::FileVersion->find_by(guid => $guid); |
449 | 450 |
die "Invalid guid $guid" unless ref $file_version eq 'SL::DB::FileVersion'; |
... | ... | |
472 | 473 |
$zip->addString($doc->toString(), 'document.xml'); |
473 | 474 |
# add real files |
474 | 475 |
foreach my $filename (keys %{ $self->{files} }) { |
475 |
$zip->addFile($self->{files}{$filename}, $filename); |
|
476 |
my $enc_filename = encode('Windows-1252', $filename); |
|
477 |
$zip->addFile($self->{files}{$filename}, $enc_filename); |
|
476 | 478 |
} |
477 | 479 |
die "Cannot write Belege-XML.zip" unless ($zip->writeToFileNamed($self->export_path . 'Belege-XML.zip') |
478 | 480 |
== Archive::Zip::AZ_OK()); |
... | ... | |
1015 | 1017 |
} |
1016 | 1018 |
} |
1017 | 1019 |
} |
1020 |
# keine kommerzbank daten exportieren |
|
1021 |
next if ($datev_data{konto} eq '1800' || $datev_data{gegenkonto} eq '1800'); |
|
1022 |
|
|
1018 | 1023 |
push(@datev_lines, \%datev_data) if $datev_data{umsatz}; |
1019 | 1024 |
} |
1020 | 1025 |
|
... | ... | |
1085 | 1090 |
return defined $booking_has_no_document ? 0 : 1; |
1086 | 1091 |
|
1087 | 1092 |
} |
1093 |
|
|
1094 |
|
|
1095 |
sub _u8 { |
|
1096 |
my ($value) = @_; |
|
1097 |
return encode('UTF-8', $value // ''); |
|
1098 |
} |
|
1099 |
|
|
1100 |
|
|
1088 | 1101 |
sub DESTROY { |
1089 | 1102 |
clean_temporary_directories(); |
1090 | 1103 |
} |
Auch abrufbar als: Unified diff
DATEV Belegtransfer: Guids als Hash, um Doppelungen zu vermeiden
Encoding (_u8 wird von DATEV Belegtransfer scheinbar nicht akzeptiert)