X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FDATEV.pm;h=9d13e589ba589be9f7889f6bb12ef1ed5e80298d;hb=80499f9da1fb349fd4ee2a5eef5a64c872240feb;hp=90fa620736f8b467d849dc24dd35b1851eb69bb9;hpb=8f3e8a0254bc848d02958cc5e1fcdf600d5632a8;p=kivitendo-erp.git diff --git a/SL/DATEV.pm b/SL/DATEV.pm index 90fa62073..9d13e589b 100644 --- a/SL/DATEV.pm +++ b/SL/DATEV.pm @@ -258,12 +258,12 @@ sub clean_temporary_directories { sub _fill { $main::lxdebug->enter_sub(); - my $text = shift; + my $text = shift // ''; my $field_len = shift; my $fill_char = shift; my $alignment = shift || 'right'; - my $text_len = length($text // ''); + my $text_len = length $text; if ($field_len < $text_len) { $text = substr $text, 0, $field_len; @@ -377,7 +377,8 @@ sub _get_transactions { ct.name, ct.ustid, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ar.invoice, - t.rate AS taxrate + t.rate AS taxrate, + 'ar' as table FROM acc_trans ac LEFT JOIN ar ON (ac.trans_id = ar.id) LEFT JOIN customer ct ON (ar.customer_id = ct.id) @@ -395,7 +396,8 @@ sub _get_transactions { ct.name,ct.ustid, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, ap.invoice, - t.rate AS taxrate + t.rate AS taxrate, + 'ap' as table FROM acc_trans ac LEFT JOIN ap ON (ac.trans_id = ap.id) LEFT JOIN vendor ct ON (ap.vendor_id = ct.id) @@ -413,7 +415,8 @@ sub _get_transactions { gl.description AS name, NULL as ustid, c.accno, c.taxkey_id as charttax, c.datevautomatik, c.id, ac.chart_link AS link, FALSE AS invoice, - t.rate AS taxrate + t.rate AS taxrate, + 'gl' as table FROM acc_trans ac LEFT JOIN gl ON (ac.trans_id = gl.id) LEFT JOIN chart c ON (ac.chart_id = c.id) @@ -539,7 +542,9 @@ sub _get_transactions { # Problem: we can't distinguish between AR and AP and normal invoices via boolean "invoice" # for AR and AP transaction exit the loop as soon as an AR or AP account is found # there must be only one AR or AP chart in the booking - if ( $trans->[$j]->{'link'} eq 'AR' or $trans->[$j]->{'link'} eq 'AP') { + # since it is possible to do this kind of things with GL too, make sure those don't get aborted in case someone + # manually pays an invoice in GL. + if ($trans->[$j]->{table} ne 'gl' and ($trans->[$j]->{'link'} eq 'AR' or $trans->[$j]->{'link'} eq 'AP')) { $notsplitindex = $j; # position in booking with highest amount $absumsatz = $trans->[$j]->{'amount'}; last; @@ -674,7 +679,7 @@ sub make_kne_data_header { $header .= _fill($stamm->{dfvkz}, 2, '0'); $header .= _fill($stamm->{beraternr}, 7, '0'); $header .= _fill($stamm->{mandantennr}, 5, '0'); - $header .= _fill($stamm->{abrechnungsnr} . $jahr, 6, '0'); + $header .= _fill(($stamm->{abrechnungsnr} // '') . $jahr, 6, '0'); $header .= $self->from ? $self->from->strftime('%d%m%y') : ''; $header .= $self->to ? $self->to->strftime('%d%m%y') : ''; @@ -899,10 +904,10 @@ sub kne_buchungsexport { if ($transaction->[$haben]->{'name'} ne "") { $buchungstext = "\x1E" . $transaction->[$haben]->{'name'} . "\x1C"; } - if ($transaction->[$haben]->{'ustid'} ne "") { + if (($transaction->[$haben]->{'ustid'} // '') ne "") { $ustid = "\xBA" . $transaction->[$haben]->{'ustid'} . "\x1C"; } - if ($transaction->[$haben]->{'duedate'} ne "") { + if (($transaction->[$haben]->{'duedate'} // '') ne "") { $belegfeld2 = "\xBE" . &datetofour($transaction->[$haben]->{'duedate'}, 1) . "\x1C"; } } @@ -958,7 +963,7 @@ sub kne_buchungsexport { print(EV $ev_header); foreach my $file (@ed_versionset) { - print(EV $ed_versionset[$file]); + print(EV $file); } close(EV); ###