Projekt

Allgemein

Profil

« Zurück | Weiter » 

Revision d7def35a

Von Holger Lindemann vor etwa 17 Jahren hinzugefügt

  • ID d7def35ae83a608fe6a745361fa5234863b15b6f
  • Vorgänger 5cf977e5
  • Nachfolger 6824628e

Freigabe der Shopschnittstelle zu osCommerce

Unterschiede anzeigen:

oscom/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

  
oscom/conf.php
1
<?
2
// Verbindung zur ERP-db
3
$ERPuser="lxoffice#";
4
$ERPpass="geheim";
5
$ERPhost="localhost";
6
$ERPdbname="";
7
$ERPdns="pgsql://$ERPuser:$ERPpass@$ERPhost/$ERPdbname";
8
$ERPusr["Name"]="";
9
$ERPusr["ID"]="";
10
$ERPdir="tmp/shopartikel.csv";
11
$ERPimgdir="/usr/lib/lx-office-erp";
12
$maxSize="";
13
$ERPftphost="localhost";
14
$ERPftpuser="oscom";
15
$ERPftppwd="oscom";
16
//Verbindung zur osCommerce-db
17
$SHOPuser="";
18
$SHOPpass="";
19
$SHOPhost="localhost";
20
$SHOPdbname="";
21
$SHOPlang="";
22
$SHOPdns="mysql://$SHOPuser:$SHOPpass@$SHOPhost/$SHOPdbname";
23
$SHOPdir="tmp/shopartikel.csv";
24
$SHOPimgdir="/var/www/oscommerce/images";
25
$SHOPftphost="localhost";
26
$SHOPftpuser="oscom";
27
$SHOPftppwd="oscom";
28
$div16["ID"]="";
29
$div07["ID"]="";
30
$versand["ID"]="";
31
$nachn["ID"]="";
32
$minder["ID"]="";
33
$treuh["ID"]="";
34
$paypal["ID"]="";
35
$div16["NR"]="";
36
$div07["NR"]="";
37
$versand["NR"]="";
38
$nachn["NR"]="";
39
$minder["NR"]="";
40
$treuh["NR"]="";
41
$paypal["NR"]="";
42
$div16["TAX"]="";
43
$div07["TAX"]="";
44
$versand["TAX"]="";
45
$nachn["TAX"]="";
46
$minder["TAX"]="";
47
$treuh["TAX"]="";
48
$paypal["TAX"]="";
49
$div16["TXT"]="";
50
$div07["TXT"]="";
51
$versand["TXT"]="";
52
$nachn["TXT"]="";
53
$minder["TXT"]="";
54
$treuh["TXT"]="";
55
$paypal["TXT"]="";
56
$pricegroup="0";
57
$bgcol[1]="#ddddff";
58
$bgcol[2]="#ddffdd";
59
$preA="";
60
$preK="";
61
$auftrnr="1";
62
$debug=false;
63
$kdnum="1";
64
$stdprice="";
65
$nopic="";
66
$showErr="true";
67
?>
oscom/confedit.php
1
<?
2
// $Id: confedit.php,v 1.6 2007/01/07
3
if (!isset($_SERVER['PHP_AUTH_USER'])) {
4
	Header("WWW-Authenticate: Basic realm=\"Configurations-Editor\"");
5
	Header("HTTP/1.0 401 Unauthorized");
6
	echo "Sie m&uuml;ssen sich autentifizieren\n";
7
	exit;
8
} else {
9
	$login=($_GET["login"])?$_GET["login"]:$_POST["login"];
10
	if (file_exists ("conf$login.php")) {
11
		require "conf$login.php";
12
	} else {
13
		require "conf.php";
14
	}
15
	if ($_SERVER['PHP_AUTH_USER']<>$ERPftpuser || $_SERVER['PHP_AUTH_PW']<>$ERPftppwd) {
16
		Header("WWW-Authenticate: Basic realm=\"My Realm\"");
17
		Header("HTTP/1.0 401 Unauthorized");
18
		echo "Sie m&uuml;ssen sich autentifizieren\n";
19
		exit;
20
	}
21
	require_once "DB.php";
22
	$db=@DB::connect($ERPdns);
23
	if (!DB::isError($db)) {
24
		$sql="select id,pricegroup from pricegroup";
25
		$pgs=$db->getall($sql);
26
	}
27
	function pg($sel) {
28
	global $pgs;
29
		echo "\t<option value=0";
30
		if ($sel==0) echo " selected";
31
		echo ">Standard VK\n";
32
		if ($pgs) foreach ($pgs as $row) {
33
			echo "\t<option value=".$row[0];
34
			if ($sel==$row[0]) echo " selected";
35
			echo ">".$row[1]."\n";
36
		}
37
	}
38
	if ($_POST["ok"]=="sichern") {
39
		$ok=true;
40
		if ($_POST["ERPpass"]) {
41
			$dsnP="pgsql://".$_POST["ERPuser"].":".$_POST["ERPpass"]."@".$_POST["ERPhost"]."/".$_POST["ERPdbname"];
42
		} else {
43
			$dsnP="pgsql://".$_POST["ERPuser"]."@".$_POST["ERPhost"]."/".$_POST["ERPdbname"];
44
		}
45
		$dbP=@DB::connect($dsnP);
46
		if (DB::isError($dbP)||!$dbP) {
47
			$ok=false;
48
			echo "Keine Verbindung zur ERP<br>";
49
			echo $dbP->userinfo."<br>";
50
		} else {
51
			//Steuertabelle ERP
52
			$sql ="select  BG.id as bugru,T.rate,TK.startdate from buchungsgruppen BG left join chart C ";
53
			$sql.="on BG.income_accno_id_0=C.id left join taxkeys TK on TK.chart_id=C.id left join tax T ";
54
			$sql.="on T.id=TK.tax_id where TK.startdate <= now()";
55
			$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC);
56
			$erptax=array();
57
			foreach ($rs as $row) {
58
        		if ($erptax[$row["bugru"]]["startdate"]<$row["startdate"]) {
59
                		$erptax[$row["bugru"]]["startdate"]=$row["startdate"];
60
                		$erptax[$row["bugru"]]["rate"]=sprintf("%1.4f",$row["rate"]*100);
61
        		}
62
			}
63
			$sql ="select  P.id,P.description,P.buchungsgruppen_id as bugru from ";
64
			$sql.="parts P where P.partnumber = '%s'";
65
			$rs=$dbP->getall(sprintf($sql,$_POST["div16NR"]));
66
			$_POST["div16ID"]=$rs[0][0];
67
			$div16txt=$rs[0][1];
68
			$_POST["div16TAX"]=$erptax[$rs[0][2]]["rate"];
69
			$rs=$dbP->getall(sprintf($sql,$_POST["div07NR"]));
70
			$_POST["div07ID"]=$rs[0][0];
71
			$_POST["div07TAX"]=$erptax[$rs[0][2]]["rate"];
72
			$div07txt=$rs[0][1];
73
			$rs=$dbP->getall(sprintf($sql,$_POST["versandNR"]));
74
			$_POST["versandID"]=$rs[0][0];
75
			$_POST["versandTAX"]=$erptax[$rs[0][2]]["rate"];
76
			$versandtxt=$rs[0][1];
77
			$rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"]));
78
			$_POST["nachnID"]=$rs[0][0];
79
			$_POST["nachnTAX"]=$erptax[$rs[0][2]]["rate"];
80
			$nachntxt=$rs[0][1];
81
			$rs=$dbP->getall(sprintf($sql,$_POST["minderNR"]));
82
			$_POST["minderID"]=$rs[0][0];
83
			$_POST["minderTAX"]=$erptax[$rs[0][2]]["rate"];
84
			$mindertxt=$rs[0][1];
85
			$rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"]));
86
			$_POST["paypalID"]=$rs[0][0];
87
			$_POST["paypalTAX"]=$erptax[$rs[0][2]]["rate"];
88
			$paypaltxt=$rs[0][1];
89
			$rs=$dbP->getall(sprintf($sql,$_POST["treuhNR"]));
90
			$_POST["treuhID"]=$rs[0][0];
91
			$_POST["treuhTAX"]=$erptax[$rs[0][2]]["rate"];
92
			$treuhtxt=$rs[0][1];
93
			$rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'");
94
			$_POST["ERPusrID"]=$rs[0][0];
95
		}
96
		if ($_POST["SHOPpass"]) {
97
			$dsnM="mysql://".$_POST["SHOPuser"].":".$_POST["SHOPpass"]."@".$_POST["SHOPhost"]."/".$_POST["SHOPdbname"];
98
		} else {
99
			$dsnM="mysql://".$_POST["SHOPuser"]."@".$_POST["SHOPhost"]."/".$_POST["SHOPdbname"];
100
		}
101
		$dbM=@DB::connect($dsnM);
102
		if (DB::isError($dbM)||!$dbM) {
103
			$ok=false;
104
			echo "Keine Verbindung zum Shop<br>";
105
			echo $dbM->userinfo."<br>";
106
		};
107
		if ($ok) {
108
			$f=fopen("conf$login.php","w");
109
			$v="1.6";
110
			$d=date("Y/m/d H:i:s");
111
			fputs($f,"<?\n// Verbindung zur ERP-db\n");
112
			fputs($f,"\$ERPuser=\"".$_POST["ERPuser"]."\";\n");
113
			fputs($f,"\$ERPpass=\"".$_POST["ERPpass"]."\";\n");
114
			fputs($f,"\$ERPhost=\"".$_POST["ERPhost"]."\";\n");
115
			fputs($f,"\$ERPdbname=\"".$_POST["ERPdbname"]."\";\n");
116
			fputs($f,"\$ERPdns=\"pgsql://\$ERPuser:\$ERPpass@\$ERPhost/\$ERPdbname\";\n");
117
			fputs($f,"\$ERPusr[\"Name\"]=\"".$_POST["ERPusrN"]."\";\n");
118
			fputs($f,"\$ERPusr[\"ID\"]=\"".$_POST["ERPusrID"]."\";\n");
119
			fputs($f,"\$ERPdir=\"".$_POST["ERPdir"]."\";\n");
120
			fputs($f,"\$ERPimgdir=\"".$_POST["ERPimgdir"]."\";\n");
121
			fputs($f,"\$maxSize=\"".$_POST["maxSize"]."\";\n");
122
			fputs($f,"\$ERPftphost=\"".$_POST["ERPftphost"]."\";\n");
123
			fputs($f,"\$ERPftpuser=\"".$_POST["ERPftpuser"]."\";\n");
124
			fputs($f,"\$ERPftppwd=\"".$_POST["ERPftppwd"]."\";\n");
125
			fputs($f,"//Verbindung zur osCommerce-db\n");
126
			fputs($f,"\$SHOPuser=\"".$_POST["SHOPuser"]."\";\n");
127
			fputs($f,"\$SHOPpass=\"".$_POST["SHOPpass"]."\";\n");
128
			fputs($f,"\$SHOPhost=\"".$_POST["SHOPhost"]."\";\n");
129
			fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n");
130
			fputs($f,"\$SHOPlang=\"".$_POST["SHOPlang"]."\";\n");
131
			fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n");
132
			fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n");
133
			fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n");
134
			fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n");
135
			fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n");
136
			fputs($f,"\$SHOPftppwd=\"".$_POST["SHOPftppwd"]."\";\n");
137
			fputs($f,"\$div16[\"ID\"]=\"".$_POST["div16ID"]."\";\n");
138
			fputs($f,"\$div07[\"ID\"]=\"".$_POST["div07ID"]."\";\n");
139
			fputs($f,"\$versand[\"ID\"]=\"".$_POST["versandID"]."\";\n");
140
			fputs($f,"\$nachn[\"ID\"]=\"".$_POST["nachnID"]."\";\n");
141
			fputs($f,"\$minder[\"ID\"]=\"".$_POST["minderID"]."\";\n");
142
			fputs($f,"\$treuh[\"ID\"]=\"".$_POST["treuhID"]."\";\n");
143
			fputs($f,"\$paypal[\"ID\"]=\"".$_POST["paypalID"]."\";\n");
144
			fputs($f,"\$div16[\"NR\"]=\"".$_POST["div16NR"]."\";\n");
145
			fputs($f,"\$div07[\"NR\"]=\"".$_POST["div07NR"]."\";\n");
146
			fputs($f,"\$versand[\"NR\"]=\"".$_POST["versandNR"]."\";\n");
147
			fputs($f,"\$nachn[\"NR\"]=\"".$_POST["nachnNR"]."\";\n");
148
			fputs($f,"\$minder[\"NR\"]=\"".$_POST["minderNR"]."\";\n");
149
			fputs($f,"\$treuh[\"NR\"]=\"".$_POST["treuhNR"]."\";\n");
150
			fputs($f,"\$paypal[\"NR\"]=\"".$_POST["paypalNR"]."\";\n");
151
			fputs($f,"\$div16[\"TAX\"]=\"".$_POST["div16TAX"]."\";\n");
152
			fputs($f,"\$div07[\"TAX\"]=\"".$_POST["div07TAX"]."\";\n");
153
			fputs($f,"\$versand[\"TAX\"]=\"".$_POST["versandTAX"]."\";\n");
154
			fputs($f,"\$nachn[\"TAX\"]=\"".$_POST["nachnTAX"]."\";\n");
155
			fputs($f,"\$minder[\"TAX\"]=\"".$_POST["minderTAX"]."\";\n");
156
			fputs($f,"\$treuh[\"TAX\"]=\"".$_POST["treuhTAX"]."\";\n");
157
			fputs($f,"\$paypal[\"TAX\"]=\"".$_POST["paypalTAX"]."\";\n");
158
			fputs($f,"\$div16[\"TXT\"]=\"".$div16txt."\";\n");
159
			fputs($f,"\$div07[\"TXT\"]=\"".$div07txt."\";\n");
160
			fputs($f,"\$versand[\"TXT\"]=\"".$versandtxt."\";\n");
161
			fputs($f,"\$nachn[\"TXT\"]=\"".$nachntxt."\";\n");
162
			fputs($f,"\$minder[\"TXT\"]=\"".$mindertxt."\";\n");
163
			fputs($f,"\$treuh[\"TXT\"]=\"".$treuhtxt."\";\n");
164
			fputs($f,"\$paypal[\"TXT\"]=\"".$paypaltxt."\";\n");
165
			fputs($f,"\$pricegroup=\"".$_POST["pricegroup"]."\";\n");
166
			fputs($f,"\$bgcol[1]=\"#ddddff\";\n");
167
			fputs($f,"\$bgcol[2]=\"#ddffdd\";\n");
168
			fputs($f,"\$preA=\"".$_POST["preA"]."\";\n");
169
			fputs($f,"\$preK=\"".$_POST["preK"]."\";\n");
170
			fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n");
171
			fputs($f,"\$debug=".$_POST["debug"].";\n");
172
			fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n");
173
			fputs($f,"\$stdprice=\"".$_POST["stdprice"]."\";\n");
174
			fputs($f,"\$nopic=\"".$_POST["nopic"]."\";\n");
175
			fputs($f,"\$showErr=\"true\";\n");
176
			fputs($f,"?>");
177
			fclose($f);
178
			if (file_exists ("conf$login.php")) {
179
			        require "conf$login.php";
180
			} else {
181
			        require "conf.php";
182
			}
183
			$sql="select count(*) from customers_number";
184
			$rc=@$dbM->query($sql);
185
			if ($rc->code==-18) {
186
				$sql="CREATE TABLE customers_number ( cid int(6) NOT NULL auto_increment,  customers_id int NOT NULL default '0', ";
187
				$sql.="kdnr int NOT NULL default '0', shipto int, PRIMARY KEY  (cid)) TYPE=MyISAM";
188
				$rc=@$dbM->query($sql);
189
				if ($rc->code==-1) {
190
					echo "Fehler beim Erzeugen der Tabelle 'customers_number' in der Shop-db";
191
				} else {
192
					echo "Tabelle 'customers_number' in der Shop-db angelegt.";
193
				}
194
			} else {
195
				$sql="select shipto from customers_number limit 1";
196
				$rc=@$dbM->query($sql);
197
				if ($rc->code==-19) {
198
					$sql="alter table customers_number add column shipto int";
199
					$rc=@$dbM->query($sql);
200
                                	if ($rc->code==-1) {
201
						echo "Fehler beim Anlegen der Spalte 'shipto' in 'customers_number'";
202
					} else {
203
						echo "'shipto' in 'customers_number' angelegt.";
204
					}
205
				}
206
			}
207
		} else {
208
			$ERPuser=$_POST["ERPuser"];
209
			$ERPpass=$_POST["ERPpass"];
210
			$ERPhost=$_POST["ERPhost"];
211
			$ERPdbname=$_POST["ERPdbname"];
212
			$ERPusrN=$_POST["ERPusrN"];
213
			$ERPdir=$_POST["ERPdir"];
214
			$ERPimgdir=$_POST["ERPimgdir"];
215
			$maxSize=$_POST["maxSize"];
216
			$ERPftphost=$_POST["ERPftphost"];
217
			$ERPftpuser=$_POST["ERPftpuser"];
218
			$ERPftppwd=$_POST["ERPftppwd"];
219
			$SHOPuser=$_POST["SHOPuser"];
220
			$SHOPpass=$_POST["SHOPpass"];
221
			$SHOPhost=$_POST["SHOPhost"];
222
			$SHOPdbname=$_POST["SHOPdbname"];
223
			$SHOPlang=$_POST["SHOPlang"];
224
			$SHOPdir=$_POST["SHOPdir"];
225
			$SHOPimgdir=$_POST["SHOPimgdir"];
226
			$SHOPftphost=$_POST["SHOPftphost"];
227
			$SHOPftpuser=$_POST["SHOPftpuser"];
228
			$SHOPftppwd=$_POST["SHOPftppwd"];
229
			$div16NR=$_POST["div16NR"];
230
			$div07NR=$_POST["div07NR"];
231
			$versandNR=$_POST["versandNR"];
232
			$nachnNR=$_POST["nachnNR"];
233
			$treuhNR=$_POST["treuhNR"];
234
			$minderNR=$_POST["minderNR"];
235
			$paypalNR=$_POST["paypalNR"];
236
			$pricegroup=$_POST["pricegroup"];
237
			$preA=$_POST["preA"];
238
			$preK=$_POST["preK"];
239
			$kdnum=$_POST["kdnum"];
240
			$auftrnr=$_POST["auftrnr"];
241
			$debug=$_POST["debug"];
242
			$stdprice=$_POST["stdprice"];
243
			$nopic=$_POST["nopic"];
244
		}
245
	}	else {
246
		if (file_exists ("conf$login.php")) {
247
			require "conf$login.php";
248
		} else {
249
			require "conf.php";
250
		}
251
	}
