// $Id: diff.php,v 1.1 2004/06/30 10:12:15 hli Exp $
require_once "DB.php";
require_once "conf.php";
if ($dbprefix<>"") { define("PREFIX",$dbprefix."_"); } else { define("PREFIX",""); }
if (!$db) {
$db=DB::connect($SHOPdns);
if (!$db) dbFehler("",$db->getDebugInfo());
if (DB::isError($db)) {
dbFehler("",$db->getDebugInfo());
die ($db->getDebugInfo());
};
$db2=DB::connect($ERPdns);
if (!$db2) dbFehler("",$db2->getDebugInfo());
if (DB::isError($db2)) {
dbFehler("",$db2->getDebugInfo());
die ($db2->getDebugInfo());
};
}
if ($_POST["ok"]) {
foreach($_POST as $key=>$val) {
if ($key=="ok") continue;
if ($key=="alle") continue;
$sql="update ".PREFIX."products set products_status=0 where products_model=$key";
echo "$key ";
if ($db->query($sql)) { echo "deaktiviert
"; }
else { echo "konnte nicht deaktiviert werden
"; };
}
} else {
$sql="select partnumber from parts where shop='1' order by partnumber";
$erp=$db2->getAll($sql,DB_FETCHMODE_ASSOC);
if ($erp) foreach ($erp as $zeile) { $arE[]=$zeile["partnumber"]; };
if ($SHOPlang>0) {
$defLang=$SHOPlang;
} else {
$sql="select * from ".PREFIX."languages L left join ".PREFIX."configuration C on L.code=C.configuration_value where configuration_key = 'DEFAULT_LANGUAGE'";
$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC);
if ($rs) {
$defLang=$rs[0]["languages_id"];
} else {
$defLang=1;
}
}
$sql="select products_model,P.products_id,products_name from ".PREFIX."products P left join ".PREFIX."products_description D on P.products_id=D.products_id where language_id=$defLang and products_status=1 order by products_model";
$shop=$db->getAll($sql,DB_FETCHMODE_ASSOC);
if ($shop) foreach ($shop as $zeile) {
$arS[]=$zeile["products_model"];
$arID[$zeile["products_model"]]=array("id"=>$zeile["products_id"],"name"=>$zeile["products_name"]);
}
$result=@array_diff($arS,$arE);
if ($result) {
?>