Entwürfe: beim Buchen dazugehörigen Entwurf löschen
[kivitendo-erp.git] / SL / AR.pm
index 4caf527..2ca3022 100644 (file)
--- 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;
@@ -305,6 +306,10 @@ 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;