252
?>
253
<html>
254
<body>
255
<center>
256
<table style="background-color:#cccccc">
257
<form name="ConfEdit" method="post" action="confedit.php">
258
<input type="hidden" name="div16ID" value="<?= $div16["ID"] ?>">
259
<input type="hidden" name="div07ID" value="<?= $div07["ID"] ?>">
260
<input type="hidden" name="minderID" value="<?= $minder["ID"] ?>">
261
<input type="hidden" name="versandID" value="<?= $versand["ID"] ?>">
262
<input type="hidden" name="nachnID" value="<?= $nachn["ID"] ?>">
263
<input type="hidden" name="paypalID" value="<?= $paypal["ID"] ?>">
264
<input type="hidden" name="treuhID" value="<?= $treuh["ID"] ?>">
265
<input type="hidden" name="ERPusrID" value="<?= $ERPusr["ID"] ?>">
266
<input type="hidden" name="login" value="<?= $login ?>">
267
<tr><th>Daten</th><th>Lx-ERP</th><th></th><th>Shop</th></tr>
268
<tr>
269
	<td>db-Host</td>
270
	<td colspan="2"><input type="text" name="ERPhost" size="25" value="<?= $ERPhost ?>"></td>
271
	<td><input type="text" name="SHOPhost" size="25" value="<?= $SHOPhost ?>"></td>
