Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision 0a4891e3

Von Holger Lindemann vor mehr als 16 Jahren hinzugefügt

  • ID 0a4891e33e1ee05dd0363d985fb1a2205e25c63c
  • Vorgänger 72ef551a
  • Nachfolger 57096a48

Freigabe der Shopschnittstelle für xtCommerce
readme.first lesen!

Unterschiede anzeigen:

xtcom/artistic_license
1
The Artistic License
2

  
3
Preamble
4

  
5
The intent of this document is to state the conditions under which a Package may be copied, such that the Copyright Holder maintains some semblance of artistic control over the development of the package, while giving the users of the package the right to use and distribute the Package in a more-or-less customary fashion, plus the right to make reasonable modifications.
6

  
7
Definitions:
8

  
9
    * "Package" refers to the collection of files distributed by the Copyright Holder, and derivatives of that collection of files created through textual modification.
10
    * "Standard Version" refers to such a Package if it has not been modified, or has been modified in accordance with the wishes of the Copyright Holder.
11
    * "Copyright Holder" is whoever is named in the copyright or copyrights for the package.
12
    * "You" is you, if you're thinking about copying or distributing this Package.
13
    * "Reasonable copying fee" is whatever you can justify on the basis of media cost, duplication charges, time of people involved, and so on. (You will not be required to justify it to the Copyright Holder, but only to the computing community at large as a market that must bear the fee.)
14
    * "Freely Available" means that no fee is charged for the item itself, though there may be fees involved in handling the item. It also means that recipients of the item may redistribute it under the same conditions they received it.
15

  
16
1. You may make and give away verbatim copies of the source form of the Standard Version of this Package without restriction, provided that you duplicate all of the original copyright notices and associated disclaimers.
17

  
18
2. You may apply bug fixes, portability fixes and other modifications derived from the Public Domain or from the Copyright Holder. A Package modified in such a way shall still be considered the Standard Version.
19

  
20
3. You may otherwise modify your copy of this Package in any way, provided that you insert a prominent notice in each changed file stating how and when you changed that file, and provided that you do at least ONE of the following:
21

  
22
    a) place your modifications in the Public Domain or otherwise make them Freely Available, such as by posting said modifications to Usenet or an equivalent medium, or placing the modifications on a major archive site such as ftp.uu.net, or by allowing the Copyright Holder to include your modifications in the Standard Version of the Package.
23

  
24
    b) use the modified Package only within your corporation or organization.
25

  
26
    c) rename any non-standard executables so the names do not conflict with standard executables, which must also be provided, and provide a separate manual page for each non-standard executable that clearly documents how it differs from the Standard Version.
27

  
28
    d) make other distribution arrangements with the Copyright Holder.
29

  
30
4. You may distribute the programs of this Package in object code or executable form, provided that you do at least ONE of the following:
31

  
32
    a) distribute a Standard Version of the executables and library files, together with instructions (in the manual page or equivalent) on where to get the Standard Version.
33

  
34
    b) accompany the distribution with the machine-readable source of the Package with your modifications.
35

  
36
    c) accompany any non-standard executables with their corresponding Standard Version executables, giving the non-standard executables non-standard names, and clearly documenting the differences in manual pages (or equivalent), together with instructions on where to get the Standard Version.
37

  
38
    d) make other distribution arrangements with the Copyright Holder.
39

  
40
5. You may charge a reasonable copying fee for any distribution of this Package. You may charge any fee you choose for support of this Package. You may not charge a fee for this Package itself. However, you may distribute this Package in aggregate with other (possibly commercial) programs as part of a larger (possibly commercial) software distribution provided that you do not advertise this Package as a product of your own.
41

  
42
6. The scripts and library files supplied as input to or produced as output from the programs of this Package do not automatically fall under the copyright of this Package, but belong to whomever generated them, and may be sold commercially, and may be aggregated with this Package.
43

  
44
7. C or perl subroutines supplied by you and linked into this Package shall not be considered part of this Package.
45

  
46
8. The name of the Copyright Holder may not be used to endorse or promote products derived from this software without specific prior written permission.
47

  
48
9. THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
49

  
50
The End
51

  
xtcom/conf.php
1
<?
2
// Verbindung zur ERP-db
3
$ERPuser="lxoffice";
4
$ERPpass="geheim";
5
$ERPhost="localhost";
6
$ERPport="5432";
7
$ERPdbname="stable";
8
$ERPusr["Name"]="hli";
9
$ERPusr["ID"]="376";
10
$ERPdir="tmp/shopartikel.csv";
11
$ERPimgdir="/var/www/stable";
12
$maxSize="";
13
$ERPftphost="localhost";
14
$ERPftpuser="xtcom";
15
$ERPftppwd="xtcom";
16
//Verbindung zur osCommerce-db
17
$SHOPuser="root";
18
$SHOPpass="db4web";
19
$SHOPhost="localhost";
20
$SHOPport="3306";
21
$SHOPdbname="xtc304";
22
$SHOPdns="mysql://$SHOPuser:$SHOPpass@$SHOPhost/$SHOPdbname";
23
$SHOPdir="tmp/shopartikel.csv";
24
$SHOPimgdir="/var/www/xtcommerce304/images/product_images";
25
$SHOPftphost="localhost";
26
$SHOPftpuser="xtcom";
27
$SHOPftppwd="xtcom";
28
$div16["ID"]="413";
29
$div07["ID"]="414";
30
$versand["ID"]="1568";
31
$nachn["ID"]="";
32
$minder["ID"]="";
33
$paypal["ID"]="";
34
$div16["NR"]="div16";
35
$div07["NR"]="div07";
36
$versand["NR"]="versand";
37
$nachn["NR"]="";
38
$minder["NR"]="";
39
$paypal["NR"]="";
40
$div16["TAX"]="16.00000";
41
$div07["TAX"]="7.00000";
42
$versand["TAX"]="16.00000";
43
$nachn["TAX"]="";
44
$minder["TAX"]="";
45
$paypal["TAX"]="";
46
$div16["TXT"]="Diverse Artikel 16% MWSt.";
47
$div07["TXT"]="Diverse Artikel 7% MWSt.";
48
$versand["TXT"]="Versandkosten";
49
$nachn["TXT"]="";
50
$minder["TXT"]="";
51
$paypal["TXT"]="";
52
$bgcol[1]="#ddddff";
53
$bgcol[2]="#ddffdd";
54
$preA="xtc";
55
$preK="xtc";
56
$auftrnr="1";
57
$debug=true;
58
$kdnum="1";
59
$stdprice="0";
60
$altprice="0";
61
$KDGrp="2";
62
$nopic="";
63
$showErr="true";
64
$Language[0]=array("ERP"=>0,"SHOP"=>2);
65
$SHOPdefaultlang="2";
66
$SpracheAlle="true";
67
?>
xtcom/confedit.php
1
<?
2
if (!isset($_SERVER['PHP_AUTH_USER'])) {
3
	Header("WWW-Authenticate: Basic realm=\"Configurations-Editor\"");
4
	Header("HTTP/1.0 401 Unauthorized");
5
	echo "Sie m&uuml;ssen sich autentifizieren\n";
6
	exit;
7
} else {
8
	$login=($_GET["login"])?$_GET["login"]:$_POST["login"];
9
	if (file_exists ("conf$login.php")) {
10
		require "conf$login.php";
11
	} else {
12
		require "conf.php";
13
	}
14
	if ($_SERVER['PHP_AUTH_USER']<>$ERPftpuser || $_SERVER['PHP_AUTH_PW']<>$ERPftppwd) {
15
		Header("WWW-Authenticate: Basic realm=\"My Realm\"");
16
		Header("HTTP/1.0 401 Unauthorized");
17
		echo "Sie m&uuml;ssen sich autentifizieren\n";
18
		exit;
19
	}
20
	require_once "DB.php";
21
	function pg($sel) {
22
	global $dbP;
23
		echo "\t<option value=0";
24
		if ($sel==0) echo " selected";
25
		echo ">Standard VK\n";
26
		$sql="select id,pricegroup from pricegroup";
27
		if (!$dbP) return;
28
		$pgs=$dbP->getall($sql);
29
		if ($pgs) foreach ($pgs as $row) {
30
			echo "\t<option value=".$row[0];
31
			if ($sel==$row[0]) echo " selected";
32
			echo ">".$row[1]."\n";
33
		}
34
	}
35
	function shoplang($sel,$default) {
36
	global $dbM;
37
		if (!$dbM) return;
38
		$sql="SELECT L.*, C.configuration_value FROM languages L LEFT JOIN configuration C ";
39
		$sql.="ON L.code = C.configuration_value";
40
		$rs=$dbM->getAll($sql,DB_FETCHMODE_ASSOC);
41
	        if (!$rs) {
42
        	      echo "\t\t<option value='0'>keine Sprachen\n";
43
	        } else {
44
			echo "\t\t<option value='0' ".(($sel==0)?"selected":"").">nicht verwenden\n";
45
			foreach ($rs as $row) {
46
				if ($default["id"]<>$row["languages_id"]) {
47
					echo "\t\t<option value='".$row["languages_id"]."' ";
48
					echo (($row["languages_id"]==$sel)?"selected":"").">";
49
					echo ($row["code"]==$row["configuration_value"])?"!":" ";
50
					echo $row["name"]."\n";
51
				}
52
			}
53
		}
54
	}
55
	function erplang($sel) {
56
	global $dbP;
57
		if (!$dbP) return;
58
		$sql="select * from language";
59
		$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC);
60
	        if (!$rs) {
61
        	      echo "\t\t<option>keine Sprachen\n";
62
	        } else {
63
			//echo "\t\t<option value='0' ".(($sel==0)?"selected":"").">Standard\n";
64
			foreach ($rs as $row) {
65
				echo "\t\t<option value='".$row["id"]."' ";
66
				echo ($sel==$row["id"])?"selected":"";
67
				echo ">".$row["description"]."\n";
68
			}
69
		}
70
	}
