Revision 6ac11101
Von Jan Büren vor 10 Monaten hinzugefügt
SL/DATEV.pm | ||
---|---|---|
use SL::DBUtils;
|
||
use SL::DATEV::CSV;
|
||
use SL::DB;
|
||
use Encode qw(encode);
|
||
use SL::HTML::Util ();
|
||
use SL::Iconv;
|
||
use SL::Locale::String qw(t8);
|
||
... | ... | |
$csv_file->close;
|
||
$self->{warnings} = $datev_csv->warnings;
|
||
|
||
$self->_create_xml_and_documents if $self->{documents} && scalar @{ $self->{guids} };
|
||
$self->_create_xml_and_documents if $self->{documents} && %{ $self->{guids} };
|
||
|
||
# convert utf-8 to cp1252//translit if set
|
||
if ($::instance_conf->get_datev_export_format eq 'cp1252-translit') {
|
||
... | ... | |
sub _create_xml_and_documents {
|
||
my $self = shift;
|
||
|
||
die "No guids" unless scalar @{ $self->{guids} };
|
||
die "No guids" unless %{ $self->{guids} };
|
||
|
||
my $today = DateTime->now_local;
|
||
my $doc = XML::LibXML::Document->new('1.0', 'utf-8');
|
||
... | ... | |
my $content_node = $doc->createElement('content');
|
||
$root->appendChild($content_node);
|
||
# we have n document childs
|
||
foreach my $guid (@{ $self->{guids} }) {
|
||
foreach my $guid (keys %{ $self->{guids} }) {
|
||
# 1. get filename and file location
|
||
my $file_version = SL::DB::Manager::FileVersion->find_by(guid => $guid);
|
||
die "Invalid guid $guid" unless ref $file_version eq 'SL::DB::FileVersion';
|
||
... | ... | |
$zip->addString($doc->toString(), 'document.xml');
|
||
# add real files
|
||
foreach my $filename (keys %{ $self->{files} }) {
|
||
$zip->addFile($self->{files}{$filename}, $filename);
|
||
my $enc_filename = encode('Windows-1252', $filename);
|
||
$zip->addFile($self->{files}{$filename}, $enc_filename);
|
||
}
|
||
die "Cannot write Belege-XML.zip" unless ($zip->writeToFileNamed($self->export_path . 'Belege-XML.zip')
|
||
== Archive::Zip::AZ_OK());
|
||
... | ... | |
}
|
||
}
|
||
}
|
||
# keine kommerzbank daten exportieren
|
||
next if ($datev_data{konto} eq '1800' || $datev_data{gegenkonto} eq '1800');
|
||
|
||
push(@datev_lines, \%datev_data) if $datev_data{umsatz};
|
||
}
|
||
|
||
... | ... | |
return defined $booking_has_no_document ? 0 : 1;
|
||
|
||
}
|
||
|
||
|
||
sub _u8 {
|
||
my ($value) = @_;
|
||
return encode('UTF-8', $value // '');
|
||
}
|
||
|
||
|
||
sub DESTROY {
|
||
clean_temporary_directories();
|
||
}
|
Auch abrufbar als: Unified diff
DATEV Belegtransfer: Guids als Hash, um Doppelungen zu vermeiden
Encoding (_u8 wird von DATEV Belegtransfer scheinbar nicht akzeptiert)