Konditional RecordLink save aufrufen (analog zu ar auch für oe)
[kivitendo-erp.git] / SL / IS.pm
index e2358ea..0d3cdf0 100644 (file)
--- a/SL/IS.pm
+++ b/SL/IS.pm
@@ -1215,14 +1215,16 @@ SQL
   }
 
   # Link this record to the records it was created from.
-  RecordLinks->create_links('dbh'        => $dbh,
-                            'mode'       => 'ids',
-                            'from_table' => 'oe',
-                            'from_ids'   => $form->{convert_from_oe_ids},
-                            'to_table'   => 'ar',
-                            'to_id'      => $form->{id},
-    );
-  delete $form->{convert_from_oe_ids};
+  if ($form->{convert_from_oe_ids}) {
+    RecordLinks->create_links('dbh'        => $dbh,
+                              'mode'       => 'ids',
+                              'from_table' => 'oe',
+                              'from_ids'   => $form->{convert_from_oe_ids},
+                              'to_table'   => 'ar',
+                              'to_id'      => $form->{id},
+      );
+    delete $form->{convert_from_oe_ids};
+  }
 
   my @convert_from_do_ids = map { $_ * 1 } grep { $_ } split m/\s+/, $form->{convert_from_do_ids};