X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/0fa8098195ca1634920bf65264a987b59a91ebe1..b459f8fedcdf0f7589862d11ca7b2fbaf2dfc91e:/SL/AP.pm?ds=sidebyside diff --git a/SL/AP.pm b/SL/AP.pm index 41452511a..095f22743 100644 --- a/SL/AP.pm +++ b/SL/AP.pm @@ -40,6 +40,7 @@ use SL::DBUtils; use SL::IO; use SL::MoreCommon; use SL::DB::Default; +use SL::DB::Draft; use SL::Util qw(trim); use SL::DB; use Data::Dumper; @@ -361,6 +362,10 @@ sub _post_transaction { IO->set_datepaid(table => 'ap', 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_ap_transaction) { my $transdate = $::form->{transdate} ? DateTime->from_lxoffice($::form->{transdate}) : undef; @@ -439,10 +444,7 @@ sub ap_transactions { my @values; - if ($form->{vendor_id}) { - $where .= " AND a.vendor_id = ?"; - push(@values, $form->{vendor_id}); - } elsif ($form->{vendor}) { + if ($form->{vendor}) { $where .= " AND v.name ILIKE ?"; push(@values, like($form->{vendor})); } @@ -647,7 +649,7 @@ sub _post_payment { # Get the AP accno. $query = - qq|SELECT c.accno + qq|SELECT c.id FROM acc_trans at LEFT JOIN chart c ON (at.chart_id = c.id) WHERE (trans_id = ?) @@ -655,7 +657,7 @@ sub _post_payment { ORDER BY at.acc_trans_id LIMIT 1|; - ($form->{APselected}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id})); + ($form->{AP_chart_id}) = selectfirst_array_query($form, $dbh, $query, conv_i($form->{id})); # Post the new payments. $self->post_transaction($myconfig, $form, $dbh, 1);