X-Git-Url: http://wagnertech.de/git?a=blobdiff_plain;f=lxo-import%2FaddressB.php;h=dcb5adb7f974c22cf37c90beccec14c4ac6d2150;hb=9c2d49bb4dae241b4290afaeeb762d9c0e584301;hp=5e19f7b4e5e0715926b50d7e2f1901b65da13ca1;hpb=c25cb4622b88c268878dc814d4b8487584315fe7;p=kivitendo-erp.git
diff --git a/lxo-import/addressB.php b/lxo-import/addressB.php
index 5e19f7b4e..dcb5adb7f 100644
--- a/lxo-import/addressB.php
+++ b/lxo-import/addressB.php
@@ -42,17 +42,17 @@ if ($_POST["ok"]=="Hilfe") {
clearstatcache ();
//print_r($_FILES);
$test=$_POST["test"];
-if (!empty($_FILES["Datei"]["name"])) {
+if (!empty($_FILES["Datei"]["name"])) {
$file=$_POST["ziel"];
if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file.".csv")) {
$file=false;
echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")
";
- }
+ }
} else if (is_file($_POST["ziel"].".csv")) {
$file=$_POST["ziel"];
} else {
$file=false;
-}
+}
if (!$file) ende (2);
@@ -74,8 +74,6 @@ $kunde_fld = array_keys($address);
$f=fopen("$file.csv","r");
$zeile=fgets($f,1200);
$infld=split($trenner,strtolower($zeile));
-//echo "$zeile
";
-//print_r($infld); echo "
";
$first=true;
$ok=true;
foreach ($infld as $fld) {
@@ -105,11 +103,12 @@ if ($ok) while (!feof($f)){
continue;
};
$data=trim($data);
+ $data=mb_convert_encoding($data,"ISO-8859-15","auto");
//$data=htmlentities($data);
$data=addslashes($data);
- if (trim($in_fld[$i])==$file."number") { // customernumber || vendornumber
+ if ($in_fld[$i]==$file."number") { // customernumber || vendornumber
if (empty($data) or !$data) {
- $data=getKdId();
+ $data=getKdId();
$number=true;
} else {
$data=chkKdId($data);
@@ -118,27 +117,21 @@ if ($ok) while (!feof($f)){
} else if ($in_fld[$i]=="taxincluded"){
$data=strtolower(substr($data,0,1));
if ($data!="f" && $data!="t") $data="f";
- } else if ($in_fld[$i]=="language") {
- $data=strtolower(substr($data,0,2));
- if (!in_array($data,array("de","en","fr"))) $data=false;
- }
- if ($in_fld[$i]=="matchcode") {
+ } else if ($in_fld[$i]=="ustid"){
+ $data=strtr(" ","",$data);
+ } /*else if ($in_fld[$i]=="matchcode") {
$matchcode=$data;
$i++;
continue;
- }
-
if ($data==false or empty($data) or !$data) {
if (in_array($in_fld[$i],array("name"))) {
$data=$matchcode;
- }
+ }
}
+ }*/
+
$keys.=$in_fld[$i].",";
if ($data==false or empty($data) or !$data) {
- if (in_array($in_fld[$i],array("name"))) {
- $keys="(";
- break;
- }
$vals.="null,";
} else {
if ($in_fld[$i]=="contact"){
@@ -169,10 +162,10 @@ if ($ok) while (!feof($f)){
//echo "Import $j
\n";
flush();
} else {
- $sql.=$keys."import)";
- $sql.=$vals."$nun)";
+ $sql.=$keys."taxzone_id,import)";
+ $sql.=$vals."0,$nun)";
$rc=$db->query($sql);
- if (!$rc) echo "Fehler: ".$vals."
";
+ if (!$rc) echo "Fehler: ".$sql."
";
}
$j++;
} else {