71
	function getERPlangs() {
72
	global $dbP;
73
		if (!$dbP) return;
74
		$sql="select * from language";
75
		$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC);
76
		return $rs;
77
	}
78
	function getShopDefault() {
79
	global $dbM;
80
		if (!$dbM) return;
81
		$sql="select * from languages L left join configuration C on L.code=C.configuration_value ";
82
		$sql.="where  configuration_key = 'DEFAULT_LANGUAGE'";
83
		$rs=$dbM->getAll($sql,DB_FETCHMODE_ASSOC);
84
		if ($rs) {
85
		        return array("id"=>$rs[0]["languages_id"],"name"=>$rs[0]["name"]);
86
		} else  {
87
			return 0;
88
		}
89
	}
90

  
91
	if ($_POST["ok"]=="sichern") {
92
		$ok=true;
93
                $dsnP = array(
94
                    'phptype'  => 'pgsql',
95
                    'username' => $_POST["ERPuser"],
96
                    'password' => $_POST["ERPpass"],
97
                    'hostspec' => $_POST["ERPhost"],
98
                    'database' => $_POST["ERPdbname"],
99
                    'port'     => $_POST["ERPport"]
100
                );
101
		$dbP=@DB::connect($dsnP);
102
		if (DB::isError($dbP)||!$dbP) {
103
			$ok=false;
104
			echo "Keine Verbindung zur ERP<br>";
105
			echo $dbP->userinfo;
106
			$dbP=false;
107
		} else {
108
			$sql="SELECT P.id,P.description,(t.rate * 100) as rate FROM ";
109
			$sql.="parts P left join chart c on c.id=P.income_accno_id left join tax t on c.taxkey_id=t.taxkey ";
110
			$sql.="where P.partnumber = '%s'";
111
			$rs=$dbP->getall(sprintf($sql,$_POST["div16NR"]));
112
			$_POST["div16ID"]=$rs[0][0];
113
			$div16txt=addslashes($rs[0][1]);
114
			$_POST["div16TAX"]=$rs[0][2];
115
			$rs=$dbP->getall(sprintf($sql,$_POST["div07NR"]));
116
			$_POST["div07ID"]=$rs[0][0];
117
			$_POST["div07TAX"]=$rs[0][2];
118
			$div07txt=addslashes($rs[0][1]);
119
			$rs=$dbP->getall(sprintf($sql,$_POST["versandNR"]));
120
			$_POST["versandID"]=$rs[0][0];
121
			$_POST["versandTAX"]=$rs[0][2];
122
			$versandtxt=addslashes($rs[0][1]);
123
			$rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"]));
124
			$_POST["nachnID"]=$rs[0][0];
125
			$_POST["nachnTAX"]=$rs[0][2];
126
			$nachntxt=addslashes($rs[0][1]);
127
			$rs=$dbP->getall(sprintf($sql,$_POST["minderNR"]));
128
			$_POST["minderID"]=$rs[0][0];
129
			$_POST["minderTAX"]=$rs[0][2];
130
			$mindertxt=addslashes($rs[0][1]);
131
			$rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"]));
132
			$_POST["paypalID"]=$rs[0][0];
133
			$_POST["paypalTAX"]=$rs[0][2];
134
			$paypaltxt=addslashes($rs[0][1]);
135
			$rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'");
136
			$_POST["ERPusrID"]=$rs[0][0];
137
		}
138
                $dsnM = array(
139
                    'phptype'  => 'mysql',
140
                    'username' => $_POST["SHOPuser"],
141
                    'password' => $_POST["SHOPpass"],
142
                    'hostspec' => $_POST["SHOPhost"],
143
                    'database' => $_POST["SHOPdbname"],
144
                    'port'     => $_POST["SHOPport"]
145
                );
146
		$dbM=@DB::connect($dsnM);
147
		if (DB::isError($dbM)||!$dbM) {
148
			$ok=false;
149
			echo "Keine Verbindung zum Shop<br>";
150
			echo $dbM->userinfo;
151
			$dbM=false;
152
		};
153
		if ($ok) {
154
			$ShopDefaultLang=getShopDefault();
155
			$f=fopen("conf$login.php","w");
156
			$v="2.0";
157
			$d=date("Y/m/d H:i:s");
158
			fputs($f,"<?\n// Verbindung zur ERP-db\n");
159
			fputs($f,"\$ERPuser=\"".$_POST["ERPuser"]."\";\n");
160
			fputs($f,"\$ERPpass=\"".$_POST["ERPpass"]."\";\n");
161
			fputs($f,"\$ERPhost=\"".$_POST["ERPhost"]."\";\n");
162
			fputs($f,"\$ERPport=\"".$_POST["ERPport"]."\";\n");
163
			fputs($f,"\$ERPdbname=\"".$_POST["ERPdbname"]."\";\n");
164
			fputs($f,"\$ERPusr[\"Name\"]=\"".$_POST["ERPusrN"]."\";\n");
165
			fputs($f,"\$ERPusr[\"ID\"]=\"".$_POST["ERPusrID"]."\";\n");
166
			fputs($f,"\$ERPdir=\"".$_POST["ERPdir"]."\";\n");
167
			fputs($f,"\$ERPimgdir=\"".$_POST["ERPimgdir"]."\";\n");
168
			fputs($f,"\$maxSize=\"".$_POST["maxSize"]."\";\n");
169
			fputs($f,"\$ERPftphost=\"".$_POST["ERPftphost"]."\";\n");
170
			fputs($f,"\$ERPftpuser=\"".$_POST["ERPftpuser"]."\";\n");
171
			fputs($f,"\$ERPftppwd=\"".$_POST["ERPftppwd"]."\";\n");
172
			fputs($f,"//Verbindung zur osCommerce-db\n");
173
			fputs($f,"\$SHOPuser=\"".$_POST["SHOPuser"]."\";\n");
174
			fputs($f,"\$SHOPpass=\"".$_POST["SHOPpass"]."\";\n");
175
			fputs($f,"\$SHOPhost=\"".$_POST["SHOPhost"]."\";\n");
176
			fputs($f,"\$SHOPport=\"".$_POST["SHOPport"]."\";\n");
177
			fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n");
178
			fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n");
179
			fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n");
180
			fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n");
181
			fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n");
182
			fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n");
183
			fputs($f,"\$SHOPftppwd=\"".$_POST["SHOPftppwd"]."\";\n");
184
			fputs($f,"\$div16[\"ID\"]=\"".$_POST["div16ID"]."\";\n");
185
			fputs($f,"\$div07[\"ID\"]=\"".$_POST["div07ID"]."\";\n");
186
			fputs($f,"\$versand[\"ID\"]=\"".$_POST["versandID"]."\";\n");
187
			fputs($f,"\$nachn[\"ID\"]=\"".$_POST["nachnID"]."\";\n");
188
			fputs($f,"\$minder[\"ID\"]=\"".$_POST["minderID"]."\";\n");
189
			fputs($f,"\$paypal[\"ID\"]=\"".$_POST["paypalID"]."\";\n");
190
			fputs($f,"\$div16[\"NR\"]=\"".$_POST["div16NR"]."\";\n");
191
			fputs($f,"\$div07[\"NR\"]=\"".$_POST["div07NR"]."\";\n");
192
			fputs($f,"\$versand[\"NR\"]=\"".$_POST["versandNR"]."\";\n");
193
			fputs($f,"\$nachn[\"NR\"]=\"".$_POST["nachnNR"]."\";\n");
194
			fputs($f,"\$minder[\"NR\"]=\"".$_POST["minderNR"]."\";\n");
195
			fputs($f,"\$paypal[\"NR\"]=\"".$_POST["paypalNR"]."\";\n");
196
			fputs($f,"\$div16[\"TAX\"]=\"".$_POST["div16TAX"]."\";\n");
197
			fputs($f,"\$div07[\"TAX\"]=\"".$_POST["div07TAX"]."\";\n");
198
			fputs($f,"\$versand[\"TAX\"]=\"".$_POST["versandTAX"]."\";\n");
199
			fputs($f,"\$nachn[\"TAX\"]=\"".$_POST["nachnTAX"]."\";\n");
200
			fputs($f,"\$minder[\"TAX\"]=\"".$_POST["minderTAX"]."\";\n");
201
			fputs($f,"\$paypal[\"TAX\"]=\"".$_POST["paypalTAX"]."\";\n");
202
			fputs($f,"\$div16[\"TXT\"]=\"".$div16txt."\";\n");
203
			fputs($f,"\$div07[\"TXT\"]=\"".$div07txt."\";\n");
204
			fputs($f,"\$versand[\"TXT\"]=\"".$versandtxt."\";\n");
205
			fputs($f,"\$nachn[\"TXT\"]=\"".$nachntxt."\";\n");
206
			fputs($f,"\$minder[\"TXT\"]=\"".$mindertxt."\";\n");
207
			fputs($f,"\$paypal[\"TXT\"]=\"".$paypaltxt."\";\n");
208
			fputs($f,"\$bgcol[1]=\"#ddddff\";\n");
209
			fputs($f,"\$bgcol[2]=\"#ddffdd\";\n");
210
			fputs($f,"\$preA=\"".$_POST["preA"]."\";\n");
211
			fputs($f,"\$preK=\"".$_POST["preK"]."\";\n");
212
			fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n");
213
			fputs($f,"\$debug=".$_POST["debug"].";\n");
214
			fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n");
215
			fputs($f,"\$stdprice=\"".$_POST["stdprice"]."\";\n");
216
			fputs($f,"\$altprice=\"".$_POST["altprice"]."\";\n");
217
			fputs($f,"\$KDGrp=\"".$_POST["KDGrp"]."\";\n");
218
			fputs($f,"\$nopic=\"".$_POST["nopic"]."\";\n");
219
			fputs($f,"\$showErr=\"true\";\n");
220
			$Language=array();
221
			$DefaultLangOk=false;
222
			if ($_POST["ERPlang"]) foreach ($_POST["ERPlang"] as $key=>$val) {
223
				if ($_POST["SHOPlang"][$key]==$ShopDefaultLang["id"]) $DefaultLangOk=true;
224
				if ($_POST["SHOPlang"][$key])
225
					fputs($f,"\$Language[$key]=array(\"ERP\"=>$val,\"SHOP\"=>".$_POST["SHOPlang"][$key].");\n");
226
			}
227
			if (!$DefaultLangOk) {
228
				fputs($f,"\$SHOPdbname=\"\";\n");
229
				echo "Es wurde keine ERP-Sprache der Shopdefaultsprache zugewiesen.";
230
				echo "Verbindung zum Shop abgebrochen<br>";
231
			}
232
			fputs($f,"\$SHOPdefaultlang=\"".$ShopDefaultLang["id"]."\";\n");
233
			fputs($f,"\$SpracheAlle=\"".$_POST["SpracheAlle"]."\";\n");
234
			fputs($f,"?>");
235
			fclose($f);
236
			if (file_exists ("conf$login.php")) {
237
        		        require "conf$login.php";
238
        		} else {
239
        		        require "conf.php";
240
        		}
241
			$sql="select count(*) from customers_number";
242
			$rc=@$dbM->query($sql);
243
			if ($rc->code==-18) {
244
				$sql="CREATE TABLE customers_number (  cid int(6) NOT NULL auto_increment,  customers_id int(3) NOT NULL default '0', ";
245
				$sql.="kdnr int(3) NOT NULL default '0', shipto int ,  PRIMARY KEY  (cid)) TYPE=MyISAM";
246
				$rc=@$dbM->query($sql);
247
				if ($rc->code==-1) {
248
					echo "Fehler beim Erzeugen der Tabelle 'customers_number' in der Shop-db";
249
				} else {
250
					echo "Tabelle 'customers_number' in der Shop-db angelegt.";
251
				}
252
			} else {
253
				$sql="select shipto from customers_number limit 1";
254
				$rc=@$dbM->query($sql);
255
				if ($rc->code==-19) {
256
					$sql="alter table customers_number add column shipto int";
257
					$rc=@$dbM->query($sql);
258
                                	if ($rc->code==-1) {
259
						echo "Fehler beim Anlegen der Spalte 'shipto' in 'customers_number'";
260
					} else {
261
						echo "'shipto' in 'customers_number' angelegt.";
262
					}
263
				}
264
			}
265
		} else {
266
			$ERPuser=$_POST["ERPuser"];
267
			$ERPpass=$_POST["ERPpass"];
268
			$ERPhost=$_POST["ERPhost"];
269
			$ERPport=$_POST["ERPport"];
270
			$ERPdbname=$_POST["ERPdbname"];
271
			$ERPusrN=$_POST["ERPusrN"];
272
			$ERPdir=$_POST["ERPdir"];
273
			$ERPimgdir=$_POST["ERPimgdir"];
274
			$maxSize=$_POST["maxSize"];
275
			$ERPftphost=$_POST["ERPftphost"];
276
			$ERPftpuser=$_POST["ERPftpuser"];
277
			$ERPftppwd=$_POST["ERPftppwd"];
278
			$SHOPuser=$_POST["SHOPuser"];
279
			$SHOPpass=$_POST["SHOPpass"];
280
			$SHOPhost=$_POST["SHOPhost"];
281
			$SHOPport=$_POST["SHOPport"];
282
			$SHOPdbname=$_POST["SHOPdbname"];
283
			$SHOPlang=$_POST["SHOPlang"];
284
			$SHOPdir=$_POST["SHOPdir"];
285
			$SHOPimgdir=$_POST["SHOPimgdir"];
286
			$SHOPftphost=$_POST["SHOPftphost"];
287
			$SHOPftpuser=$_POST["SHOPftpuser"];
288
			$SHOPftppwd=$_POST["SHOPftppwd"];
289
			$div16NR=$_POST["div16NR"];
290
			$div07NR=$_POST["div07NR"];
291
			$versandNR=$_POST["versandNR"];
292
			$nachnNR=$_POST["nachnNR"];
293
			$minderNR=$_POST["minderNR"];
294
			$paypalNR=$_POST["paypalNR"];
295
			$preA=$_POST["preA"];
296
			$preK=$_POST["preK"];
297
			$kdnum=$_POST["kdnum"];
298
			$auftrnr=$_POST["auftrnr"];
299
			$debug=$_POST["debug"];
300
			$altprice=$_POST["altprice"];
301
			$stdprice=$_POST["stdprice"];
302
			$nopic=$_POST["nopic"];
303
		}
304
		$ERPlangs=getERPlangs();
305
		$CntERPLang=count($ERPlangs); //$rs[0][0];
306
	}	else {
307
		if (file_exists ("conf$login.php")) {
308
			require "conf$login.php";
309
		} else {
310
			require "conf.php";
311
		}
312
        	$dsnP = array(
313
                    'phptype'  => 'pgsql',
314
                    'username' => $ERPuser,
315
                    'password' => $ERPpass,
316
                    'hostspec' => $ERPhost,
317
                    'database' => $ERPdbname,
318
                    'port'     => $ERPport
319
        	);
320
		$dbP=@DB::connect($dsnP);
321
		if (DB::isError($dbP)||!$dbP) {
322
			echo "Keine Verbindung zur ERP<br>";
323
			$dbP=false;
324
			//echo $dbP->userinfo;
325
		} else {
326
			//$rs=$dbP->getAll("select count(*) from language");
327
			$ERPlangs=getERPlangs();
328
			$CntERPLang=count($ERPlangs); //$rs[0][0];
329
		}
330
        	$dsnM = array(
331
                    'phptype'  => 'mysql',
332
                    'username' => $SHOPuser,
333
                    'password' => $SHOPpass,
334
                    'hostspec' => $SHOPhost,
335
                    'database' => $SHOPdbname,
336
                    'port'     => $SHOPport
337
        	);
338
		$dbM=@DB::connect($dsnM);
339
		if (DB::isError($dbM)||!$dbM) {
340
			echo "Keine Verbindung zum SHOP<br>";
341
			$dbM=false;
342
			//echo $dbM->userinfo;
343
		} else {
344
			$ShopDefaultLang=getShopDefault();
345
		}
346
	}
