]> wagnertech.de Git - kivitendo-erp.git/blobdiff - SL/IC.pm
Kosmetik
[kivitendo-erp.git] / SL / IC.pm
index f5a1db9790fe787b4cd5c0d524b6c1ccf2e99238..f69e98ce2ded8e530d56ff4debeed67ca4c44354 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -1174,9 +1174,6 @@ sub all_parts {
         push(@assemblies, $ref);
       }
       $sth->finish;
-
-      push(@assemblies, { id => $item->{id} });
-
     }
 
     # copy assemblies to $form->{parts}
@@ -1535,13 +1532,13 @@ sub follow_account_chain {
 sub retrieve_accounts {
   $main::lxdebug->enter_sub(2);
 
-  my ($self, $myconfig, $form, $parts_id, $index, $copy_accnos) = @_;
+  my ($self, $myconfig, $form, $parts_id, $index) = @_;
 
   my ($query, $sth, $dbh);
 
   $form->{"taxzone_id"} *= 1;
 
-  $dbh = $form->dbconnect($myconfig);
+  $dbh = $form->get_standard_dbh($myconfig);
 
   my $transdate = "";
   if ($form->{type} eq "invoice") {
@@ -1550,7 +1547,7 @@ sub retrieve_accounts {
     } else {
       $transdate = $form->{deliverydate};
     }
-  } elsif ($form->{type} eq "credit_note") {
+  } elsif (($form->{type} eq "credit_note") || ($form->{script} eq 'ir.pl')) {
     $transdate = $form->{invdate};
   } else {
     $transdate = $form->{transdate};
@@ -1579,10 +1576,7 @@ sub retrieve_accounts {
     qq|WHERE p.id = ?|;
   my $ref = selectfirst_hashref_query($form, $dbh, $query, $parts_id);
 
-  if (!$ref) {
-    $dbh->disconnect();
-    return $main::lxdebug->leave_sub(2);
-  }
+  return $main::lxdebug->leave_sub(2) if (!$ref);
 
   $ref->{"inventory_accno_id"} = undef unless ($ref->{"is_part"});