echo ">".$row[1]."\n";
}
}
+ /**
+ * TODO: short description.
+ *
+ * @param string $sel
+ *
+ * @return TODO
+ */
+ function charset($sel) {
+ $chars = array('','latin9','utf-8');
+ foreach ($chars as $c) {
+ echo "\t<option value='$c' ";
+ if ($sel==$c) echo " selected";
+ echo ">$c\n";
+ }
+ }
function shoplang($sel,$default) {
global $dbM;
if (!$dbM) return;
fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n");
fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n");
fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n");
+ fputs($f,"\$SHOPchar=\"".$_POST["SHOPchar"]."\";\n");
fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n");
fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n");
fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n");
fputs($f,"\$SpracheAlle=\"".$_POST["SpracheAlle"]."\";\n");
fputs($f,"?>");
fclose($f);
- echo "<br>'conf.php' geschriebeni!<br>";
+ echo "<br>'conf.php' geschrieben!<br>";
if (file_exists ("conf$login.php")) {
require "conf$login.php";
} else {
$SHOPpass=$_POST["SHOPpass"];
$SHOPhost=$_POST["SHOPhost"];
$SHOPport=$_POST["SHOPport"];
+ $SHOPchart=$_POST["SHOPchart"];
$SHOPdbname=$_POST["SHOPdbname"];
$SHOPlang=$_POST["SHOPlang"];
$SHOPdir=$_POST["SHOPdir"];
<tr>
<td>User-ID</td>
<td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>">
- <input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?> onFocus="blur();"></td>
- <td></td>
+ <input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?> onFocus="blur();"> Charset Shop:</td>
+ <td><select name="SHOPchar">
+<? charset($SHOPchar); ?>
+ </select></td>
</tr>
<tr>
<td>CSV-Dir</td>
<td><input type="text" name="SHOPftppwd" size="15" value="<?= $SHOPftppwd ?>"></td>
</tr>
<tr>
- <td>ID Diverse 19%</td>
+ <td>ID Diverse 16%</td>
<td><input type="text" name="div16NR" size="10" value="<?= $div16["NR"] ?>">
<input type="checkbox" name="a1" <?= (empty($div16["ID"])?"":"checked") ?>></td>
<td>ID Diverse 7%</td>
$login=$_GET["login"];
$debug=false;
-require_once "DB.php";
+#require_once "DB.php";
+require_once "MDB2.php";
+
if (file_exists ("conf$login.php")) {
require "conf$login.php";
} else {
/****************************************************
* Shopverbindung aufbauen
****************************************************/
-$shop=DB::connect($SHOPdns);
+/*$shop=DB::connect($SHOPdns);
if (!$shop) shopFehler("",$shop->getDebugInfo());
if (DB::isError($shop)) {
$nun=date("Y-m-d H:i:s");
if ($log) fputs($log,$nun.": Shop-Connect\n");
shopFehler("",$shop->getDebugInfo());
die ($shop->getDebugInfo());
+};*/
+$options = array();
+//print_r($SHOPdns);
+$shop=MDB2::factory($SHOPdns,$options);
+//echo "<pre>"; print_r($shop); echo "</pre>";
+if (!$shop) shopFehler("",$shop->getMessage());
+if (PEAR::isError($shop)) {
+ $nun=date("Y-m-d H:i:s");
+ if ($log) fputs($log,$nun.": Shop-Connect\n");
+ shopFehler("",$shop->getMessage());
+ die ($shop->getMessage());
};
+if (ExportMode == "1") $shop->setCharset('utf8');
+$shop->setFetchMode(MDB2_FETCHMODE_ASSOC);
+
/****************************************************
* ERPverbindung aufbauen
****************************************************/
-$erp=DB::connect($ERPdns);
+/*$erp=DB::connect($ERPdns);
if (!$erp) shopFehler("",$erp->getDebugInfo());
if (DB::isError($erp)) {
$nun=date("Y-m-d H:i:s");
die ($erp->getDebugInfo());
} else {
$erp->autoCommit(true);
+};*/
+$options = array('result_buffering' => false,);
+$erp = MDB2::factory($ERPdns,$options);
+//echo "<pre>"; print_r($erp); echo "</pre>";
+if (!$erp) shopFehler("",$erp->getMessage());
+if (PEAR::isError($erp)) {
+ $nun=date("Y-m-d H:i:s");
+ if ($log) fputs($log,$nun.": ERP-Connect\n");
+ shopFehler("",$erp->getMessage());
+ die ($erp->getMessage());
+} else {
+ if ($erp->autocommit) $erp->autocommit();
};
+if ($SHOPchar and ExportMode != "1") {
+ $erp->setCharset($SHOPchar);
+}
+$erp->setFetchMode(MDB2_FETCHMODE_ASSOC);
+
+
/****************************************************
* SQL-Befehle absetzen
if ($GLOBALS["log"]) fputs($GLOBALS["log"],$nun.": ".$function."\n".$sql."\n");
$rc=$GLOBALS[$db]->query($sql);
if ($GLOBALS["log"]) fputs($GLOBALS["log"],print_r($rc,true)."\n");
- if ($rc!==1) {
+ if(PEAR::isError($rc)) {
+ //if ($rc!==1) {
return -99;
} else {
return true;
function getAll($db,$sql,$function="--") {
$nun=date("d.m.y H:i:s");
if ($GLOBALS["log"]) fputs($GLOBALS["log"],$nun.": ".$function."\n".$sql."\n");
- $rs=$GLOBALS[$db]->getAll($sql,DB_FETCHMODE_ASSOC);
- if ($rs["message"]<>"") {
+ //$rs=$GLOBALS[$db]->getAll($sql,DB_FETCHMODE_ASSOC);
+ $rs=$GLOBALS[$db]->queryAll($sql);
+ //if ($rs["message"]<>"") {
+ if ($rs->message<>"") {
if ($GLOBALS["log"]) fputs($GLOBALS["log"],print_r($rs,true)."\n");
return false;
} else {