function chkartikel($data,$defLang) { global $tax,$erptax,$shop2erp,$KDGrp,$GeoZone,$nopic; if ($data["partnumber"]=="") { echo "Artikelnummer fehlt!<br>"; return;}; if ($data["image"]) { $data["picname"]=(strrpos($data["image"],"/")>0)?substr($data["image"],strrpos($data["image"],"/")+1):$data["image"]; } else if ($nopic) { $data["picname"]=(strrpos($nopic,"/")>0)?substr($nopic,strrpos($nopic,"/")+1):$nopic; $data["image"]=$nopic; } $data["onhand"]=floor($data["onhand"]); echo $data["partnumber"]." ".$data["description"]." -> "; $sql ="select * from products where products_model like '".$data["partnumber"]."'"; $rs=getAll("shop",$sql,"chkartikel"); $data["rate"]=$erptax[$data["bugru"]]["rate"]; if ($rs) { updartikel($data,$rs[0]["products_id"],$defLang); if ($rs[0]["products_image"]<>$data["picname"] and $data["picname"]) uploadImage($data["image"],$rs[0]["products_id"]); } else { $id=insartikel($data,$defLang); if ($data["image"]) uploadImage($data["image"],$id); } echo "<br>\n"; }
function chkartikel($data) { global $db, $shop2erp, $mwst; if ($data["partnumber"] == "") { echo "Artikelnummer fehlt!<br>"; return false; } $sql = "select * from artikel A left join artikel_kategorie K on A.Artikel_id=K.FK_Artikel_ID where Artikel_Nr like '" . $data["partnumber"] . "'"; $rs = $db->getAll($sql, DB_FETCHMODE_ASSOC); echo "(" . $data["partnumber"] . "->" . $rs[0]["Artikel_ID"] . ":" . $data["description"] . ")"; if ($rs) { if ($data["image"]) { $rc = preg_match("#(.+/)?([^\\.]+)\\.(.+)\$#", $data["image"], $treffer); if ($treffer) { $data["picname"] = $treffer[2] . "_gr." . $treffer[3]; } else { $data["picname"] = ""; } } $preis = $data["sellprice"] > 0 ? $data["sellprice"] : $data["stdprice"]; if ($mwst) { $preis += $preis / 100 * $bugru[$data["bugru"]]; } if ($rs[0]["Preis"] != $preis) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["Gewicht"] != $data["weight"]) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["Name"] != $data["description"]) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["Beschreibung"] != $data["notes"]) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["MwSt_Satz"] != $tax[sprintf("%1.4f", $data["rate"])]) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["FK_Kategorie_ID"] != $data["{$categories_id}"]) { updartikel($data, $rs[0]["Artikel_ID"]); } else { if ($rs[0]["Lagerbestand"] != $data["onhand"]) { updartikel($data, $rs[0]["Lagerbestand"]); } else { echo "...<br>"; } } } } } } } if ($rs[0]["Bild_gross"] != $data["picname"] and $data["picname"]) { uploadImage($data["image"], $rs[0]["Artikel_ID"]); } else { if ($rs[0]["Bild_gross"] and !$data["picname"]) { $sql = "update artikel set Bild_gross='', Bild_klein='' where Artikel_ID=" . $rs[0]["Artikel_ID"]; $rc = $db->query($sql); } } } else { $Artikel_ID = insartikel($data); if ($data["image"]) { uploadImage($data["image"], $Artikel_ID); } } }
function chkartikel($data) { global $header, $tax; $sql = "select * from products P left join products_description D on P.products_id=D.products_id left join products_to_categories C on P.products_id=C.products_id where products_model like '" . $data[array_search("products_model", $header)] . "' and language_id=2"; $rs = getAll("shop", $sql, "chkartikel"); if ($rs) { if ($rs[0]["products_price"] != $data[array_search("products_price", $header)]) { updartikel($data, $rs[0]["products_id"]); } else { if ($rs[0]["products_weight"] != $data[array_search("products_weight", $header)]) { updartikel($data, $rs[0]["products_id"]); } else { if ($rs[0]["products_name"] != $data[array_search("products_name", $header)]) { updartikel($data, $rs[0]["products_id"]); } else { if ($rs[0]["products_description"] != $data[array_search("products_description", $header)]) { updartikel($data, $rs[0]["products_id"]); } else { if ($rs[0]["products_tax_class_id"] != $tax[$data[array_search("products_tax", $header)]]) { updartikel($data, $rs[0]["products_id"]); } else { if ($rs[0]["categories_id"] != $data[array_search("categories_id", $header)]) { updartikel($data, $rs[0]["products_id"]); } else { echo "(" . $rs[0]["products_id"] . " " . $rs[0]["products_name"] . ")...<br>"; } } } } } } } else { insartikel($data); } }
function chkartikel($data) { global $header, $shop2erp, $erptax, $defLang; if ($data["partnumber"] == "") { echo "Artikelnummer fehlt!<br>"; return; } $sql = "select * from products P left join products_description D on P.products_id=D.products_id left join products_to_categories C on "; $sql .= "P.products_id=C.products_id where products_model like '" . $data["partnumber"] . "' and language_id={$defLang}"; echo "(" . $data["partnumber"] . "->" . $rs[0]["products_id"] . ":" . $data["description"] . ")"; if ($data["image"]) { $data["picname"] = strrpos($data["image"], "/") > 0 ? substr($data["image"], strrpos($data["image"], "/") + 1) : $data["image"]; } else { if ($nopic) { $data["picname"] = strrpos($nopic, "/") > 0 ? substr($nopic, strrpos($nopic, "/") + 1) : $nopic; $data["image"] = $nopic; } } $data["onhand"] = floor($data["onhand"]); $data["rate"] = $erptax[$data["bugru"]]["rate"]; $data["preis"] = $data["sellprice"] > 0 ? $data["sellprice"] : $data["stdprice"]; $rs = getAll("shop", $sql, "chkartikel"); if ($rs) { $rc = updartikel($data, $rs[0]["products_id"]); if ($rs[0]["products_image"] != $data["image"] and $data["picname"] and $rc) { uploadImage($data["image"], $rs[0]["products_id"]); } } else { $id = insartikel($data); if ($data["image"] and $id) { uploadImage($data["image"], $id); } } }