Weitere Grundeinstellungen fuer leeren Kontenrahmen.
[kivitendo-erp.git] / SL / IC.pm
index 9706504..d05d85d 100644 (file)
--- a/SL/IC.pm
+++ b/SL/IC.pm
@@ -502,6 +502,7 @@ sub save {
              shop = '$form->{shop}',
               ve = '$form->{ve}',
               gv = '$form->{gv}',
+              ean = '$form->{ean}',
               not_discountable = '$form->{not_discountable}',
              microfiche = '$form->{microfiche}',
              partsgroup_id = $partsgroup_id
@@ -933,6 +934,11 @@ sub all_parts {
     }
   }
 
+  if ($form->{ean}) {
+    $var = $form->like(lc $form->{ean});
+    $where .= " AND lower(ean) LIKE '$var'";
+  }
+  
   if ($form->{searchitems} eq 'part') {
     $where .= " AND p.inventory_accno_id > 0";
   }
@@ -1519,22 +1525,12 @@ sub create_links {
   }
   $sth->finish;
 
-  if ($form->{id}) {
-    $query = qq|SELECT weightunit
-                FROM defaults|;
+  if (!$form->{id}) {
+    $query = qq|SELECT current_date FROM defaults|;
     $sth = $dbh->prepare($query);
     $sth->execute || $form->dberror($query);
 
-    ($form->{weightunit}) = $sth->fetchrow_array;
-    $sth->finish;
-
-  } else {
-    $query = qq|SELECT weightunit, current_date
-                FROM defaults|;
-    $sth = $dbh->prepare($query);
-    $sth->execute || $form->dberror($query);
-
-    ($form->{weightunit}, $form->{priceupdate}) = $sth->fetchrow_array;
+    ($form->{priceupdate}) = $sth->fetchrow_array;
     $sth->finish;
   }
 
@@ -1783,6 +1779,8 @@ sub retrieve_accounts {
     } else {
       $transdate = $form->{deliverydate};
     }
+  } elsif ($form->{type} eq "credit_note") {
+    $transdate = $form->{invdate};
   } else {
     $transdate = $form->{transdate};
   }
@@ -1817,7 +1815,7 @@ sub retrieve_accounts {
 
   if (!$ref) {
     $dbh->disconnect();
-    return $lxdebug->leave_sub();
+    return $main::lxdebug->leave_sub();
   }
 
   $ref->{"inventory_accno_id"} = undef unless ($ref->{"is_part"});
@@ -1851,7 +1849,7 @@ sub retrieve_accounts {
   $ref = $sth->fetchrow_hashref();
   $sth->finish();
   $dbh->disconnect();
-  
+
   unless ($ref) {
     $main::lxdebug->leave_sub();
     return;
@@ -1870,8 +1868,6 @@ sub retrieve_accounts {
 #                           " || taxaccounts_$index " . $form->{"taxaccounts_$index"} .
 #                           " || taxaccounts " . $form->{"taxaccounts"});
 
-  $sth->finish();
-
   $main::lxdebug->leave_sub();
 }
 1;