347
?>
348
<html>
349
<body>
350
<center>
351
<table style="background-color:#cccccc">
352
<form name="ConfEdit" method="post" action="confedit.php">
353
<input type="hidden" name="div16ID" value="<?= $div16["ID"] ?>">
354
<input type="hidden" name="div07ID" value="<?= $div07["ID"] ?>">
355
<input type="hidden" name="minderID" value="<?= $minder["ID"] ?>">
356
<input type="hidden" name="versandID" value="<?= $versand["ID"] ?>">
357
<input type="hidden" name="nachnID" value="<?= $nachn["ID"] ?>">
358
<input type="hidden" name="paypalID" value="<?= $paypal["ID"] ?>">
359
<input type="hidden" name="ERPusrID" value="<?= $ERPusr["ID"] ?>">
360
<input type="hidden" name="login" value="<?= $login ?>">
361
<tr><th>Daten</th><th>Lx-ERP</th><th></th><th>Shop</th></tr>
362
<tr>
363
	<td>db-Host</td>
364
	<td colspan="2"><input type="text" name="ERPhost" size="25" value="<?= $ERPhost ?>"></td>
365
	<td><input type="text" name="SHOPhost" size="25" value="<?= $SHOPhost ?>"></td>
366
</tr>
367
<tr>
368
	<td>db-Port</td>
369
	<td colspan="2"><input type="text" name="ERPport" size="25" value="<?= $ERPport ?>"></td>
370
	<td><input type="text" name="SHOPport" size="25" value="<?= $SHOPport ?>"></td>
371
</tr>
372
<tr>
373
	<td>Database</td>
374
	<td colspan="2"><input type="text" name="ERPdbname" size="20" value="<?= $ERPdbname ?>"></td>
375
	<td><input type="text" name="SHOPdbname" size="20" value="<?= $SHOPdbname ?>"></td>
376
</tr>
377
<tr>
378
	<td>db-User Name</td>
379
	<td colspan="2"><input type="text" name="ERPuser" size="15" value="<?= $ERPuser ?>"></td>
380
	<td><input type="text" name="SHOPuser" size="15" value="<?= $SHOPuser ?>"></td>
381
</tr>
382
<tr>
383
	<td>db-User PWD</td>