272
</tr>
273
<tr>
274
	<td>Database</td>
275
	<td colspan="2"><input type="text" name="ERPdbname" size="20" value="<?= $ERPdbname ?>"></td>
276
	<td><input type="text" name="SHOPdbname" size="20" value="<?= $SHOPdbname ?>"></td>
277
</tr>
278
<tr>
279
	<td>db-User Name</td>
280
	<td colspan="2"><input type="text" name="ERPuser" size="15" value="<?= $ERPuser ?>"></td>
281
	<td><input type="text" name="SHOPuser" size="15" value="<?= $SHOPuser ?>"></td>
282
</tr>
283
<tr>
284
	<td>db-User PWD</td>
285
	<td colspan="2"><input type="text" name="ERPpass" size="15" value="<?= $ERPpass ?>"></td>
286
	<td><input type="text" name="SHOPpass" size="15" value="<?= $SHOPpass ?>"></td>
287
</tr>
288
<tr>
289
	<td>User-ID</td>
290
	<td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>">
291
		<input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?> onFocus="blur();"></td>
292
	<td></td>
293
</tr>
294
<tr>
295
	<td>CSV-Dir</td>
296
	<td colspan="2"><input type="text" name="ERPdir" size="30" value="<?= $ERPdir ?>"></td>
297
	<td><input type="text" name="SHOPdir" size="30" value="<?= $SHOPdir ?>"></td>
298
</tr>
299
<tr>
300
	<td>Image-Dir</td>
301
	<td colspan="2"><input type="text" name="ERPimgdir" size="30" value="<?= $ERPimgdir ?>"></td>
302
	<td><input type="text" name="SHOPimgdir" size="30" value="<?= $SHOPimgdir ?>"></td>
303
</tr>
304
<tr>
305
	<td>FTP-Host</td>
306
	<td colspan="2"><input type="text" name="ERPftphost" size="20" value="<?= $ERPftphost ?>"></td>
307
	<td><input type="text" name="SHOPftphost" size="20" value="<?= $SHOPftphost ?>"></td>
308
</tr>
309
<tr>
310
	<td>FTP-User</td>
311
	<td colspan="2"><input type="text" name="ERPftpuser" size="15" value="<?= $ERPftpuser ?>"></td>
312
	<td><input type="text" name="SHOPftpuser" size="15" value="<?= $SHOPftpuser ?>"></td>
313
</tr>
314
<tr>
315
	<td>FTP-User PWD</td>
316
	<td colspan="2"><input type="text" name="ERPftppwd" size="15" value="<?= $ERPftppwd ?>"></td>
317
	<td><input type="text" name="SHOPftppwd" size="15" value="<?= $SHOPftppwd ?>"></td>
318
</tr>
319
<tr>
320
	<td>ID Diverse 19%</td>
321
	<td><input type="text" name="div16NR" size="10" value="<?= $div16["NR"] ?>">
322
		<input type="checkbox" name="a1" <?= (empty($div16["ID"])?"":"checked") ?>></td>
323
	<td>ID Diverse 7%</td>
324
	<td><input type="text" name="div07NR" size="10" value="<?= $div07["NR"] ?>">
325
		<input type="checkbox" name="a1" <?= (empty($div07["ID"])?"":"checked") ?>></td>
326
</tr>
327
<tr>
328
	<td>ID Versand</td>
329
	<td><input type="text" name="versandNR" size="10" value="<?= $versand["NR"] ?>">
330
		<input type="checkbox" name="a1" <?= (empty($versand["ID"])?"":"checked") ?>></td>
331
	<td>ID Nachname</td>
332
	<td><input type="text" name="nachnNR" size="10" value="<?= $nachn["NR"] ?>">
333
		<input type="checkbox" name="a1" <?= (empty($nachn["ID"])?"":"checked") ?>></td>
334
</tr>
335
<tr>
336
	<td>ID Paypal</td>
337
	<td><input type="text" name="paypalNR" size="10" value="<?= $paypal["NR"] ?>">
338
		<input type="checkbox" name="a1" <?= (empty($paypal["ID"])?"":"checked") ?>></td>
339
	<td>ID Treuhand</td>
340
	<td><input type="text" name="treuhNR" size="10" value="<?= $treuh["NR"] ?>">
341
		<input type="checkbox" name="a1" <?= (empty($treuh["ID"])?"":"checked") ?>></td>
342
</tr>
343
<tr>
344
	<td>ID Mindemenge</td>
345
	<td><input type="text" name="minderNR" size="10" value="<?= $minder["NR"] ?>">
346
		<input type="checkbox" name="a1" <?= (empty($minder["ID"])?"":"checked") ?>></td>
347
	<td></td>
348
	<td></td>
349
</tr>
350
<tr>
351
	<td colspan="2">Abweichende Shopsprache</td>
352
	<td colspan="2"><input type="text" name="SHOPlang" size="5" value="<?= $SHOPlang ?>"> leer = Default</td>
353
</tr>
354
<tr>
355
	<td>Preisgruppe</td>
356
	<td><select name="pricegroup">
357
<? pg($pricegroup); ?>
358
	    </select></td>
359
	<td>Defaultbild</td>
360
	<td><input type="text" name="nopic" size="20" value="<?= $nopic ?>">
361
</tr>
362
<tr>
363
	<td colspan="2">Auftragsnummern durch</td>
364
	<td><input type="radio" name="auftrnr" value="1" <?= ($auftrnr==1)?"checked":"" ?>> LxO</td>
365
	<td><input type="radio" name="auftrnr" value="0" <?= ($auftrnr<>1)?"checked":"" ?>> Shop</td>
366
</tr>
367
<tr>
368
	<td colspan="2">Kundennummern durch</td>
369
	<td><input type="radio" name="kdnum" value="1" <?= ($kdnum==1)?"checked":"" ?>> LxO</td>
370
	<td><input type="radio" name="kdnum" value="0" <?= ($kdnum<>1)?"checked":"" ?>> Shop</td>
371
</tr>
372
<tr>
373
	<td colspan="2">Nummernerweiterung</td>
374
	<td>Auftrag<input type="text" name="preA" size="5" value="<?= $preA ?>"></td>
375
	<td>Kunde<input type="text" name="preK" size="5" value="<?= $preK ?>"></td>
376
</tr>
377
<tr>
378
	<td>Logging</td>
379
	<td>ein<input type="radio" name="debug" value="true" <?= ($debug=="true")?"checked":"" ?>>
