X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=SL%2FAR.pm;h=56f2da9dfa61e63b59cd8c4096faf692b1053628;hb=4720b32a11bf3a7719af1bc2844a7207ca58343b;hp=4fea4afe9f7fc9d2dae6bb2b2ba9a6a3b1c02bf0;hpb=41cceb1e99fa9d9dbf7977772e16e23646208608;p=kivitendo-erp.git diff --git a/SL/AR.pm b/SL/AR.pm index 4fea4afe9..56f2da9df 100644 --- a/SL/AR.pm +++ b/SL/AR.pm @@ -38,6 +38,7 @@ package AR; use Data::Dumper; use SL::DATEV qw(:CONSTANTS); use SL::DBUtils; +use SL::DB::Draft; use SL::IO; use SL::MoreCommon; use SL::DB::Default; @@ -99,8 +100,6 @@ sub _post_transaction { } $form->{paid} = $form->round_amount($form->{paid} * ($form->{exchangerate} || 1), 2); - ($null, $form->{employee_id}) = split /--/, $form->{employee}; - $form->get_employee($dbh) unless $form->{employee_id}; # if we have an id delete old records else make one @@ -307,19 +306,18 @@ sub _post_transaction { IO->set_datepaid(table => 'ar', id => $form->{id}, dbh => $dbh); + 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_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; @@ -501,14 +499,7 @@ sub ar_transactions { $where .= " AND NOT invoice = 'f' "; # remove ar transactions from Sales -> Reports -> Invoices }; - if ($form->{customernumber}) { - $where .= " AND c.customernumber = ?"; - push(@values, trim($form->{customernumber})); - } - if ($form->{customer_id}) { - $where .= " AND a.customer_id = ?"; - push(@values, $form->{customer_id}); - } elsif ($form->{customer}) { + if ($form->{customer}) { $where .= " AND c.name ILIKE ?"; push(@values, like($form->{customer})); }