X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=lxo-import%2FcontactB.php;h=f0b286805c3b2d4d64f09d3b9727abdaf4c13cde;hb=f742983addf80ee40aecd76b6602faa452ece91e;hp=49e2adcb8368a7251bb21e3d546a555fd0b8ce5a;hpb=79783496069e3112eab9c74cf6060cd46a3ee6d3;p=kivitendo-erp.git
diff --git a/lxo-import/contactB.php b/lxo-import/contactB.php
index 49e2adcb8..f0b286805 100644
--- a/lxo-import/contactB.php
+++ b/lxo-import/contactB.php
@@ -1,7 +1,7 @@
-
+";
echo "Feldname => Bedeutung
";
@@ -127,6 +130,7 @@ $first=true;
foreach ($zeile as $fld) {
$fld = strtolower(trim(strtr($fld,array("\""=>"","'"=>""))));
$in_fld[]=$fld;
+ if (substr($fld,0,2) == "x_") $kunde_fld[] = $fld;
}
$j=0;
$zeile=fgetcsv($f,2000,$trenner);
@@ -138,6 +142,8 @@ while (!feof($f)){
$sql="insert into contacts ";
$keys="(";
$vals=" values (";
+ unset($extra);
+ $extra = array();
foreach($zeile as $data) {
$i++;
if (!in_array($in_fld[$i],$kunde_fld)) {
@@ -163,6 +169,12 @@ while (!feof($f)){
} else if($in_fld[$i]=="cp_cv_id") {
continue;
}
+ if (substr($in_fld[$i],0,2)=="x_" && $data) {
+ $extra[substr($in_fld[$i],2)] = $data;
+ continue;
+ } else if ((substr($in_fld[$i],0,2)=="x_")) {
+ continue;
+ };
if ($in_fld[$i]==$file."number" && $data) {
if (!$id) {
$tmp=getFirma($data,$file);
@@ -223,10 +235,20 @@ while (!feof($f)){
echo "".str_replace("null,","null | ",$vals)." |
\n";
flush();
} else {
- $sql.=substr($keys,0,-1).")";
- $sql.=substr($vals,0,-1).")";
+ $newID=uniqid (rand());
+ $now = date('Y-m-d H:i').":1.$j";
+ $sql.= $keys."mtime)";
+ $sql.= $vals."'$now')";
$rc=$db->query($sql);
if (!$rc) echo "Fehler: ".$sql."\n";
+ $rs = $db->getAll("select cp_id,cp_name from contacts where mtime = '$now'");
+ $cp_id = $rs[0]["cp_id"];
+ echo "(".$rs[0]["cp_name"].":$cp_id)".count($extra).";";
+ if (count($extra)>0 and $cp_id) {
+ foreach ($extra as $fld=>$val) {
+ $rc = insertExtra("P",$cp_id,$fld,$val);
+ }
+ }
}
$j++;
};
@@ -237,7 +259,7 @@ echo $j." $file importiert.\n";} else {
?>
Kontakt-Adressimport für die ERP
- }; ?>
+