X-Git-Url: http://wagnertech.de/gitweb/gitweb.cgi/mfinanz.git/blobdiff_plain/9dda820f45ce31c9c42902d61949d7679d2de94a..f1775ca:/lxo-import/contactB.php
diff --git a/lxo-import/contactB.php b/lxo-import/contactB.php
index e07bedb2a..4a157c4f9 100644
--- a/lxo-import/contactB.php
+++ b/lxo-import/contactB.php
@@ -1,7 +1,7 @@
-
+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,11 +241,28 @@ echo $j." $file importiert.\n";} else {
- }; ?>
+