fix #480 mark_as_delivered nach Wareneingang im LS berechnen
authorJan Büren <jan@kivitendo.de>
Mon, 14 Jun 2021 07:46:41 +0000 (09:46 +0200)
committerJan Büren <jan@kivitendo.de>
Mon, 14 Jun 2021 10:16:25 +0000 (12:16 +0200)
SL/DO.pm

index 53730d7..8f04ce7 100644 (file)
--- a/SL/DO.pm
+++ b/SL/DO.pm
@@ -557,10 +557,10 @@ SQL
                             'to_id'      => $form->{id},
     );
   delete $form->{convert_from_oe_ids};
-
-  $self->mark_orders_if_delivered('do_id' => $form->{id},
-                                  'type'  => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase',
-                                  'dbh'   => $dbh,);
+  unless ($::instance_conf->get_shipped_qty_require_stock_out) {
+    $self->mark_orders_if_delivered('do_id' => $form->{id},
+                                    'type'  => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase');
+  }
 
   $form->{saved_donumber} = $form->{donumber};
   $form->{saved_ordnumber} = $form->{ordnumber};
@@ -1263,6 +1263,11 @@ sub transfer_in_out {
 
   WH->transfer(@transfers);
 
+  if ($::instance_conf->get_shipped_qty_require_stock_out) {
+    $self->mark_orders_if_delivered('do_id' => $form->{id},
+                                    'type'  => $form->{type} eq 'sales_delivery_order' ? 'sales' : 'purchase');
+  }
+
   $main::lxdebug->leave_sub();
 }