Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 6911a9c9

Von Holger Lindemann vor fast 14 Jahren hinzugefügt

  • ID 6911a9c9d7cfb2a5c363ab2f7c8009bbecf3870d
  • Vorgänger 66d0af15
  • Nachfolger 62ed3392

Extrafelder für Kontakte in CRM importieren

Unterschiede anzeigen:

lxo-import/contactB.php
127 127
foreach ($zeile as $fld) {
128 128
	$fld = strtolower(trim(strtr($fld,array("\""=>"","'"=>""))));
129 129
	$in_fld[]=$fld;
130
    if (substr($fld,0,2) == "x_") $kunde_fld[] = $fld;
130 131
}
131 132
$j=0;
132 133
$zeile=fgetcsv($f,2000,$trenner);
......
138 139
	$sql="insert into contacts ";
139 140
	$keys="(";
140 141
	$vals=" values (";
142
    unset($extra);
143
    $extra = array();
141 144
	foreach($zeile as $data) {
142 145
		$i++;
143 146
		if (!in_array($in_fld[$i],$kunde_fld)) {
......
163 166
		} else  if($in_fld[$i]=="cp_cv_id") {
164 167
			continue;
165 168
		}
169
        if (substr($in_fld[$i],0,2)=="x_" && $data) {
170
            $extra[substr($in_fld[$i],2)] = $data;
171
            continue;
172
        } else if ((substr($in_fld[$i],0,2)=="x_")) {
173
            continue;
174
        };
166 175
		if ($in_fld[$i]==$file."number" && $data) {
167 176
			if (!$id) {
168 177
				$tmp=getFirma($data,$file);
......
223 232
			echo "<tr><td>".str_replace("null,","null</td><td>",$vals)."</td></tr>\n";
224 233
			flush();
225 234
		} else {
226
			$sql.=substr($keys,0,-1).")";
227
			$sql.=substr($vals,0,-1).")";
235
            $newID=uniqid (rand());
236
            $now = date('Y-m-d H:i').":1.$j";
237
            $sql.= $keys."mtime)";
238
            $sql.= $vals."'$now')";
228 239
			$rc=$db->query($sql);
229 240
			if (!$rc) echo "Fehler: ".$sql."\n";
241
            $rs = $db->getAll("select cp_id,cp_name from contacts where mtime = '$now'");
242
            $cp_id = $rs[0]["cp_id"];
243
            echo "(".$rs[0]["cp_name"].":$cp_id)".count($extra).";";
244
            if (count($extra)>0 and $cp_id) {
245
                foreach ($extra as $fld=>$val) {
246
                    $rc = insertExtra("P",$cp_id,$fld,$val);
247
                }
248
            }
230 249
		}
231 250
		$j++;
232 251
	};
......
237 256
?>
238 257
<p class="listtop">Kontakt-Adressimport f&uuml;r die ERP</p>
239 258
<form name="import" method="post" enctype="multipart/form-data" action="contactB.php">
240
<input type="hidden" name="MAX_FILE_SIZE" value="300000">
259
<input type="hidden" name="MAX_FILE_SIZE" value="3000000">
241 260
<table>
242 261
<tr><td></td><td><input type="submit" name="ok" value="Hilfe"></td></tr>
243 262
<tr><td>Zieltabelle</td><td><input type="radio" name="ziel" value="customer" checked>customer <input type="radio" name="ziel" value="vendor">vendor</td></tr>

Auch abrufbar als: Unified diff