Revision 98255c88
Von Holger Lindemann vor fast 18 Jahren hinzugefügt
lxo-import/addressB.php | ||
---|---|---|
42 | 42 |
clearstatcache (); |
43 | 43 |
//print_r($_FILES); |
44 | 44 |
$test=$_POST["test"]; |
45 |
if (!empty($_FILES["Datei"]["name"])) {
|
|
45 |
if (!empty($_FILES["Datei"]["name"])) { |
|
46 | 46 |
$file=$_POST["ziel"]; |
47 |
echo $_FILES["Datei"]["tmp_name"]; |
|
47 | 48 |
if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file.".csv")) { |
48 | 49 |
$file=false; |
49 | 50 |
echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")<br>"; |
50 |
}
|
|
51 |
} |
|
51 | 52 |
} else if (is_file($_POST["ziel"].".csv")) { |
52 | 53 |
$file=$_POST["ziel"]; |
53 | 54 |
} else { |
54 | 55 |
$file=false; |
55 |
}
|
|
56 |
} |
|
56 | 57 |
|
57 | 58 |
if (!$file) ende (2); |
58 | 59 |
|
... | ... | |
74 | 75 |
$f=fopen("$file.csv","r"); |
75 | 76 |
$zeile=fgets($f,1200); |
76 | 77 |
$infld=split($trenner,strtolower($zeile)); |
77 |
//echo "$zeile<br>"; |
|
78 |
//print_r($infld); echo "<br>"; |
|
79 | 78 |
$first=true; |
80 | 79 |
$ok=true; |
81 | 80 |
foreach ($infld as $fld) { |
... | ... | |
105 | 104 |
continue; |
106 | 105 |
}; |
107 | 106 |
$data=trim($data); |
107 |
$data=mb_convert_encoding($data,"ISO-8859-15","auto"); |
|
108 | 108 |
//$data=htmlentities($data); |
109 | 109 |
$data=addslashes($data); |
110 |
if (trim($in_fld[$i])==$file."number") { // customernumber || vendornumber
|
|
110 |
if ($in_fld[$i]==$file."number") { // customernumber || vendornumber
|
|
111 | 111 |
if (empty($data) or !$data) { |
112 |
$data=getKdId();
|
|
112 |
$data=getKdId(); |
|
113 | 113 |
$number=true; |
114 | 114 |
} else { |
115 | 115 |
$data=chkKdId($data); |
... | ... | |
118 | 118 |
} else if ($in_fld[$i]=="taxincluded"){ |
119 | 119 |
$data=strtolower(substr($data,0,1)); |
120 | 120 |
if ($data!="f" && $data!="t") $data="f"; |
121 |
} else if ($in_fld[$i]=="language") { |
|
122 |
$data=strtolower(substr($data,0,2)); |
|
123 |
if (!in_array($data,array("de","en","fr"))) $data=false; |
|
124 |
} |
|
125 |
if ($in_fld[$i]=="matchcode") { |
|
121 |
} /*else if ($in_fld[$i]=="matchcode") { |
|
126 | 122 |
$matchcode=$data; |
127 | 123 |
$i++; |
128 | 124 |
continue; |
129 |
} |
|
130 |
|
|
131 | 125 |
if ($data==false or empty($data) or !$data) { |
132 | 126 |
if (in_array($in_fld[$i],array("name"))) { |
133 | 127 |
$data=$matchcode; |
134 |
}
|
|
128 |
} |
|
135 | 129 |
} |
130 |
}*/ |
|
131 |
|
|
136 | 132 |
$keys.=$in_fld[$i].","; |
137 | 133 |
if ($data==false or empty($data) or !$data) { |
138 |
if (in_array($in_fld[$i],array("name"))) { |
|
139 |
$keys="("; |
|
140 |
break; |
|
141 |
} |
|
142 | 134 |
$vals.="null,"; |
143 | 135 |
} else { |
144 | 136 |
if ($in_fld[$i]=="contact"){ |
... | ... | |
169 | 161 |
//echo "Import $j<br>\n"; |
170 | 162 |
flush(); |
171 | 163 |
} else { |
172 |
$sql.=$keys."import)"; |
|
173 |
$sql.=$vals."$nun)";
|
|
164 |
$sql.=$keys."taxzone_id,import)";
|
|
165 |
$sql.=$vals."0,$nun)";
|
|
174 | 166 |
$rc=$db->query($sql); |
175 | 167 |
if (!$rc) echo "Fehler: ".$vals."<br>"; |
176 | 168 |
} |
Auch abrufbar als: Unified diff
Einige Änderungen, Fehler