From: Moritz Bunkus Date: Fri, 5 Mar 2010 14:02:06 +0000 (+0100) Subject: Merge branch 'master' of ssh://git-mbunkus@lx-office.linet-services.de/~/lx-office-erp X-Git-Tag: release-2.6.1beta1~12^2~4 X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/commitdiff_plain/ee9e20c67e0e2f295c725b939ecf9b08552f5aa8?hp=26456e6e241a4487e5b52c70e36d275eb073db5b Merge branch 'master' of ssh://git-mbunkus@lx-office.linet-services.de/~/lx-office-erp --- diff --git a/SL/Form.pm b/SL/Form.pm index 8d1772061..c1cc2abb1 100644 --- a/SL/Form.pm +++ b/SL/Form.pm @@ -2576,7 +2576,7 @@ sub all_vc { my ($count) = selectrow_query($self, $dbh, $query); # build selection list - if ($count < $myconfig->{vclimit}) { + if ($count <= $myconfig->{vclimit}) { $query = qq|SELECT id, name, salesman_id FROM $table WHERE NOT obsolete ORDER BY name|; diff --git a/doc/changelog b/doc/changelog index 0a867e45d..b52032fa4 100644 --- a/doc/changelog +++ b/doc/changelog @@ -186,7 +186,7 @@ 1110 1118 1125 1127 1130 1133 1135 1136 1138 1144 1146 1147 1150 1151 1155 1164 1170 1173 1177 1186 1188 1190 1191 1195 1197 1198 1199 1200 1201 1209 1213 1243 1248 1250 1262 1286 1287 1289 1290 1291 1294 1299 1331 1334 1336 - 1339 1340 1341 1342 1343 1350 1399 + 1339 1340 1341 1342 1343 1350 1352 1399 2009-06-02 - Version 2.6.0 diff --git a/lxo-import/addressB.php b/lxo-import/addressB.php index 05ced5e85..e7f7be34e 100755 --- a/lxo-import/addressB.php +++ b/lxo-import/addressB.php @@ -48,17 +48,17 @@ function ende($txt) { echo "Abbruch: $txt
"; exit(1); } - +$dir = "../users/"; clearstatcache (); //print_r($_FILES); $test=$_POST["test"]; if (!empty($_FILES["Datei"]["name"])) { $file=$_POST["ziel"]; - if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file.".csv")) { + if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) { $file=false; echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")
"; } -} else if (is_file($_POST["ziel"].".csv")) { +} else if (is_file($dir.$_POST["ziel"].".csv")) { $file=$_POST["ziel"]; } else { $file=false; @@ -67,8 +67,12 @@ if (!empty($_FILES["Datei"]["name"])) { if (!$file) ende ("Kein Datenfile"); $trenner=($_POST["trenner"])?$_POST["trenner"]:","; +if ($trenner=="other") { + $trenner=trim($trennzeichen); + if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1)); +} -if (!file_exists("$file.csv")) ende("$file.csv nicht im Ordner oder leer"); +if (!file_exists($dir.$file.".csv")) ende("$file.csv nicht im Ordner oder leer"); if (!$db->chkcol($file)) ende("Importspalte kann nicht angelegt werden"); @@ -78,7 +82,39 @@ if (!$employee) ende("Ungültiger User"); $kunde_fld = array_keys($address); -$f=fopen("$file.csv","r"); + //Zeichencodierung des Servers + $tmpcode = $db->getServerCode(); + //Leider sind die Benennungen vom Server anders als von mb_detect_encoding + if ($tmpcode == "UTF8") { + define("ServerCode","UTF-8"); + } else if ($tmpcode == "LATIN9") { + define("ServerCode","ISO-8859-15"); + } else if ($tmpcode == "LATIN1") { + define("ServerCode","ISO-8859-1"); + } else { + define("ServerCode",$tmpcode); + } + //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos + //DB und LxO müssen ja nicht auf der gleichen Maschiene sein. + if($tmpcode<>$db->getClientCode()) { + $rc = $db->setClientCode($tmpcode); + } + + // Zeichenkodierung File + if ($_POST["encoding"] == "auto") { + define("Auto",true); + define("Translate",true); + } else { + define("Auto",false); + if ($_POST["encoding"] == ServerCode) { + define("Translate",false); + } else { + define("Translate",true); + define("FileCode",$_POST["encoding"]); + } + } + +$f=fopen($dir.$file.".csv","r"); $zeile=fgets($f,1200); $infld=split($trenner,strtolower($zeile)); $first=true; @@ -111,14 +147,14 @@ if ($ok) while (!feof($f)){ $data=trim($data); // seit 2.6 ist die DB-Kodierung UTF-8 @holger Ansonsten einmal vorher die DB-Encoding auslesen // Falls die Daten ISO-kodiert kommen entsprechend wandeln + // done! // UTF-8 MUSS als erstes stehen, da ansonsten die Prüfung bei ISO-8859-1 aufhört ... + // die blöde mb_detect... tut leider nicht immer, daher die Möglichkeit der Auswahl // TODO Umlaute am Anfang wurden bei meinem Test nicht übernommen (Österreich). S.a.: // http://forum.de.selfhtml.org/archiv/2007/1/t143904/ - $encoding = mb_detect_encoding($data,"UTF-8,ISO-8859-1,ISO-8859-15"); - if ($encoding != "UTF-8"){ - $data=mb_convert_encoding($data, "UTF-8","$encoding"); - } + if (Translate) translate($data); + //$data=htmlentities($data); $data=addslashes($data); if ($in_fld[$i]==$file."number") { // customernumber || vendornumber @@ -132,12 +168,9 @@ 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]=="ustid"){ - Was passiert hier: - $data=strtr(" ","",$data); - SUCHE IN ' ' nach dem Vorkommen von '' mit der BOOLEAN-Interpretation von $data - demnach gibt es immer eine leere Zeichenkette zurück. - }*/ /*else if ($in_fld[$i]=="matchcode") { + } else if ($in_fld[$i]=="ustid"){ + $data=strtr($data," ",""); + } /*else if ($in_fld[$i]=="matchcode") { $matchcode=$data; $i++; continue; @@ -208,9 +241,26 @@ echo $j." $file importiert.\n"; - + +
Zieltabellecustomer vendor
Trennzeichen
Trennzeichen + Semikolon + Komma + Tabulator + Leerzeichen + + +
Testja
Daten
Verwendete
Zeichecodierung
+ +
diff --git a/lxo-import/contactB.php b/lxo-import/contactB.php index e07bedb2a..49e2adcb8 100644 --- a/lxo-import/contactB.php +++ b/lxo-import/contactB.php @@ -28,6 +28,8 @@ $db=$_SESSION["db"]; //new myDB($login); $crm=checkCRM(); if ($_POST["ok"]) { + $dir = "../users/"; + $test=$_POST["test"]; if ($crm) { @@ -55,14 +57,19 @@ if ($_POST["ok"]) { clearstatcache (); $trenner=($_POST["trenner"])?$_POST["trenner"]:","; + if ($trenner=="other") { + $trenner=trim($trennzeichen); + if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1)); + } + if (!empty($_FILES["Datei"]["name"])) { $file=$_POST["ziel"]; - if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file."_contact.csv")) { + if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file."_contact.csv")) { $file=false; echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")
"; } -} else if (is_file($_POST["ziel"]."_contact.csv")) { +} else if (is_file($dir.$_POST["ziel"]."_contact.csv")) { $file=$_POST["ziel"]; } else { $file=false; @@ -70,16 +77,49 @@ if (!empty($_FILES["Datei"]["name"])) { if (!$file) ende (2); -if (!file_exists($file."_contact.csv")) ende(5); +if (!file_exists($dir.$file."_contact.csv")) ende(5); -$prenumber=$_POST["prenumber"]; +//$prenumber=$_POST["prenumber"]; $employee=chkUsr($_SESSION["employee"]); if (!$employee) ende(4); if (!$db->chkcol($file)) ende(6); -$f=fopen($file."_contact.csv","r"); + //Zeichencodierung des Servers + $tmpcode = $db->getServerCode(); + //Leider sind die Benennungen vom Server anders als von mb_detect_encoding + if ($tmpcode == "UTF8") { + define("ServerCode","UTF-8"); + } else if ($tmpcode == "LATIN9") { + define("ServerCode","ISO-8859-15"); + } else if ($tmpcode == "LATIN1") { + define("ServerCode","ISO-8859-1"); + } else { + define("ServerCode",$tmpcode); + } + //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos + //DB und LxO müssen ja nicht auf der gleichen Maschiene sein. + if($tmpcode<>$db->getClientCode()) { + $rc = $db->setClientCode($tmpcode); + } + + // Zeichenkodierung File + if ($_POST["encoding"] == "auto") { + define("Auto",true); + define("Translate",true); + } else { + define("Auto",false); + if ($_POST["encoding"] == ServerCode) { + define("Translate",false); + } else { + define("Translate",true); + define("FileCode",$_POST["encoding"]); + } + } + + +$f=fopen($dir.$file."_contact.csv","r"); $zeile=fgetcsv($f,2000,$trenner); $first=true; @@ -105,6 +145,7 @@ while (!feof($f)){ } $data=addslashes(trim($data)); if ($in_fld[$i]=="firma" && $data) { + if (Translate) translate($data); $data=suchFirma($file,$data); if ($data) { $id=$data["cp_cv_id"]; @@ -149,15 +190,18 @@ while (!feof($f)){ if ($data==false or empty($data) or !$data) { $vals.="null,"; } else { - if (in_array($in_fld[$i],array("cp_fax","cp_phone1","cp_phone2"))) { - $data=$prenumber.$data; - } else if ($in_fld[$i]=="cp_country" && $data) { - $data=mkland($data); - } - if ($in_fld[$i]=="cp_name") $name=true; - $vals.="'".$data."',"; - // bei jedem gefuellten Datenfeld erhoehen - $val_count++; + + if (Translate) translate($data); + + /*if (in_array($in_fld[$i],array("cp_fax","cp_phone1","cp_phone2"))) { + $data=$prenumber.$data; + } else if ($in_fld[$i]=="cp_country" && $data) { + $data=mkland($data); + } */ + if ($in_fld[$i]=="cp_name") $name=true; + $vals.="'".$data."',"; + // bei jedem gefuellten Datenfeld erhoehen + $val_count++; } } if (!$name) { @@ -197,10 +241,27 @@ echo $j." $file importiert.\n";} else { - - + + +
Zieltabellecustomer vendor
Trennzeichen
Telefonvorwahl
Trennzeichen + Semikolon + Komma + Tabulator + Leerzeichen + + +
Testja
Daten
Verwendete
Zeichecodierung
+ +
diff --git a/lxo-import/db.php b/lxo-import/db.php index aae192c0f..3c884d0e8 100644 --- a/lxo-import/db.php +++ b/lxo-import/db.php @@ -134,6 +134,26 @@ class myDB extends DB { } else { return true; }; } + /** + * Zeichekodirung der DB ermitteln + * + * @return String + */ + function getServerCode() { + $sql="SHOW server_encoding"; + $rs = $this->getAll($sql); + return $rs[0]["server_encoding"]; + } + function getClientCode() { + $sql="SHOW client_encoding"; + $rs = $this->getAll($sql); + return $rs[0]["client_encoding"]; + } + function setClientCode($encoding) { + $sql="SET client_encoding = '$encoding'"; + $rc = $this->query($sql); + return $rc; + } } ?> diff --git a/lxo-import/import_lib.php b/lxo-import/import_lib.php index 2abec363c..e2eb34c5d 100644 --- a/lxo-import/import_lib.php +++ b/lxo-import/import_lib.php @@ -93,6 +93,7 @@ $parts = array( "partsgroup2" => "3.Warengruppenbezeichnung", "partsgroup3" => "4.Warengruppenbezeichnung", "partsgroup4" => "5.Warengruppenbezeichnung", + "shop" => "Shopexport vorghesehen", ); $contactscrm = array( @@ -369,5 +370,20 @@ function authuser($dbhost,$dbport,$dbuser,$dbpasswd,$dbname,$cookie) { $db->query($sql,"authuser_3"); return $auth; } +/** + * Zeichencode übersetzen + * + * @param String $txt + */ +function translate(&$txt) { + if (Auto) { + $encoding = mb_detect_encoding($data,"UTF-8,ISO-8859-1,ISO-8859-15,Windows-1252,ASCII"); + $txt = iconv("$encoding",ServerCode."//TRANSLIT",$txt); + //$txt = mb_convert_encoding($txt, ServerCode,"$encoding"); + } else { + $txt = iconv(FileCode,ServerCode."//TRANSLIT",$txt); + //$txt = mb_convert_encoding($txt, ServerCode,FileCode); + } +} ?> diff --git a/lxo-import/partsB.php b/lxo-import/partsB.php index 961946612..920b31b7f 100644 --- a/lxo-import/partsB.php +++ b/lxo-import/partsB.php @@ -27,11 +27,41 @@ if (!anmelden()) ende("Anmeldung fehlgeschlagen."); /* get DB instance */ $db=$_SESSION["db"]; //new myDB($login); - /* just display page or do real import? */ if ($_POST["ok"]) { require ("parts_import.php"); + //Zeichencodierung des Servers + $tmpcode = $db->getServerCode(); + //Leider sind die Benennungen vom Server anders als von mb_detect_encoding + if ($tmpcode == "UTF8") { + define("ServerCode","UTF-8"); + } else if ($tmpcode == "LATIN9") { + define("ServerCode","ISO-8859-15"); + } else if ($tmpcode == "LATIN1") { + define("ServerCode","ISO-8859-1"); + } else { + define("ServerCode",$tmpcode); + } + //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos + //DB und LxO müssen ja nicht auf der gleichen Maschiene sein. + if($tmpcode<>$db->getClientCode()) { + $rc = $db->setClientCode($tmpcode); + } + + // Zeichenkodierung File + if ($_POST["encoding"] == "auto") { + define("Auto",true); + define("Translate",true); + } else { + define("Auto",false); + if ($_POST["encoding"] == ServerCode) { + define("Translate",false); + } else { + define("Translate",true); + define("FileCode",$_POST["encoding"]); + } + } /* display help */ if ($_POST["ok"]=="Hilfe") { @@ -66,24 +96,24 @@ if ($_POST["ok"]) { $precision = $_POST["precision"]; $quotation = $_POST["quotation"]; $quottype = $_POST["quottype"]; - $file = "../users/parts.csv"; - $table = "parts"; + $file = "parts"; /* no data? */ if (empty($_FILES["Datei"]["name"])) ende ("Kein Datenfile angegeben"); /* copy file */ - if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file)) { + $dir="../users/"; + if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file.".csv")) { ende ("Upload von Datei fehlerhaft.".$_FILES["Datei"]["error"]); } /* check if file is really there */ - if (!file_exists("$file") or filesize("$file")==0) - ende("Datenfile ($file) nicht im Ordner gefunden oder leer"); + if (!file_exists($dir.$file.'.csv') or filesize($dir.$file.'.csv')==0) + ende("Datenfile ($file.csv) nicht im Ordner gefunden oder leer"); /* Zu diesem Zeitpunkt wurde der Artikel Importiert */ - if (!$db->chkcol($table)) + if (!$db->chkcol($file)) ende("Importspalte konnte nicht angelegt werden"); /* first check all elements */ @@ -94,7 +124,7 @@ if ($_POST["ok"]) { $_test["lagerplatz"]=$_POST["lagerplatz"]; /* just print data or insert it, if test is false */ - import_parts($db, $file, $trenner, $trennzeichen, $parts, FALSE, !$test, $_POST["show"],$_POST); + import_parts($db, $dir.$file, $trenner, $trennzeichen, $parts, FALSE, !$test, $_POST["show"],$_POST); } else { $bugrus=getAllBG($db); @@ -131,7 +161,7 @@ if ($_POST["ok"]) { Testja Textupdateja Warengruppen
verbinder -Shopartikel,
falls Feld leerja nein +Shopartikel
falls nicht übergebenja nein ArtWare   Dienstleistung gemischt (Spalte 'art' vorhanden) @@ -145,6 +175,16 @@ if ($_POST["ok"]) { für Artikel ohne passende Bugru Daten +Verwendete
Zeichecodierung + + diff --git a/lxo-import/parts_import.php b/lxo-import/parts_import.php index 2f0edd0a2..0107c39db 100644 --- a/lxo-import/parts_import.php +++ b/lxo-import/parts_import.php @@ -1,4 +1,4 @@ - //Holger Lindemann @@ -210,7 +210,7 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins $parts_fld = array_keys($fields); /* open csv file */ - $f=fopen("$file","r"); + $f=fopen($file.'.csv',"r"); /* * read first line with table descriptions @@ -222,7 +222,7 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins show("weight"); show("image"); show("partsgroup_id"); show("bg"); show("income_accno"); show("expense_accno"); show("inventory_accno"); show("microfiche");show("drawing");show("rop"); - show("assembly");show("makemodel");show("shop"); show(""); + show("assembly");show("makemodel"); show("shop"); show(""); show("\n",false); } @@ -250,8 +250,8 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins while ( ($zeile=fgetcsv($f,120000,$trenner)) != FALSE) { $m++; /* increase line */ $unit=false; - unset($pgroup); + unset($partsgroup_id); unset($notes); unset($rop); unset($weight); @@ -274,15 +274,22 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins /* Langtext zusammenbauen */ if ($zeile[$fldpos["notes"]]) { - $notes = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes"]]); - $notes = addslashes($notes); + //Kundenspezifisch: + //$notes = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes"]]); + $notes = addslashes($zeile[$fldpos["notes"]]); + if (Translate) translate($notes); } if ($zeile[$fldpos["notes1"]]) { - $notes1 = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes1"]]); + //Kundenspezifisch: + //$notes1 = preg_replace('/""[^ ]/','"',$zeile[$fldpos["notes1"]]); + $notes1 = addslashes($zeile[$fldpos["notes1"]]); +echo "!".$notes1."!
"; + if (Translate) translate($notes1); +echo "!".$notes1."!
"; if ($notes) { - $notes = "\n".addslashes($notes1); + $notes .= "\n".$notes1; } else { - $notes = addslashes($notes1); + $notes = $notes1; } } @@ -294,16 +301,21 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins if ($fldpos["partsgroup4"]>0 and $zeile[$fldpos["partsgroup4"]]) $pgroup[]=$zeile[$fldpos["partsgroup4"]]; if (count($pgroup)>0) { $pgname = implode($wgtrenner,$pgroup); + if (Translate) translate($pgname); $partsgroup_id = getPartsgroupId($db, $pgname, $insert); } /* sind Hersteller und Modelnummer hinterlegt wenn ja, erfolgt er insert später */ if (!empty($zeile[$fldpos["makemodel"]]) and !$artikel) { - $hersteller=suchFirma("vendor",$zeile[$fldpos["makemodel"]]); + $mm = $zeile[$fldpos["makemodel"]]; + if (Translate) translate($mm); + $hersteller=suchFirma("vendor",$mm); $hersteller=$hersteller["cp_cv_id"]; if (!empty($zeile[$fldpos["model"]])) { - $model = $zeile[$fldpos["model"]]; + $mo = $zeile[$fldpos["model"]]; + if (Translate) translate($mo); + $model = $mo; $makemodel = 't'; } else { unset($hersteller); @@ -378,6 +390,7 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins $description = preg_replace('/""[^ ]/','"',$zeile[$fldpos["description"]]); $description = addslashes($description); + if (Translate) translate($description); // rop und weight müssen null oder Zahl sein if ($zeile[$fldpos["rop"]]) $rop = 1 * str_replace(",", ".",$zeile[$fldpos["rop"]]); @@ -385,12 +398,13 @@ function import_parts($db, $file, $trenner, $trennzeichen, $fields, $check, $ins // Shop-Artikel if ($zeile[$fldpos["shop"]]) { - $shop = ($zeile[$fldpos["shop"]] > 0)?'t':'f'; + $shop = (strtolower($zeile[$fldpos["shop"]]=='t'))?'t':'f'; } else { $shop = $maske["shop"]; } // Artikel updaten + if (getPartsid($db,trim($zeile[$fldpos["partnumber"]]))) { /* es gibt die Artikelnummer */ if ($Update) { diff --git a/lxo-import/shiptoB.php b/lxo-import/shiptoB.php index bc79db100..5bb41d6a7 100644 --- a/lxo-import/shiptoB.php +++ b/lxo-import/shiptoB.php @@ -44,6 +44,8 @@ $db=$_SESSION["db"]; //new myDB($login); $crm=checkCRM(); if ($_POST["ok"] == "Import") { + $dir = "../users/"; + $test=$_POST["test"]; $shipto_fld = array_keys($shiptos); @@ -54,28 +56,63 @@ if ($_POST["ok"] == "Import") { clearstatcache (); $trenner=($_POST["trenner"])?$_POST["trenner"]:","; + if ($trenner=="other") { + $trenner=trim($trennzeichen); + if (substr($trenner,0,1)=="#") if (strlen($trenner)>1) $trenner=chr(substr($trenner,1)); + }; if (!empty($_FILES["Datei"]["name"])) { $file=$_POST["ziel"]; - if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$file."_shipto.csv")) { + if (!move_uploaded_file($_FILES["Datei"]["tmp_name"],$dir.$file."_shipto.csv")) { $file=false; echo "Upload von ".$_FILES["Datei"]["name"]." fehlerhaft. (".$_FILES["Datei"]["error"].")
"; } - } else if (is_file($_POST["ziel"]."_shipto.csv")) { + } else if (is_file($dir.$_POST["ziel"]."_shipto.csv")) { $file=$_POST["ziel"]; } else { $file=false; } if (!$file) ende ("Kein Datenfile"); - if (!file_exists($file."_shipto.csv")) ende($file."_shipto.csv nicht im Ordner gefunden oder leer"); + if (!file_exists($dir.$file."_shipto.csv")) ende($file."_shipto.csv nicht im Ordner gefunden oder leer"); $employee=chkUsr($_SESSION["employee"]); if (!$employee) ende("Benutzer unbekannt"); if (!$db->chkcol($file)) ende("Importspalte konnte nicht angelegt werden"); + //Zeichencodierung des Servers + $tmpcode = $db->getServerCode(); + //Leider sind die Benennungen vom Server anders als von mb_detect_encoding + if ($tmpcode == "UTF8") { + define("ServerCode","UTF-8"); + } else if ($tmpcode == "LATIN9") { + define("ServerCode","ISO-8859-15"); + } else if ($tmpcode == "LATIN1") { + define("ServerCode","ISO-8859-1"); + } else { + define("ServerCode",$tmpcode); + } + //Zeichensatz sollte gleich sein, sonst ist die Datenkonvertierung nutzlos + //DB und LxO müssen ja nicht auf der gleichen Maschiene sein. + if($tmpcode<>$db->getClientCode()) { + $rc = $db->setClientCode($tmpcode); + } + + // Zeichenkodierung File + if ($_POST["encoding"] == "auto") { + define("Auto",true); + define("Translate",true); + } else { + define("Auto",false); + if ($_POST["encoding"] == ServerCode) { + define("Translate",false); + } else { + define("Translate",true); + define("FileCode",$_POST["encoding"]); + } + } - $f=fopen($file."_shipto.csv","r"); + $f=fopen($dir.$file."_shipto.csv","r"); $zeile=fgetcsv($f,1000,$trenner); $first=true; @@ -85,7 +122,7 @@ if ($_POST["ok"] == "Import") { } $j=0; $n=0; - $prenumber=$_POST["prenumber"]; + //$prenumber=$_POST["prenumber"]; $zeile=fgetcsv($f,1000,$trenner); while (!feof($f)){ @@ -116,6 +153,7 @@ if ($_POST["ok"] == "Import") { } if ($in_fld[$i]=="firma") { if ($id) continue; + if (Translate) translate($data); $data=suchFirma($file,$data); if ($data) { $id=$data["cp_cv_id"]; @@ -127,9 +165,10 @@ if ($_POST["ok"] == "Import") { if ($data==false or empty($data) or !$data) { $vals.="null,"; } else { - if (in_array($in_fld[$i],array("shiptofax","shiptophone"))) { + /*if (in_array($in_fld[$i],array("shiptofax","shiptophone"))) { $data=$prenumber.$data; - } + } */ + if (Translate) translate($data); $vals.="'".$data."',"; // bei jedem gefuellten Datenfeld erhoehen $val_count++; @@ -167,10 +206,27 @@ if ($_POST["ok"] == "Import") { - - + + +
Zieltabellecustomer vendor
Trennzeichen
Telefonvorwahl
Trennzeichen + Semikolon + Komma + Tabulator + Leerzeichen + + +
Testja
Daten
Verwendete
Zeichecodierung
+ +