]> wagnertech.de Git - kivitendo-erp.git/commitdiff
DATEV-Checks beim Buchen nutzen nun generate_datev_data
authorG. Richardson <information@kivitendo-premium.de>
Sun, 12 Feb 2017 12:30:42 +0000 (13:30 +0100)
committerG. Richardson <information@kivitendo-premium.de>
Tue, 28 Mar 2017 15:16:00 +0000 (17:16 +0200)
SL/AP.pm
SL/AR.pm
SL/DB/Helper/Payment.pm
SL/GL.pm
SL/IR.pm
SL/IS.pm
t/ar/ar.t

index 095f2274373fdaf85746a981df3de79dd4f48ee6..f03fb63e892b461085088eceb0363dab873c0e7d 100644 (file)
--- a/SL/AP.pm
+++ b/SL/AP.pm
@@ -368,17 +368,11 @@ sub _post_transaction {
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_ap_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,
       trans_id   => $form->{id},
     );
-
-    $datev->export;
+    $datev->generate_datev_data;
 
     if ($datev->errors) {
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
index 2ca302258d9d0d0a2a17e382f875357d49b730d6..56f2da9dfa61e63b59cd8c4096faf692b1053628 100644 (file)
--- a/SL/AR.pm
+++ b/SL/AR.pm
@@ -312,17 +312,12 @@ sub _post_transaction {
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_ar_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,
       trans_id   => $form->{id},
     );
 
-    $datev->export;
+    $datev->generate_datev_data;
 
     if ($datev->errors) {
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
index 89fc6e453fa4d5043d0d664bb08fac2e2ec0800b..ae7fa53668fc20e0cb4918a64a616adf900eec09 100644 (file)
@@ -294,14 +294,11 @@ sub pay_invoice {
     if ( $datev_check ) {
 
       my $datev = SL::DATEV->new(
-        exporttype => DATEV_ET_BUCHUNGEN,
-        format     => DATEV_FORMAT_KNE,
         dbh        => $db->dbh,
         trans_id   => $self->{id},
       );
 
-      $datev->clean_temporary_directories;
-      $datev->export;
+      $datev->generate_datev_data;
 
       if ($datev->errors) {
         # this exception should be caught by with_transaction, which handles the rollback
index ec6b4a467f9e253a636802bf0e5f76b7ce5cda18..cd63ec0f6c48101d4704c2217529d48fc1e3e55e 100644 (file)
--- a/SL/GL.pm
+++ b/SL/GL.pm
@@ -197,17 +197,14 @@ sub _post_transaction {
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_gl_transaction) {
-    my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef;
-    $transdate  ||= DateTime->today;
 
+    # create datev object
     my $datev = SL::DATEV->new(
-      exporttype => DATEV_ET_BUCHUNGEN,
-      format     => DATEV_FORMAT_KNE,
       dbh        => $dbh,
       trans_id   => $form->{id},
     );
 
-    $datev->export;
+    $datev->generate_datev_data;
 
     if ($datev->errors) {
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
index a424ab99083b8a9334a193779adbace2050d2af1..f3f1fd0ca4ba5b065df0213bfa9e4dae4269d857 100644 (file)
--- a/SL/IR.pm
+++ b/SL/IR.pm
@@ -817,19 +817,13 @@ SQL
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_purchase_invoice) {
-    # if we need department for kostenstelle in DATEV check
-    $form->{department} = SL::DB::Manager::Department->find_by(id => $form->{department_id})->description if $form->{department_id};
-    my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
-    $transdate  ||= DateTime->today;
 
     my $datev = SL::DATEV->new(
-      exporttype => DATEV_ET_BUCHUNGEN,
-      format     => DATEV_FORMAT_KNE,
       dbh        => $dbh,
       trans_id   => $form->{id},
     );
 
-    $datev->export;
+    $datev->generate_datev_data;
 
     if ($datev->errors) {
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
index d5e028067fca12f560e4a6711c2f53d50d1299af..bbf53e31ac3b203a5aaf3149b7e70c00bb6b38ad 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1409,17 +1409,13 @@ SQL
 
   # safety check datev export
   if ($::instance_conf->get_datev_check_on_sales_invoice) {
-    my $transdate = $::form->{invdate} ? DateTime->from_lxoffice($::form->{invdate}) : undef;
-    $transdate  ||= DateTime->today;
 
     my $datev = SL::DATEV->new(
-      exporttype => DATEV_ET_BUCHUNGEN,
-      format     => DATEV_FORMAT_KNE,
       dbh        => $dbh,
       trans_id   => $form->{id},
     );
 
-    $datev->export;
+    $datev->generate_datev_data;
 
     if ($datev->errors) {
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;
index 7a97738ec0f874a92fb364caba8bb8d36c23451a..a936761a8487cb0b4b59d3297d2eefefcaf15700 100644 (file)
--- a/t/ar/ar.t
+++ b/t/ar/ar.t
@@ -195,13 +195,12 @@ sub _save_and_pay_and_check {
 
   if ($datev_check) {
     my $datev = SL::DATEV->new(
-      exporttype => DATEV_ET_BUCHUNGEN,
-      format     => DATEV_FORMAT_KNE,
       dbh        => $invoice->db->dbh,
       trans_id   => $invoice->id,
     );
 
-    $datev->export;
+    $datev->generate_datev_data;
+
     if ($datev->errors) {
       $invoice->db->dbh->rollback;
       die join "\n", $::locale->text('DATEV check returned errors:'), $datev->errors;