384
	<td colspan="2"><input type="text" name="ERPpass" size="15" value="<?= $ERPpass ?>"></td>
385
	<td><input type="text" name="SHOPpass" size="15" value="<?= $SHOPpass ?>"></td>
386
</tr>
387
<tr>
388
	<td>User-ID</td>
389
	<td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>">
390
		<input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?> onFocus="blur();"></td>
391
	<td></td>
392
</tr>
393
<tr>
394
	<td>CSV-Dir</td>
395
	<td colspan="2"><input type="text" name="ERPdir" size="30" value="<?= $ERPdir ?>"></td>
396
	<td><input type="text" name="SHOPdir" size="30" value="<?= $SHOPdir ?>"></td>
397
</tr>
398
<tr>
399
	<td>Image-Dir</td>
400
	<td colspan="2"><input type="text" name="ERPimgdir" size="30" value="<?= $ERPimgdir ?>"></td>
401
	<td><input type="text" name="SHOPimgdir" size="30" value="<?= $SHOPimgdir ?>"></td>
402
</tr>
403
<tr>
404
	<td>FTP-Host</td>
405
	<td colspan="2"><input type="text" name="ERPftphost" size="20" value="<?= $ERPftphost ?>"></td>
406
	<td><input type="text" name="SHOPftphost" size="20" value="<?= $SHOPftphost ?>"></td>
407
</tr>
408
<tr>
409
	<td>FTP-User</td>
410
	<td colspan="2"><input type="text" name="ERPftpuser" size="15" value="<?= $ERPftpuser ?>"></td>
411
	<td><input type="text" name="SHOPftpuser" size="15" value="<?= $SHOPftpuser ?>"></td>
412
</tr>
413
<tr>
414
	<td>FTP-User PWD</td>
415
	<td colspan="2"><input type="text" name="ERPftppwd" size="15" value="<?= $ERPftppwd ?>"></td>
416
	<td><input type="text" name="SHOPftppwd" size="15" value="<?= $SHOPftppwd ?>"></td>
417
</tr>
418
<tr>
419
	<td>ID Diverse 16%</td>
420
	<td><input type="text" name="div16NR" size="10" value="<?= $div16["NR"] ?>">
421
		<input type="checkbox" name="a1" <?= (empty($div16["ID"])?"":"checked") ?>></td>
422
	<td>ID Diverse 7%</td>
423
	<td><input type="text" name="div07NR" size="10" value="<?= $div07["NR"] ?>">
424
		<input type="checkbox" name="a1" <?= (empty($div07["ID"])?"":"checked") ?>></td>
425
</tr>
426
<tr>
427
	<td>ID Versand</td>
428
	<td><input type="text" name="versandNR" size="10" value="<?= $versand["NR"] ?>">
429
		<input type="checkbox" name="a1" <?= (empty($versand["ID"])?"":"checked") ?>></td>
430
	<td>ID Nachname</td>
431
	<td><input type="text" name="nachnNR" size="10" value="<?= $nachn["NR"] ?>">
432
		<input type="checkbox" name="a1" <?= (empty($nachn["ID"])?"":"checked") ?>></td>
433
</tr>
434
<tr>
435
	<td>ID Paypal</td>
436
	<td><input type="text" name="paypalNR" size="10" value="<?= $paypal["NR"] ?>">
437
		<input type="checkbox" name="a1" <?= (empty($paypal["ID"])?"":"checked") ?>></td>
438
	<td>ID Mindemenge</td>
439
	<td><input type="text" name="minderNR" size="10" value="<?= $minder["NR"] ?>">
440
		<input type="checkbox" name="a1" <?= (empty($minder["ID"])?"":"checked") ?>></td>
441
</tr>
442
<tr>
443
	<td >Sprachen</td>
444
	<td ><input type="hidden" name="ERPlang[0]" value="0">Standard</td>
445
	<td >--&gt;</td>
446
	<td ><input type="hidden" name="SHOPlang[0]" value="<?= $ShopDefaultLang["id"] ?>"><?= $ShopDefaultLang["name"] ?></td>
447
</tr>
448
<? for($i=0; $i < $CntERPLang; $i++) {  ?>
449
<tr>
450
	<td >Sprachen</td>
451
	<td><input type="hidden" name="ERPlang[<?= $i+1 ?>]" value="<?= $ERPlangs[$i]["id"] ?>"><?= $ERPlangs[$i]["description"] ?>
452
	<td >--&gt;</td>
453
	<td ><select name="SHOPlang[<?= $i+1 ?>]">
454
<?= shoplang($Language[$i+1]["SHOP"],$ShopDefaultLang); ?>
455
	</select></td>
456
</tr>
457
<? } ?>
458
<tr>
459
	<td colspan="2">Nur &uuml;bersetzte Artikel</td>
460
	<td><input type="radio" name="SpracheAlle" value="true"  <?= ($SpracheAlle=="true")?"checked":"" ?>> Ja</td>
461
	<td><input type="radio" name="SpracheAlle" value="false" <?= ($SpracheAlle<>"true")?"checked":"" ?>> Nein</td>
462
</tr>
463
<tr>
464
	<td>Standardpreis</td>
465
	<td><select name="stdprice">
466
<? pg($stdprice); ?>
467
	    </select></td>
468
	<td>Defaultbild</td>
469
	<td><input type="text" name="nopic" size="20" value="<?= $nopic ?>">
470
<tr>
471
	<td>abweichender Preis</td>
472
	<td><select name="altprice">
473
<? pg($altprice); ?>
474
	    </select></td>
475
	<td>Kundengruppe</td>
476
	<td><input type="text" name="KDGrp" size="3" value="<?= $KDGrp ?>">
477
</tr>
478
<tr>
479
	<td colspan="2">Auftragsnummern durch</td>
480
	<td><input type="radio" name="auftrnr" value="1" <?= ($auftrnr==1)?"checked":"" ?>> LxO</td>
481
	<td><input type="radio" name="auftrnr" value="0" <?= ($auftrnr<>1)?"checked":"" ?>> Shop</td>
482
</tr>
483
<tr>
484
	<td colspan="2">Kundennummern durch</td>
485
	<td><input type="radio" name="kdnum" value="1" <?= ($kdnum==1)?"checked":"" ?>> LxO</td>
486
	<td><input type="radio" name="kdnum" value="0" <?= ($kdnum<>1)?"checked":"" ?>> Shop</td>
487
</tr>
488
<tr>
489
	<td colspan="2">Nummernerweiterung</td>
490
	<td>Auftrag<input type="text" name="preA" size="5" value="<?= $preA ?>"></td>
491
	<td>Kunde<input type="text" name="preK" size="5" value="<?= $preK ?>"></td>
492
</tr>
493
<tr>
494
	<td>Logging</td>
495
	<td>ein<input type="radio" name="debug" value="true" <?= ($debug=="true")?"checked":"" ?>>
496
	aus<input type="radio" name="debug" value="false" <?= ($debug!="true")?"checked":"" ?>></td>
497
	<td></td><td></td>
498
</tr>
499
<tr><td colspan="4" align="center"><input type="submit" name="ok" value="sichern"></td></tr>
500
</form>
501
</table>
502
</center>
503
</body>
504
</html>
505
<? } ?>
xtcom/diff.php
1
<?
2
// $Id: diff.php,v 1.1 2004/06/30 10:12:15 hli Exp $
3
require_once "shoplib.php";
4
$LAND=array("Germany"=>"D");
5
if ($_POST["ok"]) {
6
	foreach($_POST as $key=>$val) {
7
		if ($key=="ok") continue;
8
		if ($key=="alle") continue;
9
		$sql="update products set products_status=0 where products_model='$key'";
10
		//echo "$key $sql";
11
		echo "$key ";
12
		if (query("shop",$sql,"diff")) { echo "deaktiviert<br>"; }
13
		else { echo "konnte nicht deaktiviert werden<br>"; };
14
	}
15
} else {
16
$sql="select partnumber from parts where shop='1' order by partnumber";
17
$erp=getAll("erp",$sql,"getPartnumber");
18
if ($SHOPlang>0) {
19
	$defLang=$SHOPlang;
20
} else {
21
	$sql="select * from languages L left join configuration C on L.code=C.configuration_value where  configuration_key = 'DEFAULT_LANGUAGE'";
22
	$rs=getAll("shop",$sql,"getLanguage");
23
	if ($rs) {
24
		$defLang=$rs[0]["languages_id"];
25
	} else {
26
		$defLang=1;
27
	}
28
}
29
if ($erp) foreach ($erp as $zeile) { $arE[]=$zeile["partnumber"]; };
30
$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";
31
$shop=getAll("shop",$sql,"products_model");
32
if ($shop) foreach ($shop as $zeile) {
33
	$arS[]=$zeile["products_model"];
34
	$arID[$zeile["products_model"]]=array("id"=>$zeile["products_id"],"name"=>$zeile["products_name"]);
35
}
36

  
37
$result=@array_diff($arS,$arE);
38
if ($result) {
39
?>
40
<html>
41
<head><title>Artikelpflege</title>
42
<script language="JavaScript">
43
<!--
44
	function sel() {
45
		val=document.doppel.alle.checked;
46
		cnt=document.doppel.length;
47
		for (i=0; i<cnt; i++) {
48
			document.doppel.elements[i].checked=val;
49
		}
50
	}
51
//-->
52
</script>
53
</head>
54
<body>
55
Folgende Artikel sind in der ERP nicht mehr als Shopartikel markiert.<br>
56
Markieren Sie die Artikel, die deaktiviert werden sollen.<br>
57
<form name='doppel' method='post' action='diff.php?login=<?= $login ?>'>
58
<table>
59
<?
60
foreach ($result as $data) {
61
	echo "\t<tr><td><input type='checkbox' name='".$data."' value='1'></td><td>".$data."</td><td>".$arID[$data]["name"]."</td></tr>\n";
62
}
63
?>
64
	<tr><td><input type='checkbox' name='alle' value='1' onClick="sel()"></td><td></td><td>alle Artikel</td></tr>
65
	<tr><td colspan='3'><input type='submit' name='ok' value='ok'></td></tr>
66
</table>
67
<form>
68
<? }
69
	else { echo "Artikelbestand identisch"; };
70
} ?>
71
<!-- a href="trans.php">zur&uuml;ck</a -->
xtcom/erpexport.php
1
<?
2
/***************************************************************
3
* $Id: erpexport.php,v 1.1 2004/06/29 08:50:30 hli Exp $
4
*Author: Holger Lindemann
5
*Copyright: (c) 2004 Lx-System
6
*License: non free
7
*eMail: info@lx-system.de
8
*Version: 1.0.0
9
*ERP: Lx-Office ERP
10
***************************************************************/
11
?>
12
<html>
13
	<head><title>Lx-ERP Export der Shopartikel</title>
