X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/kivitendo-erp.git/blobdiff_plain/e293009f4e1d70e547a479e956fd1733c24b1441..692e001fa8962e1a6acbcf41a2a1d485e1dfe085:/SL/GL.pm diff --git a/SL/GL.pm b/SL/GL.pm index f538bc359..cdd9d406f 100644 --- a/SL/GL.pm +++ b/SL/GL.pm @@ -39,6 +39,7 @@ package GL; use Data::Dumper; +use SL::DATEV qw(:CONSTANTS); use SL::DBUtils; use strict; @@ -184,6 +185,27 @@ sub post_transaction { do_query($form, $dbh, qq|UPDATE gl SET storno = 't' WHERE id = ?|, conv_i($form->{storno_id})); } + # safety check datev export + if ($::lx_office_conf{datev_check}{check_on_gl_transaction}) { + my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef; + $transdate ||= DateTime->today; + + my $datev = SL::DATEV->new( + exporttype => DATEV_ET_BUCHUNGEN, + format => DATEV_FORMAT_KNE, + dbh => $dbh, + from => $transdate, + to => $transdate, + ); + + $datev->export; + + if ($datev->errors) { + $dbh->rollback; + die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors; + } + } + # commit and redirect my $rc = $dbh->commit; $dbh->disconnect;