380
	aus<input type="radio" name="debug" value="false" <?= ($debug!="true")?"checked":"" ?>></td>
381
	<td></td><td></td>
382
</tr>
383
<tr><td colspan="4" align="center"><input type="submit" name="ok" value="sichern"></td></tr>
384
</form>
385
</table>
386
</center>
387
</body>
388
</html>
389
<? } ?>
oscom/confhli.php
1
<?
2
// Verbindung zur ERP-db
3
$ERPuser="lxoffice";
4
$ERPpass="geheim";
5
$ERPhost="localhost";
6
$ERPdbname="stable";
7
$ERPdns="pgsql://$ERPuser:$ERPpass@$ERPhost/$ERPdbname";
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="oscom";
15
$ERPftppwd="oscom";
16
//Verbindung zur osCommerce-db
17
$SHOPuser="root";
18
$SHOPpass="db4web";
19
$SHOPhost="localhost";
20
$SHOPdbname="oscom";
21
$SHOPlang="";
22
$SHOPdns="mysql://$SHOPuser:$SHOPpass@$SHOPhost/$SHOPdbname";
23
$SHOPdir="tmp/shopartikel.csv";
24
$SHOPimgdir="/var/www/oscommerce/images";
25
$SHOPftphost="localhost";
26
$SHOPftpuser="oscom";
27
$SHOPftppwd="oscom";
28
$div16["ID"]="413";
29
$div07["ID"]="";
30
$versand["ID"]="413";
31
$nachn["ID"]="";
32
$minder["ID"]="";
33
$treuh["ID"]="";
34
$paypal["ID"]="";
35
$div16["NR"]="div16";
36
$div07["NR"]="";
37
$versand["NR"]="div16";
38
$nachn["NR"]="";
39
$minder["NR"]="";
40
$treuh["NR"]="";
41
$paypal["NR"]="";
42
$div16["TAX"]="19.0000";
43
$div07["TAX"]="";
44
$versand["TAX"]="19.0000";
45
$nachn["TAX"]="";
46
$minder["TAX"]="";
47
$treuh["TAX"]="";
48
$paypal["TAX"]="";
49
$div16["TXT"]="Diverse Artikel 16% MWSt.";
50
$div07["TXT"]="";
51
$versand["TXT"]="Diverse Artikel 16% MWSt.";
52
$nachn["TXT"]="";
53
$minder["TXT"]="";
54
$treuh["TXT"]="";
55
$paypal["TXT"]="";
56
$pricegroup="0";
57
$bgcol[1]="#ddddff";
58
$bgcol[2]="#ddffdd";
59
$preA="";
60
$preK="";
61
$auftrnr="1";
62
$debug=true;
63
$kdnum="1";
64
$stdprice="";
65
$nopic="";
66
$showErr="true";
67
?>
oscom/diff.php
1
<?
2
// $Id: diff.php,v 1.1 2004/06/30 10:12:15 hli Exp $
3
if ($_POST["ok"]) {
4
	require_once "shoplib.php";
5
	foreach($_POST as $key=>$val) {
6
		if ($key=="ok") continue;
7
		if ($key=="alle") continue;
8
		$sql="update products set products_status=0 where products_model='$key'";
9
		//echo "$key $sql";
10
		echo "$key ";
11
		if (query("shop",$sql,"diff")) { echo "deaktiviert<br>"; }
12
		else { echo "konnte nicht deaktiviert werden<br>"; };
13
	}
14
} else {
15
$sql="select partnumber from parts where shop='1' order by partnumber";
16
$erp=getAll("erp",$sql,"getPartnumber");
17
if ($SHOPlang>0) {
18
	$defLang=$SHOPlang;
19
} else {
20
	$sql="select * from languages L left join configuration C on L.code=C.configuration_value where  configuration_key = 'DEFAULT_LANGUAGE'";
21
	$rs=getAll("shop",$sql,"getLanguage");
22
	if ($rs) {
23
		$defLang=$rs[0]["languages_id"];
24
	} else {
25
		$defLang=1;
26
	}
27
}
28
if ($erp) foreach ($erp as $zeile) { $arE[]=$zeile["partnumber"]; };
29
$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";
30
$shop=getAll("shop",$sql,"products_model");
31
if ($shop) foreach ($shop as $zeile) {
32
	$arS[]=$zeile["products_model"];
33
	$arID[$zeile["products_model"]]=array("id"=>$zeile["products_id"],"name"=>$zeile["products_name"]);
34
}
35

  
36
$result=@array_diff($arS,$arE);
37
if ($result) {
38
?>
39
<html>
40
<head><title>Artikelpflege</title>
41
<script language="JavaScript">
42
<!--
43
	function sel() {
44
		val=document.doppel.alle.checked;
45
		cnt=document.doppel.length;
46
		for (i=0; i<cnt; i++) {
47
			document.doppel.elements[i].checked=val;
48
		}
49
	}
50
//-->
51
</script>
52
</head>
53
<body>
54
Folgende Artikel sind in der ERP nicht mehr als Shopartikel markiert.<br>
55
Markieren Sie die Artikel, die deaktiviert werden sollen.<br>
56
<form name='doppel' method='post' action='diff.php?login=<?= $login ?>'>
57
<table>
58
<?
59
foreach ($result as $data) {
60
	echo "\t<tr><td><input type='checkbox' name='".$data."' value='1'></td><td>".$data."</td><td>".$arID[$data]["name"]."</td></tr>\n";
61
}
62
?>
63
	<tr><td><input type='checkbox' name='alle' value='1' onClick="sel()"></td><td></td><td>alle Artikel</td></tr>
64
	<tr><td colspan='3'><input type='submit' name='ok' value='ok'></td></tr>
65
</table>
66
<form>
67
<? }
68
	else { echo "Artikelbestand identisch"; };
69
} ?>
70
<!-- a href="trans.php">zur&uuml;ck</a -->
oscom/erpexport.php
1
<?
2
/***************************************************************
3
* $Id: erpexport.php,v 1.1 2006/02/06 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.1
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 oscomm() {
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="oscomm";
31
		}
32
	//-->
33
	</script>
34
<body>
35

  
36
<?php
37
$login=$_GET["login"];
38
require_once "DB.php";
39
require_once "conf$login.php";
40
$db=DB::connect($ERPdns);
41
if (!$db) dbFehler("",$db->getDebugInfo());
42
if (DB::isError($db)) {
43
	dbFehler("",$db->getDebugInfo());
44
	die ($db->getDebugInfo());
45
};
46
/****************************************************
47
* dbFehler
48
* in: sql,err = string
49
* out:
50
* Fehlermeldungen ausgeben
51
*****************************************************/
52
function dbFehler($sql,$err) {
53
global $showErr;
54
	if ($showErr)
55
		echo "</td></tr></table><font color='red'>$sql : $err</font><br>";
56
}
57

  
58
function shopartikel_() {
59
global $db;
60
	$sql ="SELECT P.partnumber,P.description,P.unit,P.weight,t.rate,P.sellprice,P.listprice,P.priceupdate,PG.partsgroup,P.notes,P.image,P.onhand FROM ";
61
	$sql.="parts P left join partsgroup PG on  PG.id=P.partsgroup_id ";
62
	$sql.="left join chart c on c.id = P.income_accno_id ";
63
	$sql.="left join tax T on T.taxkey=C.taxkey_id ";
64
	$sql.="where shop = 't'";
65
	$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC);
66
	return $rs;
67
}
68
function shopartikel() {
69
global $db,$pricegroup;
70
	if ($pricegroup>0) {
71
		$sql="SELECT P.partnumber,P.description,G.price as sellprice,P.sellprice as stdprice, ";
72
		$sql.="PG.partsgroup,P.notes,P.image,P.onhand,G.pricegroup_id,P.buchungsgruppen_id as bugru FROM ";
73
		$sql.="parts P left join partsgroup PG on ";
74
		$sql.="PG.id=P.partsgroup_id left join prices G on G.parts_id=P.id ";
75
		$sql.="where P.shop='t' and ";
76
		$sql.="(G.pricegroup_id=$pricegroup or G.pricegroup_id is null) ";
77
		$sql.="order by P.partnumber";
78
	} else {
79
		$sql="SELECT P.partnumber,P.description,P.weight,P.sellprice,PG.partsgroup,";
80
		$sql.="P.notes,P.image,P.onhand,P.buchungsgruppen_id as bugru ";
81
		$sql.="FROM parts P left join partsgroup PG on PG.id=P.partsgroup_id ";
82
		$sql.="left join buchungsgruppen B on P.buchungsgruppen_id = B.id ";
83
		$sql.="WHERE P.shop='t'";
84
	}
85
	$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC);
86
	return $rs;
87
}
88
if ($_POST["export"]) {
89
	$data=shopartikel();
90
	$delim=($_POST["deli"])?$_POST["deli"]:",";
91
	if (get_magic_quotes_gpc()) {
92
		$crln = stripslashes($_POST["crln"]);
93
	}
94
	//Steuertabelle ERP
95
	$sql ="select  BG.id as bugru,T.rate,TK.startdate from buchungsgruppen BG left join chart C ";
96
	$sql.="on BG.income_accno_id_0=C.id left join taxkeys TK on TK.chart_id=C.id left join tax T ";
97
	$sql.="on T.id=TK.tax_id where TK.startdate <= now()";
98
	$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC);
99
	$erptax=array();
100
	foreach ($rs as $row) {
101
        if ($erptax[$row["bugru"]]["startdate"]<$row["startdate"]) {
102
                $erptax[$row["bugru"]]["startdate"]=$row["startdate"];
103
                $erptax[$row["bugru"]]["rate"]=$row["rate"]*100;
104
        }
105
	}
106
	$crln = str_replace('\\r', "\015", $crln);
107
	$crln = str_replace('\\n', "\012", $crln);
108
	$crln = str_replace('\\t', "\011", $crln);
109
	$encl=$_POST["encl"];
110
	$i=0;
111
	$f=fopen($ERPdir,"w");
112
	if ($_POST["partnumber"])	{$header.=$_POST["PN"].$delim; };
113
	if ($_POST["desctiption"])	{$header.=$_POST["BEZ"].$delim; };
114
	if ($_POST["unit"])			{$header.=$_POST["EINHEIT"].$delim; };
115
	if ($_POST["weight"])		{$header.=$_POST["GEWICHT"].$delim; };
116
	if ($_POST["onhand"])		{$header.=$_POST["LAGER"].$delim; };
117
	if ($_POST["rate"])			{$header.=$_POST["MWST"].$delim; };
118
	if ($_POST["sellprice"])	{$header.=$_POST["VK"].$delim; };
119
	if ($_POST["listprice"])	{$header.=$_POST["EK"].$delim; };
120
	if ($_POST["priceupdate"])	{$header.=$_POST["PDATE"].$delim; };
121
	if ($_POST["partsgroup"])	{$header.=$_POST["PG"].$delim; };
122
	if ($_POST["notes"])		{$header.=$_POST["BESCHR"].$delim; };
123
	if ($_POST["image"])		{$header.=$_POST["IMAGE"].$delim; };
124
	$header=substr($header,0,-1);
125
?>
126
<table class="liste">
127
<!-- BEGIN Artikel -->
128
<?	$i=0;
129
	$f=fopen($ERPdir,"w");
130
	if ($_POST["head"]) fputs($f,$header.$crln);
131
	foreach($data as $zeile) {
132
		$file=""; $html="";
133
		$PG=$zeile["partsgroup"];
134
		$mwst=sprintf("%01.4f",$erptax[$zeile["bugru"]]["rate"]);
135
		$LineCol = $bgcol[$i%2+1];
136
		if ($_POST["partnumber"])	{$file.=$encl.$zeile["partnumber"].$encl.$delim; $html.="<td>".$zeile["partnumber"]."</td>";};
137
		if ($_POST["desctiption"])	{$file.=$encl.strtr($zeile["description"],chr(13).chr(10),"  ").$encl.$delim; $html.="<td>".$zeile["description"]."</td>";};
138
		if ($_POST["unit"])			{$file.=$encl.$zeile["unit"].$encl.$delim; $html.="<td>".$zeile["unit"]."</td>";};
139
		if ($_POST["weight"])		{$file.=$encl.$zeile["weight"].$encl.$delim; $html.="<td>".$zeile["weight"]."</td>";};
140
		if ($_POST["onhand"])		{$file.=$encl.$zeile["onhand"].$encl.$delim; $html.="<td>".$zeile["onhand"]."</td>";};
141
		if ($_POST["rate"])			{$file.=$encl.$mwst.$encl.$delim; $html.="<td>".$mwst."</td>";};
142
		if ($_POST["sellprice"])	{$file.=$encl.(sprintf("%02.2f",$zeile["sellprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["sellprice"]))."</td>";};
143
		if ($_POST["listprice"])	{$file.=$encl.(sprintf("%02.2f",$zeile["listprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["listprice"]))."</td>";};
144
		if ($_POST["priceupdate"])	{$file.=$encl.$zeile["priceupdate"].$encl.$delim; $html.="<td>".$zeile["priceupdate"]."</td>";};
145
		if ($_POST["partsgroup"])	{$file.=$encl.$PG.$encl.$delim; $html.="<td>".$zeile["partsgroup"]."</td>";};
146
		if ($_POST["notes"])		{$file.=$encl.strtr($zeile["notes"],chr(13).chr(10),"  ").$encl.$delim; $html.="<td>".$zeile["notes"]."</td>";};
147
		if ($_POST["image"])		{$file.=$encl.$zeile["image"].$encl.$delim; $html.="<td>".$zeile["image"]."</td>";};
148
		$i++;
149
		fputs($f,substr($file,0,-1).$crln);
150
		if ($_POST["show"]) {
151
?>
152
	<tr  class="smal" onMouseover="this.bgColor='#FF0000';" onMouseout="this.bgColor='<?= $LineCol ?>';" bgcolor="<?= $LineCol ?>">
153
		<?= $html ?>
154
	</tr>
155
<? 		}
156
	}
157
?>
158
<!-- END Artikel -->
159
</table>
160
Anzahl der Artikel: <?= $i ?><br>
161
Export am : <?= date("d.m.Y : H:i") ?><br>
162
download <a href="tmp/shopartikel.csv">Exportfile</a><br><hr>
163
<?
164
	fclose($f);
165
} // if ($export)
166
?>
167
Export der Shopartikel aus Lx-ERP <br>
168
M&ouml;gliche Felder
169
<form name="fld" action="erpexport.php" method="post">
170
<input type="hidden" name="shop" value="">
171
<table>
172
	<tr>
173
		<td><input type="checkbox" name="partnumber" value="1">Artikelnummer</td>
174
		<td><input type="checkbox" name="desctiption" value="1">Bezeichnung</td>
175
		<td><input type="checkbox" name="unit" value="1">Einheit</td>
176
		<td><input type="checkbox" name="weight" value="1">Gewicht</td>
177
	</tr>
178
	<tr>
179
		<td><input type="text" name="PN" size="23"></td>
180
		<td><input type="text" name="BEZ" size="23"></td>
181
		<td><input type="text" name="EINHEIT" size="23"></td>
182
		<td><input type="text" name="GEWICHT" size="23"></td>
183
	</tr>
184
	<tr><td colspan=5></td></tr>
185
	<tr>
186
		<td><input type="checkbox" name="sellprice" value="1">Verkaufspreis</td>
187
		<td><input type="checkbox" name="listprice" value="1">Listenpreis</td>
188
		<td><input type="checkbox" name="onhand" value="1">Lagerbestand</td>
189
		<td><input type="checkbox" name="rate" value="1">MwSt</td>
190
	</tr>
191
	<tr>
192
		<td><input type="text" name="VK" size="23"></td>
193
		<td><input type="text" name="EK" size="23"></td>
194
		<td><input type="text" name="LAGER" size="23"></td>
195
		<td><input type="text" name="MWST" size="23"></td>
196
	</tr>
197
	<tr><td colspan=5></td></tr>
198
	<tr>
199
		<td><input type="checkbox" name="partsgroup" value="1">Gruppe</td>
200
		<td><input type="checkbox" name="notes" value="1">Beschreibung</td>
201
		<td><input type="checkbox" name="image" value="1">Bild</td>
202
		<td><input type="checkbox" name="show" value="1" checked>HTML-Anzeige</td>
203
	</tr>
204
	<tr>
205
		<td><input type="text" name="PG" size="23"></td>
206
		<td><input type="text" name="BESCHR" size="23"></td>
207
		<td><input type="text" name="IMAGE" size="23"></td>
208
		<td></td>
209
	</tr>
210
	<tr>
211
		<td>Feldtrenner <input type="text" name="deli" size="2" value=","></td>
212
		<td>Feldumrahmung <input type="text" name="encl" size="2" value="&quot;"></td>
213
		<td>Zeilenende <input type="text" name="crln" size="2" value="\n"></td>
214
		<td><input type="checkbox" name="head" value="1" checked>Headline</td>
215
	</tr>
216
	<tr>
217
		<td colspan=5><input type="submit" name="export" value="Export"> <input type="button" name="osc" value="osCommerce" onClick="oscomm()"></td>
218
	</tr>
219
</table>
220
<a href="trans.php">zur&uuml;ck</a>
221
</form>
222
</body>
223
</html>
oscom/menu.ini
1

  
2
[osCom]
3

  
4
[osCom--Warenexport]
5
module=oscom/shopimport_db.php
6

  
7
[osCom--Bestellungen]
8
module=oscom/oscomexport.php
9

  
10
[osCom--Konfiguration]
11
module=oscom/confedit.php
12

  
oscom/oscom.sql
1
# $Id: oscom.sql,v 1.2 2004/07/01 20:50:34 hli Exp $
2
# Zusatztabelle Kundenbeziehung ERP - osCommerce
3
#
4
CREATE TABLE customers_number (
5
  cid int(6) NOT NULL auto_increment,
6
  customers_id int(3) NOT NULL default '0',
7
  kdnr int(3) NOT NULL default '0',
8
  PRIMARY KEY  (cid)
9
) TYPE=MyISAM;
oscom/oscomexport.php
1
<?
2
/***************************************************************
3
*Author: Holger Lindemann
4
*Copyright: (c) 2004 Lx-System
5
*License: non free
6
*eMail: info@lx-system.de
7
*Version: 1.6
8
*Shop: osCommerce 2.2 ms2
9
*ERP: Lx-Office ERP 2.4.x
10
***************************************************************/
11
/*
12
* Noch einzubauen:
13
*/
14
?>
15
<html>
16
	<head><title>Lx-ERP Export der Shopartikel</title>
17
	<!--link type="text/css" REL="stylesheet" HREF="../css/main.css"></link-->
18
<body>
19

  
20
<?php
21
require_once "shoplib.php";
22

  
23
function sonderkosten($transID,$data,$id,$f) {
24
global $versand,$nachn,$minder,$treuh,$paypal;
25
	$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values (";
26
	$sql.=$transID.",".${$id}["ID"].",'".${$id}["TXT"]."',1,".$data.",'mal',0,0)";
27
	fputs($f,"$transID,".${$id}["ID"].",'".${$id}["TXT"]."',1,$data\n");
28
	if (!query("erp",$sql,"sonderkosten")) { return false; }
29
	else { return true; };
30
}
31

  
32
function getBestellKunde($KID,$BID,$OID) {
33
global $neuKd,$gesKd;
34
	$sql="select kdnr from customers_number where customers_id=$KID";
35
	$rs=getAll("shop",$sql,"getBestellKunde");
36
	if (!$rs or $rs[0]["kdnr"]<1) {
37
		$kdnr=insKdData($BID);
38
		if ($kdnr>0) {
39
			$sql="insert into customers_number (customers_id,kdnr) values(".$KID.",".$kdnr.")";
40
			$rc=query("shop",$sql,"getBestellKunde");
41
			if ($rc === -99) {
42
				echo "Kundennummer nicht im Shop gespeichert: $KID<br>";
43
			}
44
		} else {
45
			$neuKd++;
46
		}
47
	} else {
48
		$kdnr=$rs[0]["kdnr"];
49
	}
50
	chkKdData($kdnr,$BID,$OID);
51
	$gesKd++;
52
	return $kdnr;
53
}
54
/**********************************************
55
* getAttribut($oid,$pid)
56
*
57
**********************************************/
58
function getAttribut($oid,$pid) {
59
	$sql="select * from orders_products_attributes where orders_id=$oid and orders_products_id=$pid";
60
	$rs=getAll("shop",$sql,"getAttribut");
61
	$txt="";
62
	foreach ($rs as $zeile) {
63
		$txt.="\n - ".$zeile["products_options"].":".$zeile["products_options_values"];
64
	};
65
	return $txt;
66
}
67
function getTaxRate() {
68
	$sql="select tax_rate from tax_rates R left join configuration C on C.configuration_value=R.tax_class_id ";
69
	$sql.="where C.configuration_key like 'MODULE_SHIPPING%TAX%' limit 1";
70
	$rs=getAll("shop",$sql,"getTaxRate");
71
	if ($rs[0]["tax_rate"]) {
72
		return (100+$rs[0]["tax_rate"])/100 ;
73
	} else {
74
		echo "Bitte mind. eine Versandart mit Steuer anlegen.";
75
		return 1;
76
	}
77
}
78
function checkTaxIncl() {
79
	$sql="select * from configuration where  configuration_key = 'DISPLAY_PRICE_WITH_TAX'";
80
	$rs=getAll("shop",$sql,"checkTaxIncl");
81
	if ($rs[0]["configuration_value"]=="false") { return false; }
82
	else { return true; }
83
}
84
function getNetto($id) {
85
	$sql="select * from orders_total where orders_id=$id and class='ot_subtotal'";
86
	$rs=getAll("shop",$sql,"getNetto");
87
	return $rs[0]["value"];
88
}
89
/**********************************************
90
* getBrutto($id)
91
*
92
**********************************************/
93
function getBrutto($id) {
94
	$sql="select * from orders_total where orders_id=$id and class='ot_total'";
95
	$rs=getAll("shop",$sql,"getBrutto");
96
	return $rs[0]["value"];
97
}
98

  
99
/**********************************************
100
* getMwst($id)
101
*
102
**********************************************/
103
function getMwSt($id) {
104
global $TaxFactor;
105
	$mwst=0;
106
	$sql="select * from orders_total where orders_id=$id and class='ot_tax'";
107
	$rs=getAll("shop",$sql,"getMwSt");
108
	if ($rs) {
109
		foreach ($rs as $zeile) {
110
			$mwst+=$zeile["value"];
111
		}
112
	}
113
	return $mwst;
114
	//return $rs[0]["value"]/$TaxFactor;
115
}
116
/**********************************************
117
* getSonderkosten($id,$art)
118
*
119
**********************************************/
120
function getSonderkosten($id,$art) {
121
        $sql="select * from orders_total where orders_id=$id and class='".$GLOBALS["skosten"][$art]."'";
122
        $rs=getAll("shop",$sql,"getSonderkosten");
123
        if ($rs[0]["value"]) {
124
                $kosten=round($rs[0]["value"]/(100+$GLOBALS["versand"]["TAX"])*100,2);
125
        } else {
126
                $kosten=false;
127
        }
128
        return $kosten;
129
}
130
/**********************************************
131
* insBestArtikel($zeile,$transID)
132
*
133
**********************************************/
134
function insBestArtikel($ordersID,$transID) {
135
global $div07,$div16;
136
        $sql="select * from orders_products where orders_id=$ordersID";
137
        $rs=getAll("shop",$sql,"insBestArtikel");
138
        $ok=true;
139
        if ($rs) foreach ($rs as $zeile) {
140
        	$sql="select * from parts where partnumber='".$zeile["products_model"]."'";
141
                $rs2=getAll("erp",$sql,"insBestArtikel");
142
                if ( $rs2[0]["id"]) {
143
                		$artID=$rs2[0]["id"];
144
                		$artNr=$rs2[0]["partnumber"];
145
                } else {
146
                        if ($zeile["products_tax"]=="19.0000") {
147
                                $artID=$div16["ID"];
148
                                $artNr=$div16["NR"];
149
                        } else {
150
                                $artID=$div07["ID"];
151
                                $artNr=$div07["NR"];
152
                        };
153
                }
154
		$preis=$zeile["final_price"];
155
                $text=getAttribut($ordersID,$zeile["orders_products_id"]);
156
                $sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) ";
157
		$sql.="values (";
158
                $sql.=$transID.",".$artID.",'".$zeile["products_name"].$text."',".$zeile["products_quantity"].",";
159
		$sql.=$preis.",'Stck',0,0)";
160
                echo " - Artikel:[ BuNr.:$artID ArtNr:<b>$artNr</b> ".$zeile["products_name"]." ]<br>";
161
                $rc=query("erp",$sql,"insBestArtikel");
162
                if ($rc === -99) { $ok=false; break; };
163
        }
164
        return $ok;
165
}
166
function insAuftrag($data) {
167
global $ERPusr,$versand,$nachn,$minder,$paypal,$auftrnr;
168
        $Zahlmethode=array("authorizenet"=>"Authorize.net","banktransfer"=>"Lastschriftverfahren","cc"=>"Kreditkarte",
169
                "cod"=>"Nachnahme","eustandardtransfer"=>"EU-Standard Bank Transfer","iclear"=>"iclear Rechnungskauf",
170
                "invoice"=>"Rechnung","ipayment"=>"iPayment","liberecobanktransfer"=>"Lastschriftverfahren",
171
                "liberecocc"=>"Kreditkarte","moneybookers"=>"Moneybookers.com","moneyorder"=>"Scheck/Vorkasse",
172
                "nochex"=>"NOCHEX","paypal"=>"PayPal","pm2checkout"=>"2CheckOut","psigate"=>"PSiGate",
173
                "qenta"=>"qenta.at","secpay"=>"SECPay");
174
        $brutto=getBrutto($data["orders_id"]);
175
        $mwst=getMwSt($data["orders_id"]);
176
        if ($GLOBALS["inclTax"]) {
177
		$netto=$brutto-$mwst;
178
	} else {
179
		$netto=getNetto($data["orders_id"]);
180
	}
181
        $versandK=getSonderkosten($data["orders_id"],"Versand");
182
        $nachnK  =getSonderkosten($data["orders_id"],"NachName");
183
        $mindermK=getSonderkosten($data["orders_id"],"Minder");
184
        $paypalK =getSonderkosten($data["orders_id"],"Paypal");
185
	$netto+=$versandK;
186
	$netto+=$nachnK;
187
	$netto+=$mindermK;
188
	$netto+=$paypalK;
189
        // Hier beginnt die Transaktion
190
	$rc=query("erp","BEGIN WORK","insAuftrag");
191
	if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
192
        if ($auftrnr) {
193
                $auftrag=$GLOBALS["preA"].getNextAnr();
194
        } else {
195
                $auftrag=$GLOBALS["preA"].$data["orders_id"];
196
        }
197
        $sql="select count(*) as cnt from oe where ordnumber = '$auftrag'";
198
        $rs=getAll("erp",$sql,"insAuftrag 1");
199
        if ($rs[0]["cnt"]>0) {
200
                $auftrag=$GLOBALS["preA"].getNextAnr();
201
        }
202
        $newID=uniqid (rand());
203
        $sql="insert into oe (notes,ordnumber,cusordnumber) values ('$newID','$auftrag','".$data["kdnr"]."')";
204
        $rc=query("erp",$sql,"insAuftrag 2");
205
	if ($rc === -99) {
206
		echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>";
207
		$rc=query("erp","ROLLBACK WORK","chkKunde");
208
		if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
209
		return false;
210
	}
211
        $sql="select * from oe where notes = '$newID'";
212
        $rs2=getAll("erp",$sql,"insAuftrag 3");
213
	if (!$rs2>0) {
214
		echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>";
215
		$rc=query("erp","ROLLBACK WORK","chkKunde");
216
		if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
217
		return false;
218
	}
219
	$zahlart=$data["payment_method"]."\n";
220
        if ($data["cc_type"]) $zahlart.=$data["cc_type"]."\n".$data["cc_owner"]."\n".$data["cc_number"]."\n".$data["cc_expires"]."\n";
221
        $sql="update oe set cusordnumber=".$data["orders_id"].", transdate='".$data["date_purchased"]."', customer_id=".$data["kdnr"].", ";
222
        $sql.="amount=".$brutto.", netamount=".$netto.", reqdate='".$data["date_purchased"]."', taxincluded='f', ";
223
	if ($data["shipto"]>0) $sql.="shipto_id=".$data["shipto"].", ";
224
        $sql.="intnotes='".$data["comments"]."',notes='".$zahlart."', curr='EUR',employee_id=".$ERPusr["ID"].", vendor_id=0 ";
225
        $sql.="where id=".$rs2[0]["id"];
226
        $rc=query("erp",$sql,"insAuftrag 4");
227
        if ($rc === -99) {
228
                echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>";
229
		$rc=query("erp","ROLLBACK WORK","chkKunde");
230
		if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
231
                return false;
232
        }
233
        echo "Auftrag:[ Buchungsnummer:".$rs2[0]["id"]." AuftrNr:<b>".$auftrag."</b> ]<br>";
234
        if (!insBestArtikel($data["orders_id"],$rs2[0]["id"])) {
235
		echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>";
236
		$rc=query("erp","ROLLBACK WORK","chkKunde");
237
		if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
238
                return false;
239
        };
240
        if ($versandK) {
241
                $sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values (";
242
                $sql.=$rs2[0]["id"].",".$versand["ID"].",'".$versand["TXT"]."',1,".$versandK.",'mal',0,0)";
243
                $rc=query("erp",$sql,"insAuftrag 8");
244
                if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den Versandkosten<br>";
245
        }
246
        if ($nachnK) {
247
                $sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values (";
248
                $sql.=$rs2[0]["id"].",".$nachn["ID"].",'".$nachn["TXT"]."',1,".$nachnK.",'mal',0,0)";
249
                $rc=query("erp",$sql,"insAuftrag 9");
250
                if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den Nachnamekosten<br>";
251
        }
252
        if ($mindermK) {
253
                $sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values (";
254
                $sql.=$rs2[0]["id"].",".$minder["ID"].",'".$minder["TXT"]."',1,".$mindermK.",'mal',0,0)";
255
                $rc=query("erp",$sql,"insAuftrag 10");
256
                if ($rc === -99) echo "Auftrag $auftrag : Fehler beim Mindermengenzuschlag<br>";
257
        }
258
        if ($paypalK) {
259
                $sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values (";
260
                $sql.=$rs2[0]["id"].",".$paypal["ID"].",'".$paypal["TXT"]."',1,".$paypalK.",'mal',0,0)";
261
                $rc=query("erp",$sql,"insAuftrag 11");
262
                if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den PayPal-Kosten<br>";
263
        }
264
        $sql="update orders set orders_status ='3' WHERE orders_id =".$data["orders_id"];
265
        $rc=query("shop",$sql,"insBestArtikel 12");
266
	if ($rc === -99) echo "Bestellung im Shop nicht geschlossen";
267
	$rc=query("erp","COMMIT WORK","chkKunde");
268
	if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
269
	return true;
270
}
271

  
272
/**********************************************
273
* getBestellung()
274
*
275
**********************************************/
276
function getBestellung() {
277
	$sql="select o.*,h.comments,cn.kdnr from orders o left join orders_status_history h on h.orders_id=o.orders_id ";
278
	$sql.="left join customers_number cn on ";
279
	$sql.="cn.customers_id=o.customers_id where o.orders_status=1 order by o.orders_id";
280
	$rs=getAll("shop",$sql,"getBestellung");
281
	return $rs;
282
}
283

  
284
/**********************************************
285
* chkKdData()
286
*
287
**********************************************/
288
function chkKunden() {
289
	$felder=array("firstname","lastname","company","street_address","city","postcode","country");
290
	foreach ($GLOBALS["bestellungen"] as $bestellung) {
291
		$rc=query("erp","BEGIN WORK","chkKunden");
292
		if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
293
		if ($bestellung["kdnr"]>0) { // Bestandskunde; kdnr == ID in customers
294
			$msg="update ";
295
			$kdnr=chkOldKd($bestellung);
296
			if ($kdnr == -1) { //Kunde nicht gefunden, neu anlegen.
297
				$msg="insert ";
298
				$kdnr=insNewKd($bestellung);
299
				$GLOBALS["neuKd"]++;
300
			} else if (!$kdnr) {
301
				echo $msg." ".$bestellung["customers_name"]." fehlgeschlagen!<br>";
302
				$GLOBALS["gesKd"]++;
303
				continue;
304
			}
305
		} else { // Neukunde
306
			$msg="insert ";
307
			$kdnr=insNewKd($bestellung);
308
			$GLOBALS["neuKd"]++;
309
		}
310
		echo $bestellung["customers_company"]." ".$bestellung["customers_name"]." $kdnr<br>";
311
		$GLOBALS["bestellungen"][$GLOBALS["gesKd"]]["kdnr"]=$kdnr;
312
		$sql="delete from customers_number where customers_id=".$bestellung["customers_id"];
313
        	$rc=query("shop",$sql,"chkKunde");
314
        	$sql="insert into customers_number (customers_id,kdnr) values(".$bestellung["customers_id"].",".$kdnr.")";
315
        	$rc=query("shop",$sql,"chkKunde");
316
		if ($kdnr>0) {
317
			foreach($felder as $feld) {
318
				if ($bestellung["delivery_$feld"]<>$bestellung["customers_$feld"]) {
319
					$rc=insShData($bestellung,$kdnr);
320
					if ($rc>0) $GLOBALS["bestellungen"][$GLOBALS["gesKd"]]["shipto"]=$rc;
321
					break;
322
				}
323
			}
324
		}
325
		if (!$kdnr || $rc === -99) {
326
			echo $msg." ".$bestellung["customers_name"]." fehlgeschlagen! ($kdnr,$rc)<br>";
327
			$rc=query("erp","ROLLBACK WORK","chkKunde");
328
			if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
329
		} else {
330
			$rc=query("erp","COMMIT WORK","chkKunde");
331
			if ($rc === -99) { echo "Probleme mit Transaktion. Abbruch!"; exit(); };
332
		}
333
		$GLOBALS["gesKd"]++;
334
	}
335
	return true;
336
}
337

  
338
function chkOldKd($data) {
339
        $sql="select * from customer where id = ".$data["kdnr"];
340
        $rs=getAll("erp",$sql,"chkKdData");
341
        if (!$rs or count($rs)==0) { return -1; }; // Kunde nicht gefunden
342
        if ($rs[0]["zipcode"]<>$data["customers_postcode"]) $set.="zipcode='".$data["customers_postcode"]."',";
343
        if ($rs[0]["city"]<>$data["customers_city"]) $set.="city='".$data["customers_city"]."',";
344
        if ($rs[0]["country"]<>$GLOBALS["taxarray"][$data["billing_country"]]["code"]) $set.="country='".$GLOBALS["taxarray"][$data["billing_country"]]["code"]."',";
345
        if ($rs[0]["phone"]<>$data["customers_phone"])$set.="phone='".$data["customers_phone"]."',";
346
        if ($rs[0]["email"]<>$data["customers_email_address"])$set.="email='".$data["customers_email_address"]."',";
347
        if ($data["customers_company"]) {
348
                if ($rs[0]["name"]<>$data["customers_company"]) $set.="name='".$data["customers_company"]."',";
349
                if ($rs[0]["contact"]<>$data["customers_name"]) $set.="contact='".$data["customers_name"]."',";
350
        } else {
351
                if ($rs[0]["name"]<>$data["customers_name"]) $set.="name='".$data["customers_name"]."',";
352
        }
353
        if ($rs[0]["street"]<>$data["customers_street_address"]) $set.="street='".$data["customers_street_address"]."',";
354
        if ($set) {
355
        		$set=substr($set,0,-1);
356
                $sql="update customer set $set where id=".$data["kdnr"];
357
                $rc=query("erp",$sql,"chkKdData");
358
                if ($rc === -99) {
359
                        return false;
360
                } else {
361
                        return $data["kdnr"];
362
                }
363
        } else {
364
                return $data["kdnr"];
365
        }
366
}
367

  
368
/**********************************************
369
* insShData($data,$id)
370
*
371
**********************************************/
372
function insShData($data,$id) {
373
        $set=$id;
374
        if ($data["delivery_company"]) { $set.=",'".$data["delivery_company"]."','".$data["delivery_name"]."',"; }
375
        else { $set.=",'".$data["delivery_name"]."','',"; }
376
        $set.="'".$data["delivery_street_address"]."',";
377
        $set.="'".$data["delivery_postcode"]."',";
378
        $set.="'".$data["delivery_city"]."',";
379
	if (in_array($data["delivery_country"],$GLOBALS["LAND"])) {
380
		$set.="'".$GLOBALS["LAND"][$data["delivery_country"]]."',";
381
	} else {
382
		$set.="'".$data["delivery_country"]."',";
383
	}
384
        $set.="'".$data["customers_telephone"]."',";
385
        $set.="'".$data["customers_email_address"]."'";
386
        $sql="insert into shipto (trans_id,shiptoname,shiptodepartment_1,shiptostreet,shiptozipcode,shiptocity,";
387
        $sql.="shiptocountry,shiptophone,shiptoemail,module) values ($set,'CT')";
388
        $rc=query("erp",$sql,"insShData");
389
	if ($rc === -99) return false;
390
	$sql="select shipto_id from shipto where trans_id = $id and module='CT' order by itime desc limit 1";
391
	$rs=getAll("erp",$sql,"insKdData");
392
	if ($rs[0]["shipto_id"]>0) {
393
		$sid=$rs[0]["shipto_id"];
394
		$sql="update customers_number set shipto = $sid where kdnr = $id";
395
        	$rc2=query("shop",$sql,"insShData");
396
        	if ($rc2 === -99) {
397
        		//$sql="delete from shipto where shipto_id=$sid";
398
        		//$rc=query("shop",$sql,"insShData");
399
			return false;
400
		}
401
		return $sid;
402
	} else  {
403
		echo "Fehler bei abweichender Anschrift ".$data["delivery_name"];
404
		//$sql="delete from shipto where shipto_id=$sid";
405
        	//$rc=query("shop",$sql,"insShData");
406
		return false;
407
	}
408
}
409

  
410
/**********************************************
411
* insKdData($BID)
412
*
413
**********************************************/
414
function insNewKd($data) {
415
        $newID=uniqid(rand(time(),1));
416
        //Kundennummer generieren
417
        if ($GLOBALS["kdnum"]==1) { // von der ERP
418
                $kdnr=$GLOBALS["preK"].getNextKnr();
419
        } else {                    // durch Shop
420
                $kdnr=$GLOBALS["preK"].$data["customers_id"];
421
        }
422
        $sql="select count(*) as cnt from customer where customernumber = '$kdnr'";
423
        $rs=getAll("erp",$sql,"insKdData");
424
        if ($rs[0]["cnt"]>0) {  // Kundennummer gibt es schon, eine neue aus ERP
425
                $kdnr=$GLOBALS["preK"].getNextKnr();
426
        }
427
        $sql="insert into customer (name,customernumber) values ('$newID','$kdnr')";
428
        $rc=query("erp",$sql,"insKdData");
429
        if ($rc === -99) return false;
430
        $sql="select * from customer where name = '$newID'";
431
        $rs=getAll("erp",$sql,"insKdData");
432
        if (!$rs) return false;
433
        if ($data["customers_company"]) {
434
                $set.="set name='".$data["customers_company"]."',contact='".$data["customers_name"]."',";
435
        }else {
436
		$tmp=strrpos($data["customers_name"]," ");
437
		if ($tmp>0) {
438
	                $set.="set name='".substr($data["customers_name"],$tmp+1).", ".substr($data["customers_name"],0,$tmp)."',";
439
	                $set.="contact='".$data["customers_name"]."',";
440
		} else {
441
	                $set.="set name='".$data["customers_name"]."',";
442
		}
443
        }
444
        $set.="street='".$data["customers_street_address"]."',";
445
        $set.="zipcode='".$data["customers_postcode"]."',";
446
        $set.="city='".$data["customers_city"]."',";
447
        $set.="country='".$GLOBALS["taxarray"][$data["billing_country"]]["code"]."',";
448
        $set.="phone='".$data["customers_telephone"]."',";
449
        $set.="email='".$data["customers_email_address"]."',";
450
        $tid=(in_array($data["billing_country"],array_keys($GLOBALS["taxarray"])))?$GLOBALS["taxarray"][$data["billing_country"]]["tax"]:3;
451
        $set.="taxzone_id=$tid,";
452
        $set.="taxincluded='f' ";
453
        $sql="update customer ".$set;
454
        $sql.="where id=".$rs[0]["id"];
455
        $rc=query("erp",$sql,"insKdData");
456
        if ($rc === -99) {
457
		//$sql="delete from customer where id=".$rs[0]["id"];
458
		//$rc=query("shop",$sql,"insNewKd");
459
		return false;
460
	} else { return $rs[0]["id"]; }
461
}
462

  
463

  
464
$LAND=array("Germany"=>"D","Austria"=>"A","Switzerland"=>"CH");
465
$skosten=array("Versand"=>"ot_shipping","NachName"=>"ot_cod_fee","Paypal"=>"ot_cod_fee","Minder"=>"ot_loworderfee");
466
$inclTax=checkTaxIncl();
467
$TaxFactor=($inclTax)?getTaxRate():1;
468
$bestellungen=getBestellung();
469
$ok=count($bestellungen);
470
$gesKd=0;
471
$neuKd=0;
472
if ($ok) {
473
	echo "Es liegen $ok Bestellungen vor. <br>";
474
	chkKunden();
475
    	echo $gesKd." Kunde(n), davon ".$neuKd." neue(r) Kunde(n).<br>";
476
    	foreach ($bestellungen as $bestellung) {
477
        	insAuftrag($bestellung);
478
    	}
479
} else { echo "Es liegen keine Bestellungen vor!<br>"; };
480
?>
481
<!--a href='trans.php'>zur&uuml;ck</a-->
482
</body>
483
</html>
oscom/readme.first
1
Shop - Schnittstelle Lx-ERP <-> osCommerce/xt:Commerce
2

  
3
Vorraussetzungen:
4
	Lx-ERP Version >= 2.4.0
5
	osCommerce 2.2 ms 2
6
	Pear DB
7

  
8
Installation:
9
Das tar-File unterhalb vom Webserververzeichnis oder dem ERP-Verzeichnis entpacken.
10

  
11
	$ cd /var/www/html
12
	$ tar xzf /pfad/zu/oscomm.tgz
13

  
14
In das Verzeichnis oscomm wechseln und Schreibrechte auf die Datei conf.php und 
15
das Verzeichnis tmp f?r den Webbenutzer (apache,www-data,httpd) vergeben.
16

  
17
	$ chown apache conf.php
18
	$ chmod 600 conf.php
19
	$ chown apache tmp
20

  
21
Im Browser folgende URL aufrufen:
22

  
23
	http://webserver/pfad/oscomm/confedit.php
24

  
25
	z.B.: http://localhost/oscomm/confedit.php
26

  
27
Benutzer und Kennwort f?r die Erstinstallation sind:
28

  
29
	oscom / oscom
30

  
31
Die Maske sogf?lltig ausf?llen.
32

  
33
	db-Host		db-Server f?r die jeweilige Anwendung
34
	Database	Namen der Datenbankinstanzen
35
	db-User		Username und Kennwort f?r die jeweilige Instanz
36
	User-ID		Mit dieser ID soll in die ERP geschrieben werden
... Dieser Diff wurde abgeschnitten, weil er die maximale Anzahl anzuzeigender Zeilen überschreitet.

Auch abrufbar als: Unified diff