14
	<link type="text/css" REL="stylesheet" HREF="css/main.css"></link>
15
	<script language="JavaScript">
16
	<!--
17
		function xtcomm() {
18
			document.fld.PN.value="products_model"; document.fld.partnumber.checked=true;
19
			document.fld.BEZ.value="products_name"; document.fld.desctiption.checked=true;
20
			document.fld.GEWICHT.value="products_weight"; document.fld.weight.checked=true;
21
			document.fld.MWST.value="products_tax"; document.fld.rate.checked=true;
22
			document.fld.VK.value="products_price"; document.fld.sellprice.checked=true;
23
			document.fld.PG.value="categories_name"; document.fld.partsgroup.checked=true;
24
			document.fld.BESCHR.value="products_description"; document.fld.notes.checked=true;
25
			document.fld.LAGER.value="products_quantity"; document.fld.onhand.checked=true;
26
			document.fld.encl.value="";
27
			document.fld.deli.value=";";
28
			document.fld.crln.value="\\n";
29
			document.fld.head.checked=true;
30
			document.fld.shop.value="xtcomm";
31
		}
32
	//-->
33
	</script>
34
<body>
35

  
36
<?php
37
require_once "shoplib.php";
38

  
39
function artikel() {
40
	$sql ="SELECT P.partnumber,P.description,P.unit,P.weight,t.rate,P.sellprice,P.listprice,P.priceupdate,";
41
	$sql.="PG.partsgroup,P.notes,P.image,P.onhand,P.buchungsgruppen_id as bugru FROM ";
42
	$sql.="chart c left join tax t on c.taxkey_id=t.taxkey, parts P left join partsgroup PG on ";
43
	$sql.="PG.id=P.partsgroup_id left join buchungsgruppen B  on P.buchungsgruppen_id = B.id ";
44
	$sql.="WHERE P.shop='t'  and c.id=B.income_accno_id_0";
45
	$rs=getAll("erp",$sql,"artikel");
46
	return $rs;
47
}
48

  
49
if ($_POST["export"]) {
50
	$data=artikel();
51
	$delim=($_POST["deli"])?$_POST["deli"]:",";
52
	if (get_magic_quotes_gpc()) {
53
		$crln = stripslashes($_POST["crln"]);
54
	}
55
	$crln = str_replace('\\r', "\015", $crln);
56
	$crln = str_replace('\\n', "\012", $crln);
57
	$crln = str_replace('\\t', "\011", $crln);
58
	$encl=$_POST["encl"];
59
	$i=0;
60
	$f=fopen($ERPdir,"w");
61
	if ($_POST["partnumber"])	{$header.=$_POST["PN"].$delim; };
62
	if ($_POST["desctiption"])	{$header.=$_POST["BEZ"].$delim; };
63
	if ($_POST["unit"])		{$header.=$_POST["EINHEIT"].$delim; };
64
	if ($_POST["onhand"])		{$header.=$_POST["LAGER"].$delim; };
65
	if ($_POST["weight"])		{$header.=$_POST["GEWICHT"].$delim; };
66
	if ($_POST["rate"])		{$header.=$_POST["MWST"].$delim; };
67
	if ($_POST["sellprice"])	{$header.=$_POST["VK"].$delim; };
68
	if ($_POST["listprice"])	{$header.=$_POST["EK"].$delim; };
69
	if ($_POST["priceupdate"])	{$header.=$_POST["PDATE"].$delim; };
70
	if ($_POST["partsgroup"])	{$header.=$_POST["PG"].$delim; };
71
	if ($_POST["notes"])		{$header.=$_POST["BESCHR"].$delim; };
72
	if ($_POST["image"])		{$header.=$_POST["IMAGE"].$delim; };
73
	$header=substr($header,0,-1);
74
?>
75
<table class="liste">
76
<!-- BEGIN Artikel -->
77
<?	$i=0;
78
	$f=fopen($ERPdir,"w");
79
	if ($_POST["head"]) fputs($f,$header.$crln);
80
	foreach($data as $zeile) {
81
		$file=""; $html="";
82
		if ($_POST["shop"]=="pepper") {
83
			if (preg_match("/^\[.*\].*/",$zeile["partsgroup"])) { $PG=$zeile["partsgroup"]; }
84
			else { $PG="[".$zeile["partsgroup"]."]"; };
85
			$mwst=$zeile["rate"]*100;
86
		} else if ($_POST["shop"]=="oscomm") {
87
			$mwst=sprintf("%01.4f",($zeile["rate"]*100));
88
			$PG=$zeile["partsgroup"];
89
		} else {
90
			$PG=$zeile["partsgroup"];
91
			$mwst=$zeile["rate"]*100;
92
		};
93
		$LineCol = $bgcol[$i%2+1];
94
		if ($_POST["partnumber"])	{$file.=$encl.$zeile["partnumber"].$encl.$delim; $html.="<td>".$zeile["partnumber"]."</td>";};
95
		if ($_POST["desctiption"])	{$file.=$encl.strtr($zeile["description"],chr(13).chr(10),"  ").$encl.$delim; $html.="<td>".$zeile["description"]."</td>";};
96
		if ($_POST["unit"])			{$file.=$encl.$zeile["unit"].$encl.$delim; $html.="<td>".$zeile["unit"]."</td>";};
97
		if ($_POST["onhand"])			{$file.=$encl.$zeile["onhand"].$encl.$delim; $html.="<td>".$zeile["onhand"]."</td>";};
98
		if ($_POST["weight"])		{$file.=$encl.$zeile["weight"].$encl.$delim; $html.="<td>".$zeile["weight"]."</td>";};
99
		if ($_POST["rate"])			{$file.=$encl.$mwst.$encl.$delim; $html.="<td>".$mwst."</td>";};
100
		if ($_POST["sellprice"])	{$file.=$encl.(sprintf("%02.2f",$zeile["sellprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["sellprice"]))."</td>";};
101
		if ($_POST["listprice"])	{$file.=$encl.(sprintf("%02.2f",$zeile["listprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["listprice"]))."</td>";};
102
		if ($_POST["partsgroup"])	{$file.=$encl.$PG.$encl.$delim; $html.="<td>".$zeile["partsgroup"]."</td>";};
103
		if ($_POST["notes"])		{$file.=$encl.strtr($zeile["notes"],chr(13).chr(10),"  ").$encl.$delim; $html.="<td>".$zeile["notes"]."</td>";};
104
		if ($_POST["image"])		{$file.=$encl.$zeile["image"].$encl.$delim; $html.="<td>".$zeile["image"]."</td>";};
105
		$i++;
106
		fputs($f,substr($file,0,-1).$crln);
107
		if ($_POST["show"]) {
108
?>
109
	<tr  class="smal" onMouseover="this.bgColor='#FF0000';" onMouseout="this.bgColor='<?= $LineCol ?>';" bgcolor="<?= $LineCol ?>">
110
		<?= $html ?>
111
	</tr>
112
<? 		}
113
	}
114
?>
115
<!-- END Artikel -->
116
</table>
117
Anzahl der Artikel: <?= $i ?><br>
118
Export am : <?= date("d.m.Y : H:i") ?><br>
119
download <a href="tmp/shopartikel.csv">Exportfile</a><br><hr>
120
<?
121
	fclose($f);
122
} // if ($export)
123
?>
124
Export der Shopartikel aus Lx-ERP <br>
125
M&ouml;gliche Felder
126
<form name="fld" action="erpexport.php" method="post">
127
<input type="hidden" name="shop" value="">
128
<table>
129
	<tr>
130
		<td><input type="checkbox" name="partnumber" value="1">Artikelnummer</td>
131
		<td><input type="checkbox" name="desctiption" value="1">Bezeichnung</td>
132
		<td><input type="checkbox" name="unit" value="1">Einheit</td>
133
		<td><input type="checkbox" name="weight" value="1">Gewicht</td>
134
	</tr>
135
	<tr>
136
		<td><input type="text" name="PN" size="23"></td>
137
		<td><input type="text" name="BEZ" size="23"></td>
138
		<td><input type="text" name="EINHEIT" size="23"></td>
139
		<td><input type="text" name="GEWICHT" size="23"></td>
140
	</tr>
141
	<tr><td colspan=5></td></tr>
142
	<tr>
143
		<td><input type="checkbox" name="sellprice" value="1">Verkaufspreis</td>
144
		<td><input type="checkbox" name="listprice" value="1">Listenpreis</td>
145
		<td><input type="checkbox" name="onhand" value="1">Lagerbestand</td>
146
		<td><input type="checkbox" name="rate" value="1">MwSt</td>
147
	</tr>
148
	<tr>
149
		<td><input type="text" name="VK" size="23"></td>
150
		<td><input type="text" name="EK" size="23"></td>
151
		<td><input type="text" name="LAGER" size="23"></td>
152
		<td><input type="text" name="MWST" size="23"></td>
153
	</tr>
154
	<tr><td colspan=5></td></tr>
155
	<tr>
156
		<td><input type="checkbox" name="partsgroup" value="1">Gruppe</td>
157
		<td><input type="checkbox" name="notes" value="1">Beschreibung</td>
158
		<td><input type="checkbox" name="image" value="1">Bild</td>
159
		<td><input type="checkbox" name="show" value="1" checked>HTML-Anzeige</td>
160
	</tr>
161
	<tr>
162
		<td><input type="text" name="PG" size="23"></td>
163
		<td><input type="text" name="BESCHR" size="23"></td>
164
		<td><input type="text" name="IMAGE" size="23"></td>
165
		<td></td>
166
	</tr>
167
	<tr>
168
		<td>Feldtrenner <input type="text" name="deli" size="2" value=","></td>
169
		<td>Feldumrahmung <input type="text" name="encl" size="2" value="&quot;"></td>
170
		<td>Zeilenende <input type="text" name="crln" size="2" value="\n"></td>
171
		<td><input type="checkbox" name="head" value="1" checked>Headline</td>
172
	</tr>
173
	<tr>
174
		<td colspan=5><input type="submit" name="export" value="Export"> <input type="button" name="xsc" value="xtCommerce" onClick="xtcomm()"></td>
175
	</tr>
176
</table>
177
<a href="trans.php">zur&uuml;ck</a>
178
</form>
179
</body>
180
</html>
xtcom/info.php
1
<?php phpinfo(); ?>
xtcom/menu.ini
1

  
2
[Shop]
3

  
4
[Shop--Warenexport]
5
module=xtcom/shopimport_db.php
6

  
7
[Shop--Bestellungen]
8
module=xtcom/xtcomexport.php
9

  
10
[Shop--Konfiguration]
11
module=xtcom/confedit.php
12

  
xtcom/readme.first
1
Shop - Schnittstelle Lx-ERP <-> xt:Commerce
2

  
3

  
4
Info:
5
	Die Zusammenarbeit mit der Version 2.6.x wurde nicht getestet!
6

  
7
	Die Anmeldung der Benutzer an LxO hat sich ge?ndert. Auch wurde  Lagerwesen eingef?hrt.
8
	Damit die Schnittstelle mit Version 2.6.0 und neuer funktioniert, sollten hier Anpassungen
9
	durchgef?hrt werden.
10
	
11

  
12
Vorraussetzungen:
13
	Lx-ERP Version >= 2.4.0 < 2.6.0
14
	xt:Commerce 3.04
15
	Pear DB, PHP-ImageMagick
16

  
17
Installation:
18
Das tar-File unterhalb vom Webserververzeichnis oder vom ERP-Verzeichnis entpacken.
19

  
20
	$ cd /var/www/html
21
	$ tar xzf /pfad/zu/xtcomm.tgz
22

  
23
In das Verzeichnis oscomm wechseln und Schreibrechte auf die Datei conf.php und 
24
die Verzeichnisse xtcom und tmp f?r den Webbenutzer (apache,www-data,httpd) vergeben.
25

  
26
	$ chown apache xtcom
27
	$ chown apache xtcom/conf.php
28
	$ chmod 600 xtcom/conf.php
29
	$ chown apache xtcom/tmp
30

  
31
Bitte zuerst einen Benutzer f?r die ERP anlegen, der mit der Schnittstelle benutzt 
32
werden soll. Dann noch die Artikel 'Diverse 16%', 'Versandkosten' und 'Nachname' anlegen.
33
Sollen 'PayPal','Mindermengenzuschlag' und '7%'-Artikel extra verwendet werden, legen Sie
34
auch diese Artikel zun?chst an.
35

  
36
Im Browser dann folgende URL aufrufen:
37

  
38
	http://webserver/pfad/xtcomm/confedit.php
39

  
40
	z.B.: http://localhost/xtcomm/confedit.php
41

  
42
Benutzer und Kennwort f?r die Erstinstallation sind:
43

  
44
	xtcom / xtcom
45

  
46
Die Maske sogf?lltig ausf?llen.
47

  
48
	db-Host		db-Server f?r die jeweilige Anwendung
49
	Database	Namen der Datenbankinstanzen
50
	db-User		Username und Kennwort f?r die jeweilige Instanz
51
	User-ID		Mit dieser ID soll in die ERP geschrieben werden
52
	CSV-Dir		hier wird die csv-Datei erwartet (Schreibrechte!)
53
	Image-Dir	hier liegen die Bilder
54
	ftp-Host	Webserver der jeweiligen Anwendung
55
	ftp-User	Name und Kennwort f?r ftp-Zugang
56
	ID-xxxx		Interne ID der Waren. Lx-ERP:
57
	Shopsprache	Die Id der Voreingestellten Sprache. Nur f?r diese 
58
				werden die Artikel eingestellt.
59
	Bildergr??e	in Byte
60

  
61
Das Formular abschicken. 
62

  
63
Sollen sp?ter ?nderungen durchgef?hrt werden, so mu? bei der Anmeldung 
64
der ERP-ftp-User als Benutzer verwendet werden.
65

  
66
In der Shopinstanz mu? noch eine Tabelle angelegt werden. Das wird 
67
normalerweise durch das Programm condedit.php erledigt. Sollte das aus 
68
irgend einem Grund nicht funktionieren, f?hren Sie dazu die
69
Datei oscom.sql als Datenbankbenutzer auf die Shopinstanz aus.
70

  
71
	$ mysql -p -u dbuser dbinstanz < xtcom.sql
72
	Enter password:
73

  
74
Ist diese Tabelle nicht angelegt, werden Kunden in der ERP immer wieder neu 
75
angelegt.
76

  
77
Fehlerquellen:
78
Befinden sich ERP und Shop nicht auf dem gleichen Server, achten Sie darauf, das
79
die entsprechende Datenbank von Aussen erreichbar ist. Dazu m?ssen folgende Ports 
80
freigeschaltet werden:
81

  
82
	MySQL		3306
83
	PostgreSQL	5432
84

  
85
Auch mu? auf dem Shopserver ein ftp-Dienst eingerichtet werden, wenn Bilder ?ber-
86
tragen werden sollen. Die Firewal ist entsprechend anzupassen.
87

  
88
Arbeiten:
89
In der ERP kann nun bei den Artikeln das H?ckchen Shop gesetzt werden.
90
Bitte auch eine Warengruppe vergeben, da sonst alle Artikel in Default landen.
91
Da die ERP nur eine Kategorieebene verwalten kann, mu? der ganze Kategorienpfad
92
hintelegt werden. Die einzelnen Kategorien werden durch Ausrufezeichen (!) getrennt.
93

  
94
	Hardware -> Monitore -> LCD = Hardware!Monitore!LCD
95

  
96
Die URL f?r die Shopschnittstelle lautet:
97

  
98
	http://webservername/pfad/xtcom/trans.php
99

  
100

  
101
Die Schnittstelle kann auch in die ERP integriert werden. Dazu installieren Sie
102
die Schnittstelle wie beschrieben unterhalb der ERP. 
103
Erweitern Sie die menu.ini um die Eintr?ge im xtcom-Verzeichnis. z.B.:
104

  
105
	$ cat /pfad/zu/xtcom/menu.ini >> /pfad/zu/lx-erp/menu.ini
106

  
107
Unter dem Men?punkt Shop stehen Ihnen nun die Module shopimport_db und xtcomexport 
108
zur Verf?gung.
109

  
110
Copyright:
111
Die Schnittstelle mit ihren einzelnen Bestandteilen steht unter Copyright der
112
Lx-System. Die Schnittstelle und auch einzelne Programmabschnitte unterliegen 
113
dem Urheberrecht sowie auch anderer Gesetze zum Schutz des geistigen Eigentums. 
114
Sie d?rfen weder f?r kommerzielle Zwecke noch zur blo?en Weitergabe kopiert, 
115
ver?ndert oder Dritten zug?nglich gemacht werden.
116

  
117
				info@lx-system.de
xtcom/shopimport_csv.php
1
<?php
2
/***************************************************************
3
*Author: Holger Lindemann
4
*Copyright: (c) 2004 Lx-System
5
*License: non free
6
*eMail: info@lx-system.de
7
*Version: 1.1.0
8
*Shop: xtCommerce 2.0 RC 1.2
9
***************************************************************/
10

  
11
require_once "shoplib.php";
12
$LAND=array("Germany"=>"D");
13

  
14
function createCategory($name,$maingroup) {
15
global $langs;
16
	$newID=uniqid(rand());
17
	$sql="insert into categories (categories_image,parent_id,date_added) values ('$newID',$maingroup,now())";
18
	$rc=query("shop",$sql,"createCategory");
19
	$sql="select * from categories where categories_image = '$newID'";
20
	$rs=getAll("shop",$sql,"createCategory");
21
	$id=$rs[0]["categories_id"];
22
	$sql="update categories set categories_image = null where categories_id=$id";
23
	$rc=query("shop",$sql,"createCategory");
24
	echo "($name) ";
25
	foreach ($langs as $LANG) {
26
		$sql="insert into categories_description (categories_id,language_id,categories_name) values ($id,$LANG,'$name')";
27
		$rc=query("shop",$sql,"createCategory");
28
		if ($rc === -99) break;
29
	}
30
	return ($rc === -99)?false:$id;
31
}
32
function getCategory($name) {
33
	if (empty($name)) $name="Default";
34
	$tmp=split("!",$name);
35
	$maingroup=0;
36
	$found=true;
37
	$i=0;
38
	do {
39
		$sql="select D.*,C.parent_id from categories C left join categories_description D on C.categories_id=D.categories_id ";
40
		$sql.="where categories_name like '".$tmp[$i]."' and C.parent_id=$maingroup";
41
		$rs=getAll("shop",$sql,"getCategory");
42
		if ($rs[0]["categories_id"]) {
43
			$maingroup=$rs[0]["categories_id"];
44
			echo $maingroup.":".$rs[0]["categories_name"]." ";
45
			$i++;
46
		} else {
47
			$found=false;
48
		}
49
	} while ($rs and $found and $i<count($tmp));
50
	for (;$i<count($tmp); $i++) {
51
		$maingroup=createCategory($tmp[$i],$maingroup);
52
	}
53
	return $maingroup;
54
}
55
function insartikel($data) {
56
global $header,$tax,$defLang;
57
	$newID=uniqid(rand());
58
	$sql="insert into products (products_model,products_image) values ('".$data[array_search("products_model")]."','$newID')";
59
	$rc=query("shop",$sql,"insartikel");
60
	$sql="select * from products where products_image='$newID'";
61
	$rs=getAll("shop",$sql,"insartikel");
62
	$sql="update products set products_image=null,products_status=1 where products_id=".$rs[0]["products_id"];
63
	$rc=query("shop",$sql,"insartikel");
64
	$sql="insert into products_description (products_id,language_id,products_name) values (".$rs[0]["products_id"].",$defLang,' ')";
65
	$rc=query("shop",$sql,"insartikel");
66
	$sql="insert into products_to_categories (products_id,categories_id) values (".$rs[0]["products_id"].",".$data["categories_id"].")";
67
	$rc=query("shop",$sql,"insartikel");
68
	echo " <b>insert</b> ";
69
	updartikel($data,$rs[0]["products_id"]);
70
}
71
function updartikel($data,$id) {
72
global $header,$tax,$defLang;
73
	$sql="update products set products_price=%01.2f,products_weight=%01.2f,products_tax_class_id=%d,products_last_modified=now()  where products_id=%d";
74
	$sql=sprintf($sql,$data[array_search("products_price",$header)],$data[array_search("products_weight",$header)],$tax[$data[array_search("products_tax",$header)]],$id);
75
	$rc=query("shop",$sql,"updartikel");
76
	$sql="update products_description set products_name='%s',products_description='%s' where products_id=%d and language_id=$defLang";
77
	$sql=sprintf($sql,$data[array_search("products_name",$header)],$data[array_search("products_description",$header)],$id);
78
	$rc=query("shop",$sql,"insartikel");
79
	$sql="update products_to_categories set categories_id=".$data[array_search("categories_id",$header)]." where products_id=$id";
80
	$rc=query("shop",$sql,"insartikel");
81
	echo "(".$id." ".$data[array_search("products_name",$header)].")+++<br>";
82
}
83
function chkartikel($data) {
84
global $header,$tax;
85
	$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";
86
	$rs=getAll("shop",$sql,"chkartikel");
87
	if ($rs) {
88
			 if ($rs[0]["products_price"]<>$data[array_search("products_price",$header)])	{ updartikel($data,$rs[0]["products_id"]); }
89
		else if ($rs[0]["products_weight"]<>$data[array_search("products_weight",$header)])	{ updartikel($data,$rs[0]["products_id"]); }
90
		else if ($rs[0]["products_name"]<>$data[array_search("products_name",$header)])		{ updartikel($data,$rs[0]["products_id"]); }
91
		else if ($rs[0]["products_description"]<>$data[array_search("products_description",$header)])	{ updartikel($data,$rs[0]["products_id"]); }
92
		else if ($rs[0]["products_tax_class_id"]<>$tax[$data[array_search("products_tax",$header)]])	{ updartikel($data,$rs[0]["products_id"]); }
93
		else if ($rs[0]["categories_id"]<>$data[array_search("categories_id",$header)])		{ updartikel($data,$rs[0]["products_id"]); }
94
		else { echo "(".$rs[0]["products_id"]." ".$rs[0]["products_name"].")...<br>"; };
95
	} else {
96
		insartikel($data);
97
	}
98
}
99

  
100
$sql="select languages_id from languages";
101
$rs=getAll("shop",$sql,"sellanguageid");
102
if ($rs) {
103
	foreach ($rs as $zeile) {
104
		$langs[]=$zeile["languages_id"];
105
	}
106
} else {
107
	$langs[]=1;
108
}
109
$sql="select * from languages L left join configuration C on L.code=C.configuration_value where  configuration_key = 'DEFAULT_LANGUAGE'";
110
$rs=getAll("shop",$sql,"sellanguage");
111
if ($rs) {
112
	$defLang=$rs[0]["languages_id"];
113
} else {
114
	$defLang=$SHOPlang;
115
}
116
$sql="select * from tax_rates";
117
$rs=getAll("shop",$sql,"taxrates");
118
if ($rs) {
119
	foreach ($rs as $zeile) {
120
		$tax[$zeile["tax_rate"]]=$zeile["tax_class_id"];
121
	}
122
} else {
123
	$tax[0]="";
124
}
125

  
126
if ($_FILES["csv"]["name"] || ($_POST["nofile"] && file_exists($SHOPdir)) ) {
127
	if ($_FILES["csv"]["tmp_name"]) {
128
		move_uploaded_file($_FILES["csv"]["tmp_name"],$SHOPdir);
129
	}
130
	$f=fopen($SHOPdir,"r");
131
	$header=fgetcsv($f,1000,";");
132
	$header[]="categories_id";
133
	$data=fgetcsv($f,1000,";");
134
	while (!feof($f)) {
135
		$catId=getCategory($data[array_search("categories_name",$header)]);
136
		$data[]=$catId;
137
		chkartikel($data);
138
		$data=fgetcsv($f,1000,";");
139
	}
140
	fclose($f);
141
	echo "<a href='trans.php'>zur&uuml;ck</a>";
142
} else {
143
?>
144
<html>
145
	<head>
146
		<title>Datenaustausch ERP-xt:Commerce</title>
147
	</head>
148
<body>
149
<center>
150
<br>
151
<h1>Artikelimport aus csv-Datei in xt:Commerce</h1><br>
152
<form name="csv" action="shopimport_csv.php" enctype="multipart/form-data" method="post">
153
	<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="500000">
154
	<input type="checkbox" name="nofile" value="1">Auf dem Server vorhandene Daten importieren<br>
155
	Datenfile f&uuml;r Import <input type="file" name="csv"><br>
156
	<input type="submit" name="ok" value="ok">
157
</form>
158
</center>
159
<a href="trans.php">zur&uuml;ck</a>
160
</body>
161
</html>
162
<?
163
}
164
?>
xtcom/shopimport_db.php
1
<?php
2
/***************************************************************
3
*Author: Holger Lindemann
4
*Copyright: (c) 2004 Lx-System
5
*License: non free
6
*eMail: info@lx-system.de
7
*Version: 2.1
8
*Shop: xt:Commerce 3.04
9
*ERP: Lx-Office ERP 2.4.0
10
***************************************************************/
11
require_once "shoplib.php";
12

  
13

  
14
/*******************************************
15
* createCategoryLang($id,$lang,$name)
16
* Kategorie für eine Sprache anlegen. Ist immer
17
* in der gleichen Sprache, da ERP nur eine hat.
18
*******************************************/
19
function createCategoryLang($id,$lang,$name) {
20
	$sql="insert into categories_description (categories_id,language_id,categories_name,categories_meta_title) ";
21
	$sql.="values ($id,$lang,'$name','$name')";
22
	$rc=query("shop",$sql,"createCategoryLang");
23
	return $rc;
24
}
25

  
26
/*******************************************
27
* createCategory($name,$maingroup,$Lang,$Lanuages)
28
* Eine Kategorie in der default-Sprache anlegen
29
*******************************************/
30
function createCategory($name,$maingroup,$Lang,$Languages) {
31
	echo "Kategorie: $name<br>";
32
	//Kategorie nicht vorhanden, anlegen
33
	$newID=uniqid(rand());
34
	$sql="insert into categories (categories_image,parent_id,date_added) values ('$newID',$maingroup,now())";
35
	$rc=query("shop",$sql,"createCategory_1");
36
	if ($rc === -99) return false;
37
	$sql="select * from categories where categories_image = '$newID'";
38
	$rs=getAll("shop",$sql,"createCategory_2");
39
	$id=$rs[0]["categories_id"];
40
	$sql="update categories set categories_image = null where categories_id=$id";
41
	$rc=query("shop",$sql,"createCategory_3");
42
	if ($rc === -99) return false;
43
	createCategoryLang($id,$Lang,$name);
44
	if ($Languages) foreach ($Languages as $erp=>$shop) {
45
		if ($Lang<>$shop) {
46
			createCategoryLang($id,$shop,$name);
47
		}
48
	}
49
	return ($rc !== -99)?$id:false;
50
}
51

  
52
/*******************************************
53
* getCategory($name,$Lang,$Languages)
54
* gibt es die Kategorie schon?
55
*******************************************/
56
function getCategory($name,$Lang,$Languages) {
57
	if (empty($name)) $name="Default";
58
	$tmp=split("!",$name);
59
	$maingroup=0;
60
	$found=true;
61
	$i=0;
62
	do {
63
		$sql="select D.*,C.parent_id from categories C left join categories_description D on C.categories_id=D.categories_id ";
64
		$sql.="where (categories_name = '".$tmp[$i]."' or categories_meta_title ='".$tmp[$i]."') and ";
65
		$sql.="C.parent_id=$maingroup and language_id=$Lang";
66
		$rs=getAll("shop",$sql,"getCategory");
67
		if ($rs) {
68
			$maingroup=$rs[0]["categories_id"];
69
			$i++;
70
		} else {
71
			$found=false;
72
		}
73
	} while ($rs and $found and $i<count($tmp));
74
	for (;$i<count($tmp); $i++) {
75
		$maingroup=createCategory($tmp[$i],$maingroup,$Lang,$Languages);
76
	}
77
	return $maingroup;
78
}
79

  
80
/*******************************************
81
* getCategoryLang($name,$Lang,$defLang,$Languages
82
* ohne Funktion
83
*******************************************/
84
function getCategoryLang($name,$Lang,$defLang,$Languages) {
85
	if (empty($name)) $name="Default";
86
	$tmp=split("!",$name);
87
	$tmpname=$tmp[count($tmp)-1];
88
	$i=0;
89
	do {
90
		$sql="select * from categories_description ";
91
		$sql.="where (categories_name = '".$tmp[$i]."' or categories_meta_title ='".$tmp[$i]."') and language_id=$Lang";
92
		$rs=getAll("shop",$sql,"getCategoryLang");
93
		if ($rs) {
94
			$i++;
95
		} else {
96
			$found=false;
97
		}
98
	} while ($rs and $found and $i<count($tmp));
99
	for (;$i<count($tmp); $i++) {
100
		$id=getCategory($tmp[$i],$Lang,false);
101
		createCategoryLang($id,$shop,$tmpname);
102
	}
103
	return $id;
104
}
105

  
106
/*******************************************
107
* bilder($width,$height,$dest
108
* Bild in der gewünschten Größe erzeugen
109
*******************************************/
110
function bilder($width,$height,$dest) {
111
	//Wenn auf dem Server die php_imagick nicht installiert werden kann:
112
        //$rc=@exec("/usr/bin/convert -resize ".$width."x".$height." tmp/tmp.file_org tmp/tmp.file_$dest",$aus,$rc2);
113
        //if ($rc2>0) { echo "[Bildwandeln: $image.$dest]<br>";  return false; };
114

  
115
	if (!function_exists("imagick_readimage")) { echo "Imagick-Extention nicht installiert"; return false; };
116
	$handle=imagick_readimage("./tmp/tmp.file_org");
117
	if (!$handle) {
118
		$reason      = imagick_failedreason( $handle ) ;
119
		print "Lesen: $reason<BR>\n" ; flush();
120
		return false;
121
	}
122
	if (!imagick_resize( $handle, $width, $height, IMAGICK_FILTER_UNKNOWN, 0)) {
123
		$reason      = imagick_failedreason( $handle ) ;
124
		print "Resize: $reason<BR>\n" ;	flush();
125
		return false;
126
	}
127
	if (!imagick_writeimage( $handle,"./tmp/tmp.file_$dest")) {
128
		$reason      = imagick_failedreason( $handle ) ;
129
		print "Schreiben: $reason<BR>\n" ; 	flush();
130
		return false;
131
	}
132
	return true;
133
}
134

  
135
/*******************************************
136
* uploadImage($image,$id)
137
* Ein Bild zum Shop übertragen
138
*******************************************/
139
function uploadImage($image,$id) {
140
global $ERPftphost,$ERPftpuser,$ERPftppwd,$ERPimgdir,$SHOPftphost,$SHOPftpuser,$SHOPftppwd,
141
		$SHOPimgdir,$picsize;
142
	$picdest = array("thumb"=>"thumbnail_images","info"=>"info_images","popup"=>"popup_images","org"=>"original_images");
143
	$ok=true;
144
	// Bilder holen
145
	if ($ERPftphost=="localhost")
146
	{
147
		$aus=""; $rc2=0;
148
		if (is_file($ERPimgdir."/".$image)) {
149
			$rc3=@exec("cp $ERPimgdir/$image ./tmp/tmp.file_org",$aus,$rc2);
150
			if ($rc2>0) { $ok=false; echo "[Downloadfehler: $image]<br>"; };
151
		} else {
152
                        echo "[Downloadfehler: $ERPimgdir/$image nicht gefunden]";
153
                        return false;
154
                }
155
	} else {
156
		$conn_id = ftp_connect($ERPftphost);
157
		if ($conn_id==false) {
158
			echo "[Kein FTP-Verbindung ERP]";
159
			return false;
160
		}
161
		ftp_login($conn_id,$ERPftpuser,$ERPftppwd);
162
		$src=$ERPimgdir."/".$image;
163
		$upload=ftp_get($conn_id,"tmp/tmp.file_org","$src",FTP_BINARY);
164
		if (!$upload) { $ok=false; echo "[Ftp Downloadfehler: $image]<br>";};
165
		ftp_quit($conn_id);
166
	}
167
	if ($ok) {
168
		//Bildergrößen erzeugen
169
		if (!bilder($picsize["PRODUCT_IMAGE_THUMBNAIL_WIDTH"],$picsize["PRODUCT_IMAGE_THUMBNAIL_HEIGHT"],"thumb")) return false;
170
		if (!bilder($picsize["PRODUCT_IMAGE_INFO_WIDTH"],$picsize["PRODUCT_IMAGE_INFO_HEIGHT"],"info")) return false;
171
		if (!bilder($picsize["PRODUCT_IMAGE_POPUP_WIDTH"],$picsize["PRODUCT_IMAGE_POPUP_HEIGHT"],"popup")) return false;
172
		$name=(strrpos($image,"/")>0)?substr($image,strrpos($image,"/")+1):$image;
173
		//zum Shop übertragen
174
		if ($SHOPftphost=="localhost") {
175
			foreach ($picdest as $key => $val) {
176
				if (is_dir($SHOPimgdir."/".$val."/")) {
177
					$src=$SHOPimgdir."/".$val."/".$name;
178
					$rc2=0; $aus="";
179
					$rc3=@exec("cp ./tmp/tmp.file_$key $src",$aus,$rc2);
180
					print "!$rc2,$rc3!";
181
					if ($rc2>0) { $ok=false; echo "[Uploadfehler: $src]"; };
182
				} else {
183
					echo "[Uploadfehler: $val nicht gefunden]";
184
					return false;
185
				}
186
			}
187
		} else {
188
			$conn_id = ftp_connect($SHOPftphost);
189
			if ($conn_id==false) {
190
				echo "[Kein FTP-Verbindung Shop]";
191
				return false;
192
			}
193
			ftp_login($conn_id,$SHOPftpuser,$SHOPftppwd);
194
			foreach ($picdest as $key => $val) {
195
				$src=$SHOPimgdir."/".$val."/".$name;
196
				$upload=ftp_put($conn_id,"$src","tmp/tmp.file_".$key,FTP_BINARY);
197
				if (!$upload) { $ok=false; echo $key."[FTP Uploadfehler $src]<br>";};
198
			}
199
			ftp_quit($conn_id);
200
		}
201
		if ($ok) {
202
			$sql="update products set products_image='%s',products_last_modified=now() where products_id=%d";
203
			$sql=sprintf($sql,$name,$id);
204
			$rc=query("shop",$sql,"uploadImage");
205
			if ($rc === -99) return false;
206
			echo "i";
207
		}
208
	}
209
	return true;
210
}
211

  
212
/*******************************************
213
* insartikel($data,$defLang
214
* Einen neuen Artikel im Shop anlegen
215
*******************************************/
216
function insartikel($data,$defLang) {
217
	$newID=uniqid(rand());
218
	$sql="insert into products (products_model,products_image) values ('".$data["partnumber"]."','$newID')";
219
	$rc=query("shop",$sql,"insartikel_1");
220
	if ($rc === -99) return false;
221
	$sql="select * from products where products_image='$newID'";
222
	$rs=getAll("shop",$sql,"insartikel_2");
223
	$sql="update products set products_image=null where products_id=".$rs[0]["products_id"];
224
	$rc=query("shop",$sql,"insartikel_3");
225
	$sql="insert into products_to_categories (products_id,categories_id) values ";
226
	$sql.="(".$rs[0]["products_id"].",".$data["categories_id"].")";
227
	$rc=query("shop",$sql,"insartikel_4");
228
	if ($rc === -99) return false;
229
	echo " + ";
230
	updartikel($data,$rs[0]["products_id"],$defLang);
231
	return $rs[0]["products_id"];
232
}
233

  
234
/*******************************************
235
*
236
*
237
*******************************************/
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff