X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FIS.pm;h=bbf53e31ac3b203a5aaf3149b7e70c00bb6b38ad;hb=2dad1e43ff60601c7961cc2e8f15cfee3e61720f;hp=6d1e843cdbb007d6417c1df88832f30c63be8e95;hpb=529e6bf96e1ad74ae2e770a9e74f29f26a28d3c8;p=kivitendo-erp.git diff --git a/SL/IS.pm b/SL/IS.pm index 6d1e843cd..bbf53e31a 100644 --- a/SL/IS.pm +++ b/SL/IS.pm @@ -52,6 +52,7 @@ use SL::IC; use SL::IO; use SL::TransNumber; use SL::DB::Default; +use SL::DB::Draft; use SL::DB::Tax; use SL::DB::TaxZone; use SL::TransNumber; @@ -1339,9 +1340,6 @@ SQL # need the current dbh to get the not yet committed mtime $form->new_lastmtime('ar', $provided_dbh); - $form->{name} = $form->{customer}; - $form->{name} =~ s/--\Q$form->{customer_id}\E//; - # add shipto if (!$form->{shipto_id}) { $form->add_shipto($dbh, $form->{id}, "AR"); @@ -1405,19 +1403,19 @@ SQL do_query($form, $dbh, $query, @orphaned_ids); } + if ($form->{draft_id}) { + SL::DB::Manager::Draft->delete_all(where => [ id => delete($form->{draft_id}) ]); + } + # 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;