-
Notifications
You must be signed in to change notification settings - Fork 0
/
diff.php
70 lines (69 loc) · 2.31 KB
/
diff.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<?
// $Id: diff.php,v 1.1 2004/06/30 10:12:15 hli Exp $
if ($_POST["ok"]) {
require_once "shoplib.php";
foreach($_POST as $key=>$val) {
if ($key=="ok") continue;
if ($key=="alle") continue;
$sql="update products set products_status=0 where products_model='$key'";
//echo "$key $sql";
echo "$key ";
if (query("shop",$sql,"diff")) { echo "deaktiviert<br>"; }
else { echo "konnte nicht deaktiviert werden<br>"; };
}
} else {
$sql="select partnumber from parts where shop='1' order by partnumber";
$erp=getAll("erp",$sql,"getPartnumber");
if ($SHOPlang>0) {
$defLang=$SHOPlang;
} else {
$sql="select * from languages L left join configuration C on L.code=C.configuration_value where configuration_key = 'DEFAULT_LANGUAGE'";
$rs=getAll("shop",$sql,"getLanguage");
if ($rs) {
$defLang=$rs[0]["languages_id"];
} else {
$defLang=1;
}
}
if ($erp) foreach ($erp as $zeile) { $arE[]=$zeile["partnumber"]; };
$sql="select products_model,P.products_id,products_name from products P left join products_description D on P.products_id=D.products_id where language_id=$defLang and products_status=1 order by products_model";
$shop=getAll("shop",$sql,"products_model");
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) {
?>
<html>
<head><title>Artikelpflege</title>
<script language="JavaScript">
<!--
function sel() {
val=document.doppel.alle.checked;
cnt=document.doppel.length;
for (i=0; i<cnt; i++) {
document.doppel.elements[i].checked=val;
}
}
//-->
</script>
</head>
<body>
Folgende Artikel sind in der ERP nicht mehr als Shopartikel markiert.<br>
Markieren Sie die Artikel, die deaktiviert werden sollen.<br>
<form name='doppel' method='post' action='diff.php?login=<?= $login ?>'>
<table>
<?
foreach ($result as $data) {
echo "\t<tr><td><input type='checkbox' name='".$data."' value='1'></td><td>".$data."</td><td>".$arID[$data]["name"]."</td></tr>\n";
}
?>
<tr><td><input type='checkbox' name='alle' value='1' onClick="sel()"></td><td></td><td>alle Artikel</td></tr>
<tr><td colspan='3'><input type='submit' name='ok' value='ok'></td></tr>
</table>
<form>
<? }
else { echo "Artikelbestand identisch"; };
} ?>
<!-- a href="trans.php">zurück</a -->