Revision 2da79284
Von Holger Lindemann vor fast 12 Jahren hinzugefügt
olcom/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 |
|
olcom/conf.php | ||
---|---|---|
1 |
<? |
|
2 |
// Verbindung zur ERP-db |
|
3 |
$ERPuser="lxoffice"; |
|
4 |
$ERPpass="geheim"; |
|
5 |
$ERPhost="localhost"; |
|
6 |
$ERPport=""; |
|
7 |
$ERPdbname="stable"; |
|
8 |
$ERPdns="pgsql://$ERPuser:$ERPpass@$ERPhost/$ERPdbname"; |
|
9 |
$ERPusr["Name"]="hli"; |
|
10 |
$ERPusr["ID"]="376"; |
|
11 |
$ERPdir="tmp/shopartikel.csv"; |
|
12 |
$ERPimgdir="/usr/lib/lx-office-erp"; |
|
13 |
$maxSize=""; |
|
14 |
$ERPftphost="localhost"; |
|
15 |
$ERPftpuser="olcom"; |
|
16 |
$ERPftppwd="olcom"; |
|
17 |
//Verbindung zur osCommerce-db |
|
18 |
$SHOPuser="root"; |
|
19 |
$SHOPpass="db4web"; |
|
20 |
$SHOPhost="localhost"; |
|
21 |
$SHOPport=""; |
|
22 |
$SHOPdbname="olc"; |
|
23 |
$dbprefix=""; |
|
24 |
$SHOPlang="Array"; |
|
25 |
$SHOPdns="mysql://$SHOPuser:$SHOPpass@$SHOPhost/$SHOPdbname"; |
|
26 |
$SHOPdir="tmp/shopartikel.csv"; |
|
27 |
$SHOPimgdir="/var/www/olcommerce/images/product_images"; |
|
28 |
$SHOPftphost="localhost"; |
|
29 |
$SHOPftpuser="olcom"; |
|
30 |
$SHOPftppwd="olcom"; |
|
31 |
$versand["ID"]="1568"; |
|
32 |
$div16["ID"]="413"; |
|
33 |
$div07["ID"]="414"; |
|
34 |
$nachn["ID"]="413"; |
|
35 |
$minder["ID"]=""; |
|
36 |
$paypal["ID"]="413"; |
|
37 |
$versand["TAX"]="16.00000"; |
|
38 |
$div16["TAX"]="16.00000"; |
|
39 |
$div07["TAX"]="7.00000"; |
|
40 |
$nachn["TAX"]="16.00000"; |
|
41 |
$minder["TAX"]=""; |
|
42 |
$paypal["TAX"]="16.00000"; |
|
43 |
$versand["NR"]="versand"; |
|
44 |
$div16["NR"]="div16"; |
|
45 |
$div07["NR"]="div07"; |
|
46 |
$nachn["NR"]="div16"; |
|
47 |
$minder["NR"]=""; |
|
48 |
$paypal["NR"]="div16"; |
|
49 |
$div16["TXT"]="Diverse Artikel 16% MWSt."; |
|
50 |
$div07["TXT"]="Diverse Artikel 7% MWSt."; |
|
51 |
$versand["TXT"]="Versandkosten"; |
|
52 |
$nachn["TXT"]="Diverse Artikel 16% MWSt."; |
|
53 |
$minder["TXT"]=""; |
|
54 |
$paypal["TXT"]="Diverse Artikel 16% MWSt."; |
|
55 |
$bgcol[1]="#ddddff"; |
|
56 |
$bgcol[2]="#ddffdd"; |
|
57 |
$preA=""; |
|
58 |
$preK=""; |
|
59 |
$auftrnr="1"; |
|
60 |
$debug=false; |
|
61 |
$kdnum="1"; |
|
62 |
$stdprice="0"; |
|
63 |
$altprice="0"; |
|
64 |
$KDGrp=""; |
|
65 |
$nopic="bilder/lx-office-crm.png"; |
|
66 |
$showErr="true"; |
|
67 |
$Language[0]=array("ERP"=>0,"SHOP"=>2); |
|
68 |
$Language[1]=array("ERP"=>2204,"SHOP"=>0); |
|
69 |
$SHOPdefaultlang="2"; |
|
70 |
$SpracheAlle="false"; |
|
71 |
?> |
olcom/confedit.php | ||
---|---|---|
1 |
<? |
|
2 |
// $Id: confedit.php,v 1.3 2004/06/30 11:34:30 hli Exp $ |
|
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ü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üssen sich autentifizieren\n"; |
|
19 |
exit; |
|
20 |
} |
|
21 |
require_once "DB.php"; |
|
22 |
function pg($sel) { |
|
23 |
global $dbP; |
|
24 |
echo "\t<option value=0"; |
|
25 |
if ($sel==0) echo " selected"; |
|
26 |
echo ">Standard VK\n"; |
|
27 |
if (!$dbP) return; |
|
28 |
$sql="select id,pricegroup from pricegroup"; |
|
29 |
$pgs=$dbP->getall($sql); |
|
30 |
if ($pgs) foreach ($pgs as $row) { |
|
31 |
echo "\t<option value=".$row[0]; |
|
32 |
if ($sel==$row[0]) echo " selected"; |
|
33 |
echo ">".$row[1]."\n"; |
|
34 |
} |
|
35 |
} |
|
36 |
function shoplang($sel,$default) { |
|
37 |
global $dbM; |
|
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 |
$sql="select * from language"; |
|
58 |
$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC); |
|
59 |
if (!$rs) { |
|
60 |
echo "\t\t<option>keine Sprachen\n"; |
|
61 |
} else { |
|
62 |
//echo "\t\t<option value='0' ".(($sel==0)?"selected":"").">Standard\n"; |
|
63 |
foreach ($rs as $row) { |
|
64 |
echo "\t\t<option value='".$row["id"]."' "; |
|
65 |
echo ($sel==$row["id"])?"selected":""; |
|
66 |
echo ">".$row["description"]."\n"; |
|
67 |
} |
|
68 |
} |
|
69 |
} |
|
70 |
function getERPlangs() { |
|
71 |
global $dbP; |
|
72 |
$sql="select * from language"; |
|
73 |
$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC); |
|
74 |
return $rs; |
|
75 |
} |
|
76 |
function getShopDefault() { |
|
77 |
global $dbM; |
|
78 |
if (!$dbM) return false; |
|
79 |
$sql="select * from languages L left join configuration C on L.code=C.configuration_value "; |
|
80 |
$sql.="where configuration_key = 'DEFAULT_LANGUAGE'"; |
|
81 |
$rs=$dbM->getAll($sql,DB_FETCHMODE_ASSOC); |
|
82 |
if ($rs) { |
|
83 |
return array("id"=>$rs[0]["languages_id"],"name"=>$rs[0]["name"]); |
|
84 |
} else { |
|
85 |
return 0; |
|
86 |
} |
|
87 |
} |
|
88 |
if ($_POST["ok"]=="sichern") { |
|
89 |
$ok=true; |
|
90 |
if ($_POST["ERPpass"]) { |
|
91 |
$dsnP="pgsql://".$_POST["ERPuser"].":".$_POST["ERPpass"]."@".$_POST["ERPhost"]."/".$_POST["ERPdbname"]; |
|
92 |
} else { |
|
93 |
$dsnP="pgsql://".$_POST["ERPuser"]."@".$_POST["ERPhost"]."/".$_POST["ERPdbname"]; |
|
94 |
} |
|
95 |
$dbP=@DB::connect($dsnP); |
|
96 |
if (DB::isError($dbP)||!$dbP) { |
|
97 |
$ok=false; |
|
98 |
echo "Keine Verbindung zur ERP<br>"; |
|
99 |
echo $dbP->userinfo; |
|
100 |
$dbP=false; |
|
101 |
} else { |
|
102 |
//Steuertabelle ERP |
|
103 |
$sql ="select BG.id as bugru,T.rate,TK.startdate from buchungsgruppen BG left join chart C "; |
|
104 |
$sql.="on BG.income_accno_id_0=C.id left join taxkeys TK on TK.chart_id=C.id left join tax T "; |
|
105 |
$sql.="on T.id=TK.tax_id where TK.startdate <= now()"; |
|
106 |
$rs=$dbP->getAll($sql,DB_FETCHMODE_ASSOC); |
|
107 |
$erptax=array(); |
|
108 |
foreach ($rs as $row) { |
|
109 |
if ($erptax[$row["bugru"]]["startdate"]<$row["startdate"]) { |
|
110 |
$erptax[$row["bugru"]]["startdate"]=$row["startdate"]; |
|
111 |
$erptax[$row["bugru"]]["rate"]=sprintf("%1.4f",$row["rate"]*100); |
|
112 |
} |
|
113 |
} |
|
114 |
$sql ="select P.id,P.description,P.buchungsgruppen_id as bugru from "; |
|
115 |
$sql.="parts P where P.partnumber = '%s'"; |
|
116 |
$rs=$dbP->getall(sprintf($sql,$_POST["div16NR"])); |
|
117 |
$_POST["div16ID"]=$rs[0][0]; |
|
118 |
$div16txt=$rs[0][1]; |
|
119 |
$_POST["div16TAX"]=$erptax[$rs[0][2]]["rate"]; |
|
120 |
$rs=$dbP->getall(sprintf($sql,$_POST["div07NR"])); |
|
121 |
$_POST["div07ID"]=$rs[0][0]; |
|
122 |
$_POST["div07TAX"]=$erptax[$rs[0][2]]["rate"]; |
|
123 |
$div07txt=$rs[0][1]; |
|
124 |
$rs=$dbP->getall(sprintf($sql,$_POST["versandNR"])); |
|
125 |
$_POST["versandID"]=$rs[0][0]; |
|
126 |
$_POST["versandTAX"]=$erptax[$rs[0][2]]["rate"]; |
|
127 |
$versandtxt=$rs[0][1]; |
|
128 |
$rs=$dbP->getall(sprintf($sql,$_POST["nachnNR"])); |
|
129 |
$_POST["nachnID"]=$rs[0][0]; |
|
130 |
$_POST["nachnTAX"]=$erptax[$rs[0][2]]["rate"]; |
|
131 |
$nachntxt=$rs[0][1]; |
|
132 |
$rs=$dbP->getall(sprintf($sql,$_POST["minderNR"])); |
|
133 |
$_POST["minderID"]=$rs[0][0]; |
|
134 |
$_POST["minderTAX"]=$erptax[$rs[0][2]]["rate"]; |
|
135 |
$mindertxt=$rs[0][1]; |
|
136 |
$rs=$dbP->getall(sprintf($sql,$_POST["paypalNR"])); |
|
137 |
$_POST["paypalID"]=$rs[0][0]; |
|
138 |
$_POST["paypalTAX"]=$erptax[$rs[0][2]]["rate"]; |
|
139 |
$paypaltxt=$rs[0][1]; |
|
140 |
$rs=$dbP->getall("select id from employee where login = '".$_POST["ERPusrN"]."'"); |
|
141 |
$_POST["ERPusrID"]=$rs[0][0]; |
|
142 |
} |
|
143 |
if ($_POST["SHOPpass"]) { |
|
144 |
$dsnM="mysql://".$_POST["SHOPuser"].":".$_POST["SHOPpass"]."@".$_POST["SHOPhost"]."/".$_POST["SHOPdbname"]; |
|
145 |
} else { |
|
146 |
$dsnM="mysql://".$_POST["SHOPuser"]."@".$_POST["SHOPhost"]."/".$_POST["SHOPdbname"]; |
|
147 |
} |
|
148 |
$dbM=@DB::connect($dsnM); |
|
149 |
if (DB::isError($dbM)||!$dbM) { |
|
150 |
$ok=false; |
|
151 |
echo "Keine Verbindung zum Shop<br>"; |
|
152 |
echo $dbM->userinfo; |
|
153 |
$dbM=false; |
|
154 |
}; |
|
155 |
if ($ok) { |
|
156 |
$ShopDefaultLang=getShopDefault(); |
|
157 |
$f=fopen("conf$login.php","w"); |
|
158 |
$v="1.6"; |
|
159 |
$d=date("Y/m/d H:i:s"); |
|
160 |
fputs($f,"<?\n// Verbindung zur ERP-db\n"); |
|
161 |
fputs($f,"\$ERPuser=\"".$_POST["ERPuser"]."\";\n"); |
|
162 |
fputs($f,"\$ERPpass=\"".$_POST["ERPpass"]."\";\n"); |
|
163 |
fputs($f,"\$ERPhost=\"".$_POST["ERPhost"]."\";\n"); |
|
164 |
fputs($f,"\$ERPport=\"".$_POST["ERPport"]."\";\n"); |
|
165 |
fputs($f,"\$ERPdbname=\"".$_POST["ERPdbname"]."\";\n"); |
|
166 |
fputs($f,"\$ERPdns=\"pgsql://\$ERPuser:\$ERPpass@\$ERPhost/\$ERPdbname\";\n"); |
|
167 |
fputs($f,"\$ERPusr[\"Name\"]=\"".$_POST["ERPusrN"]."\";\n"); |
|
168 |
fputs($f,"\$ERPusr[\"ID\"]=\"".$_POST["ERPusrID"]."\";\n"); |
|
169 |
fputs($f,"\$ERPdir=\"".$_POST["ERPdir"]."\";\n"); |
|
170 |
fputs($f,"\$ERPimgdir=\"".$_POST["ERPimgdir"]."\";\n"); |
|
171 |
fputs($f,"\$maxSize=\"".$_POST["maxSize"]."\";\n"); |
|
172 |
fputs($f,"\$ERPftphost=\"".$_POST["ERPftphost"]."\";\n"); |
|
173 |
fputs($f,"\$ERPftpuser=\"".$_POST["ERPftpuser"]."\";\n"); |
|
174 |
fputs($f,"\$ERPftppwd=\"".$_POST["ERPftppwd"]."\";\n"); |
|
175 |
fputs($f,"//Verbindung zur osCommerce-db\n"); |
|
176 |
fputs($f,"\$SHOPuser=\"".$_POST["SHOPuser"]."\";\n"); |
|
177 |
fputs($f,"\$SHOPpass=\"".$_POST["SHOPpass"]."\";\n"); |
|
178 |
fputs($f,"\$SHOPhost=\"".$_POST["SHOPhost"]."\";\n"); |
|
179 |
fputs($f,"\$SHOPport=\"".$_POST["SHOPport"]."\";\n"); |
|
180 |
fputs($f,"\$SHOPdbname=\"".$_POST["SHOPdbname"]."\";\n"); |
|
181 |
fputs($f,"\$dbprefix=\"".$_POST["dbprefix"]."\";\n"); |
|
182 |
fputs($f,"\$SHOPlang=\"".$_POST["SHOPlang"]."\";\n"); |
|
183 |
fputs($f,"\$SHOPdns=\"mysql://\$SHOPuser:\$SHOPpass@\$SHOPhost/\$SHOPdbname\";\n"); |
|
184 |
fputs($f,"\$SHOPdir=\"".$_POST["SHOPdir"]."\";\n"); |
|
185 |
fputs($f,"\$SHOPimgdir=\"".$_POST["SHOPimgdir"]."\";\n"); |
|
186 |
fputs($f,"\$SHOPftphost=\"".$_POST["SHOPftphost"]."\";\n"); |
|
187 |
fputs($f,"\$SHOPftpuser=\"".$_POST["SHOPftpuser"]."\";\n"); |
|
188 |
fputs($f,"\$SHOPftppwd=\"".$_POST["SHOPftppwd"]."\";\n"); |
|
189 |
fputs($f,"\$versand[\"ID\"]=\"".$_POST["versandID"]."\";\n"); |
|
190 |
fputs($f,"\$div16[\"ID\"]=\"".$_POST["div16ID"]."\";\n"); |
|
191 |
fputs($f,"\$div07[\"ID\"]=\"".$_POST["div07ID"]."\";\n"); |
|
192 |
fputs($f,"\$nachn[\"ID\"]=\"".$_POST["nachnID"]."\";\n"); |
|
193 |
fputs($f,"\$minder[\"ID\"]=\"".$_POST["minderID"]."\";\n"); |
|
194 |
fputs($f,"\$paypal[\"ID\"]=\"".$_POST["paypalID"]."\";\n"); |
|
195 |
fputs($f,"\$versand[\"TAX\"]=\"".$_POST["versandTAX"]."\";\n"); |
|
196 |
fputs($f,"\$div16[\"TAX\"]=\"".$_POST["div16TAX"]."\";\n"); |
|
197 |
fputs($f,"\$div07[\"TAX\"]=\"".$_POST["div07TAX"]."\";\n"); |
|
198 |
fputs($f,"\$nachn[\"TAX\"]=\"".$_POST["nachnTAX"]."\";\n"); |
|
199 |
fputs($f,"\$minder[\"TAX\"]=\"".$_POST["minderTAX"]."\";\n"); |
|
200 |
fputs($f,"\$paypal[\"TAX\"]=\"".$_POST["paypalTAX"]."\";\n"); |
|
201 |
fputs($f,"\$versand[\"NR\"]=\"".$_POST["versandNR"]."\";\n"); |
|
202 |
fputs($f,"\$div16[\"NR\"]=\"".$_POST["div16NR"]."\";\n"); |
|
203 |
fputs($f,"\$div07[\"NR\"]=\"".$_POST["div07NR"]."\";\n"); |
|
204 |
fputs($f,"\$nachn[\"NR\"]=\"".$_POST["nachnNR"]."\";\n"); |
|
205 |
fputs($f,"\$minder[\"NR\"]=\"".$_POST["minderNR"]."\";\n"); |
|
206 |
fputs($f,"\$paypal[\"NR\"]=\"".$_POST["paypalNR"]."\";\n"); |
|
207 |
fputs($f,"\$div16[\"TXT\"]=\"".$div16txt."\";\n"); |
|
208 |
fputs($f,"\$div07[\"TXT\"]=\"".$div07txt."\";\n"); |
|
209 |
fputs($f,"\$versand[\"TXT\"]=\"".$versandtxt."\";\n"); |
|
210 |
fputs($f,"\$nachn[\"TXT\"]=\"".$nachntxt."\";\n"); |
|
211 |
fputs($f,"\$minder[\"TXT\"]=\"".$mindertxt."\";\n"); |
|
212 |
fputs($f,"\$paypal[\"TXT\"]=\"".$paypaltxt."\";\n"); |
|
213 |
fputs($f,"\$bgcol[1]=\"#ddddff\";\n"); |
|
214 |
fputs($f,"\$bgcol[2]=\"#ddffdd\";\n"); |
|
215 |
fputs($f,"\$preA=\"".$_POST["preA"]."\";\n"); |
|
216 |
fputs($f,"\$preK=\"".$_POST["preK"]."\";\n"); |
|
217 |
fputs($f,"\$auftrnr=\"".$_POST["auftrnr"]."\";\n"); |
|
218 |
fputs($f,"\$debug=".$_POST["debug"].";\n"); |
|
219 |
fputs($f,"\$kdnum=\"".$_POST["kdnum"]."\";\n"); |
|
220 |
fputs($f,"\$stdprice=\"".$_POST["stdprice"]."\";\n"); |
|
221 |
fputs($f,"\$altprice=\"".$_POST["altprice"]."\";\n"); |
|
222 |
fputs($f,"\$KDGrp=\"".$_POST["KDGrp"]."\";\n"); |
|
223 |
fputs($f,"\$nopic=\"".$_POST["nopic"]."\";\n"); |
|
224 |
fputs($f,"\$showErr=\"true\";\n"); |
|
225 |
$Language=array(); |
|
226 |
$DefaultLangOk=false; |
|
227 |
if ($_POST["ERPlang"]) foreach ($_POST["ERPlang"] as $key=>$val) { |
|
228 |
if ($_POST["SHOPlang"][$key]==$ShopDefaultLang["id"]) $DefaultLangOk=true; |
|
229 |
$sl=($_POST["SHOPlang"][$key])?$_POST["SHOPlang"][$key]:0; |
|
230 |
fputs($f,"\$Language[$key]=array(\"ERP\"=>$val,\"SHOP\"=>".$sl.");\n"); |
|
231 |
} |
|
232 |
if (!$DefaultLangOk) { |
|
233 |
fputs($f,"\$SHOPdbname=\"\";\n"); |
|
234 |
echo "Es wurde keine ERP-Sprache der Shopdefaultsprache zugewiesen."; |
|
235 |
echo "Verbindung zum Shop abgebrochen<br>"; |
|
236 |
} |
|
237 |
fputs($f,"\$SHOPdefaultlang=\"".$ShopDefaultLang["id"]."\";\n"); |
|
238 |
fputs($f,"\$SpracheAlle=\"".$_POST["SpracheAlle"]."\";\n"); |
|
239 |
fputs($f,"?>"); |
|
240 |
fclose($f); |
|
241 |
require "conf$login.php"; |
|
242 |
if ($dbprefix<>"") $pre=$dbprefix."_"; |
|
243 |
$sql="select count(*) from ".$pre."customers_number"; |
|
244 |
$rc=@$dbM->query($sql); |
|
245 |
if ($rc->code==-18) { |
|
246 |
$sql="CREATE TABLE ".$pre."customers_number ( cid int(6) NOT NULL auto_increment, customers_id int(3) NOT NULL default '0', "; |
|
247 |
$sql.="kdnr int NOT NULL default '0', shipto int, PRIMARY KEY (cid)) TYPE=MyISAM"; |
|
248 |
$rc=@$dbM->query($sql); |
|
249 |
if ($rc->code==-1) { |
|
250 |
echo "Fehler beim Erzeugen der Tabelle '".$pre."customers_number' in der Shop-db"; |
|
251 |
} else { |
|
252 |
echo "Tabelle '".$pre."customers_number' in der Shop-db angelegt."; |
|
253 |
} |
|
254 |
} else { |
|
255 |
$sql="select shipto from ".$pre."customers_number limit 1"; |
|
256 |
$rc=@$dbM->query($sql); |
|
257 |
if ($rc->code==-19) { |
|
258 |
$sql="alter table ".$pre."customers_number add column shipto int"; |
|
259 |
$rc=@$dbM->query($sql); |
|
260 |
if ($rc->code==-1) { |
|
261 |
echo "Fehler beim Anlegen der Spalte 'shipto' in 'customers_number'"; |
|
262 |
} else { |
|
263 |
echo "'shipto' in 'customers_number' angelegt."; |
|
264 |
} |
|
265 |
} |
|
266 |
} |
|
267 |
} else { |
|
268 |
$ERPuser=$_POST["ERPuser"]; |
|
269 |
$ERPpass=$_POST["ERPpass"]; |
|
270 |
$ERPhost=$_POST["ERPhost"]; |
|
271 |
$ERPport=$_POST["ERPport"]; |
|
272 |
$ERPdbname=$_POST["ERPdbname"]; |
|
273 |
$ERPusrN=$_POST["ERPusrN"]; |
|
274 |
$ERPdir=$_POST["ERPdir"]; |
|
275 |
$ERPimgdir=$_POST["ERPimgdir"]; |
|
276 |
$maxSize=$_POST["maxSize"]; |
|
277 |
$ERPftphost=$_POST["ERPftphost"]; |
|
278 |
$ERPftpuser=$_POST["ERPftpuser"]; |
|
279 |
$ERPftppwd=$_POST["ERPftppwd"]; |
|
280 |
$SHOPuser=$_POST["SHOPuser"]; |
|
281 |
$SHOPpass=$_POST["SHOPpass"]; |
|
282 |
$SHOPhost=$_POST["SHOPhost"]; |
|
283 |
$SHOPport=$_POST["SHOPport"]; |
|
284 |
$SHOPdbname=$_POST["SHOPdbname"]; |
|
285 |
$dbprefix=$_POST["dbprefix"]; |
|
286 |
$SHOPlang=$_POST["SHOPlang"]; |
|
287 |
$SHOPdir=$_POST["SHOPdir"]; |
|
288 |
$SHOPimgdir=$_POST["SHOPimgdir"]; |
|
289 |
$SHOPftphost=$_POST["SHOPftphost"]; |
|
290 |
$SHOPftpuser=$_POST["SHOPftpuser"]; |
|
291 |
$SHOPftppwd=$_POST["SHOPftppwd"]; |
|
292 |
$div16NR=$_POST["div16NR"]; |
|
293 |
$div07NR=$_POST["div07NR"]; |
|
294 |
$versandNR=$_POST["versandNR"]; |
|
295 |
$nachnNR=$_POST["nachnNR"]; |
|
296 |
$minderNR=$_POST["minderNR"]; |
|
297 |
$paypalNR=$_POST["paypalNR"]; |
|
298 |
$preA=$_POST["preA"]; |
|
299 |
$preK=$_POST["preK"]; |
|
300 |
$kdnum=$_POST["kdnum"]; |
|
301 |
$auftrnr=$_POST["auftrnr"]; |
|
302 |
$debug=$_POST["debug"]; |
|
303 |
$altprice=$_POST["altprice"]; |
|
304 |
$stdprice=$_POST["stdprice"]; |
|
305 |
$nopic=$_POST["nopic"]; |
|
306 |
} |
|
307 |
$ERPlangs=getERPlangs(); |
|
308 |
$CntERPLang=count($ERPlangs); //$rs[0][0]; |
|
309 |
} else { |
|
310 |
if (file_exists ("conf$login.php")) { |
|
311 |
require "conf$login.php"; |
|
312 |
} else { |
|
313 |
require "conf.php"; |
|
314 |
} |
|
315 |
$dsnP = array( |
|
316 |
'phptype' => 'pgsql', |
|
317 |
'username' => $ERPuser, |
|
318 |
'password' => $ERPpass, |
|
319 |
'hostspec' => $ERPhost, |
|
320 |
'database' => $ERPdbname, |
|
321 |
'port' => $ERPport |
|
322 |
); |
|
323 |
$dbP=@DB::connect($dsnP); |
|
324 |
if (DB::isError($dbP)||!$dbP) { |
|
325 |
echo "Keine Verbindung zur ERP<br>"; |
|
326 |
$dbP=false; |
|
327 |
//echo $dbP->userinfo; |
|
328 |
} else { |
|
329 |
//$rs=$dbP->getAll("select count(*) from language"); |
|
330 |
$ERPlangs=getERPlangs(); |
|
331 |
$CntERPLang=count($ERPlangs); //$rs[0][0]; |
|
332 |
} |
|
333 |
$dsnM = array( |
|
334 |
'phptype' => 'mysql', |
|
335 |
'username' => $SHOPuser, |
|
336 |
'password' => $SHOPpass, |
|
337 |
'hostspec' => $SHOPhost, |
|
338 |
'database' => $SHOPdbname, |
|
339 |
'port' => $SHOPport |
|
340 |
); |
|
341 |
$dbM=@DB::connect($dsnM); |
|
342 |
if (DB::isError($dbM)||!$dbM) { |
|
343 |
echo "Keine Verbindung zum SHOP<br>"; |
|
344 |
//echo $dbM->userinfo; |
|
345 |
$dbM=false; |
|
346 |
} else { |
|
347 |
$ShopDefaultLang=getShopDefault(); |
|
348 |
} |
|
349 |
} |
|
350 |
?> |
|
351 |
<html> |
|
352 |
<body> |
|
353 |
<center> |
|
354 |
<table style="background-color:#cccccc"> |
|
355 |
<form name="ConfEdit" method="post" action="confedit.php"> |
|
356 |
<input type="hidden" name="div16ID" value="<?= $div16["ID"] ?>"> |
|
357 |
<input type="hidden" name="div07ID" value="<?= $div07["ID"] ?>"> |
|
358 |
<input type="hidden" name="minderID" value="<?= $minder["ID"] ?>"> |
|
359 |
<input type="hidden" name="versandID" value="<?= $versand["ID"] ?>"> |
|
360 |
<input type="hidden" name="nachnID" value="<?= $nachn["ID"] ?>"> |
|
361 |
<input type="hidden" name="paypalID" value="<?= $paypal["ID"] ?>"> |
|
362 |
<input type="hidden" name="ERPusrID" value="<?= $ERPusr["ID"] ?>"> |
|
363 |
<input type="hidden" name="login" value="<?= $login ?>"> |
|
364 |
<tr><th>Daten</th><th>Lx-ERP</th><th></th><th>Shop</th></tr> |
|
365 |
<tr> |
|
366 |
<td>db-Host</td> |
|
367 |
<td colspan="2"><input type="text" name="ERPhost" size="25" value="<?= $ERPhost ?>"></td> |
|
368 |
<td><input type="text" name="SHOPhost" size="25" value="<?= $SHOPhost ?>"></td> |
|
369 |
</tr> |
|
370 |
<tr> |
|
371 |
<td>Port</td> |
|
372 |
<td colspan="2"><input type="text" name="ERPport" size="25" value="<?= $ERPport ?>"></td> |
|
373 |
<td><input type="text" name="SHOPport" size="25" value="<?= $SHOPport ?>"></td> |
|
374 |
</tr> |
|
375 |
<tr> |
|
376 |
<td>Database</td> |
|
377 |
<td colspan="2"><input type="text" name="ERPdbname" size="20" value="<?= $ERPdbname ?>"></td> |
|
378 |
<td><input type="text" name="SHOPdbname" size="20" value="<?= $SHOPdbname ?>"></td> |
|
379 |
</tr> |
|
380 |
<tr> |
|
381 |
<td>db-User Name</td> |
|
382 |
<td colspan="2"><input type="text" name="ERPuser" size="15" value="<?= $ERPuser ?>"></td> |
|
383 |
<td><input type="text" name="SHOPuser" size="15" value="<?= $SHOPuser ?>"></td> |
|
384 |
</tr> |
|
385 |
<tr> |
|
386 |
<td>db-User PWD</td> |
|
387 |
<td colspan="2"><input type="text" name="ERPpass" size="15" value="<?= $ERPpass ?>"></td> |
|
388 |
<td><input type="text" name="SHOPpass" size="15" value="<?= $SHOPpass ?>"></td> |
|
389 |
</tr> |
|
390 |
<tr> |
|
391 |
<td>User-ID</td> |
|
392 |
<td colspan="2"><input type="text" name="ERPusrN" size="10" value="<?= $ERPusr["Name"] ?>"> |
|
393 |
<input type="checkbox" name="a1" <?= (empty($ERPusr["ID"])?"":"checked") ?> onFocus="blur();"> |
|
394 |
db-Prefix |
|
395 |
</td> |
|
396 |
<td><input type="text" name="dbprefix" size="15" value="<?= $dbprefix ?>"></td> |
|
397 |
</tr> |
|
398 |
<tr> |
|
399 |
<td>CSV-Dir</td> |
|
400 |
<td colspan="2"><input type="text" name="ERPdir" size="30" value="<?= $ERPdir ?>"></td> |
|
401 |
<td><input type="text" name="SHOPdir" size="30" value="<?= $SHOPdir ?>"></td> |
|
402 |
</tr> |
|
403 |
<tr> |
|
404 |
<td>Image-Dir</td> |
|
405 |
<td colspan="2"><input type="text" name="ERPimgdir" size="30" value="<?= $ERPimgdir ?>"></td> |
|
406 |
<td><input type="text" name="SHOPimgdir" size="30" value="<?= $SHOPimgdir ?>"></td> |
|
407 |
</tr> |
|
408 |
<tr> |
|
409 |
<td>FTP-Host</td> |
|
410 |
<td colspan="2"><input type="text" name="ERPftphost" size="20" value="<?= $ERPftphost ?>"></td> |
|
411 |
<td><input type="text" name="SHOPftphost" size="20" value="<?= $SHOPftphost ?>"></td> |
|
412 |
</tr> |
|
413 |
<tr> |
|
414 |
<td>FTP-User</td> |
|
415 |
<td colspan="2"><input type="text" name="ERPftpuser" size="15" value="<?= $ERPftpuser ?>"></td> |
|
416 |
<td><input type="text" name="SHOPftpuser" size="15" value="<?= $SHOPftpuser ?>"></td> |
|
417 |
</tr> |
|
418 |
<tr> |
|
419 |
<td>FTP-User PWD</td> |
|
420 |
<td colspan="2"><input type="text" name="ERPftppwd" size="15" value="<?= $ERPftppwd ?>"></td> |
|
421 |
<td><input type="text" name="SHOPftppwd" size="15" value="<?= $SHOPftppwd ?>"></td> |
|
422 |
</tr> |
|
423 |
<tr> |
|
424 |
<td>ID Diverse 16%</td> |
|
425 |
<td><input type="text" name="div16NR" size="10" value="<?= $div16["NR"] ?>"> |
|
426 |
<input type="checkbox" name="a1" <?= (empty($div16["ID"])?"":"checked") ?>></td> |
|
427 |
<td>ID Diverse 7%</td> |
|
428 |
<td><input type="text" name="div07NR" size="10" value="<?= $div07["NR"] ?>"> |
|
429 |
<input type="checkbox" name="a1" <?= (empty($div07["ID"])?"":"checked") ?>></td> |
|
430 |
</tr> |
|
431 |
<tr> |
|
432 |
<td>ID Versand</td> |
|
433 |
<td><input type="text" name="versandNR" size="10" value="<?= $versand["NR"] ?>"> |
|
434 |
<input type="checkbox" name="a1" <?= (empty($versand["ID"])?"":"checked") ?>></td> |
|
435 |
<td>ID Nachname</td> |
|
436 |
<td><input type="text" name="nachnNR" size="10" value="<?= $nachn["NR"] ?>"> |
|
437 |
<input type="checkbox" name="a1" <?= (empty($nachn["ID"])?"":"checked") ?>></td> |
|
438 |
</tr> |
|
439 |
<tr> |
|
440 |
<td>ID Paypal</td> |
|
441 |
<td><input type="text" name="paypalNR" size="10" value="<?= $paypal["NR"] ?>"> |
|
442 |
<input type="checkbox" name="a1" <?= (empty($paypal["ID"])?"":"checked") ?>></td> |
|
443 |
<td>ID Mindemenge</td> |
|
444 |
<td><input type="text" name="minderNR" size="10" value="<?= $minder["NR"] ?>"> |
|
445 |
<input type="checkbox" name="a1" <?= (empty($minder["ID"])?"":"checked") ?>></td> |
|
446 |
</tr> |
|
447 |
<tr> |
|
448 |
<td >Sprachen</td> |
|
449 |
<td ><input type="hidden" name="ERPlang[0]" value="0">Standard</td> |
|
450 |
<td >--></td> |
|
451 |
<td ><input type="hidden" name="SHOPlang[0]" value="<?= $ShopDefaultLang["id"] ?>"><?= $ShopDefaultLang["name"] ?></td> |
|
452 |
</tr> |
|
453 |
<? for($i=0; $i < $CntERPLang; $i++) { ?> |
|
454 |
<tr> |
|
455 |
<td >Sprachen</td> |
|
456 |
<td><input type="hidden" name="ERPlang[<?= $i+1 ?>]" value="<?= $ERPlangs[$i]["id"] ?>"><?= $ERPlangs[$i]["description"] ?> |
|
457 |
<td >--></td> |
|
458 |
<td ><select name="SHOPlang[<?= $i+1 ?>]"> |
|
459 |
<?= shoplang($Language[$i+1]["SHOP"],$ShopDefaultLang); ?> |
|
460 |
</select></td> |
|
461 |
</tr> |
|
462 |
<? } ?> |
|
463 |
<tr> |
|
464 |
<td colspan="2">Nur übersetzte Artikel</td> |
|
465 |
<td><input type="radio" name="SpracheAlle" value="true" <?= ($SpracheAlle=="true")?"checked":"" ?>> Ja</td> |
|
466 |
<td><input type="radio" name="SpracheAlle" value="false" <?= ($SpracheAlle<>"true")?"checked":"" ?>> Nein</td> |
|
467 |
</tr> |
|
468 |
<tr> |
|
469 |
<td>Standardpreis</td> |
|
470 |
<td><select name="stdprice"> |
|
471 |
<? pg($stdprice); ?> |
|
472 |
</select></td> |
|
473 |
<td>Defaultbild</td> |
|
474 |
<td><input type="text" name="nopic" size="20" value="<?= $nopic ?>"> |
|
475 |
<tr> |
|
476 |
<td>abweichender Preis</td> |
|
477 |
<td><select name="altprice"> |
|
478 |
<? pg($altprice); ?> |
|
479 |
</select></td> |
|
480 |
<td>Kundengruppe</td> |
|
481 |
<td><input type="text" name="KDGrp" size="3" value="<?= $KDGrp ?>"> |
|
482 |
</tr> |
|
483 |
<tr> |
|
484 |
<td colspan="2">Auftragsnummern durch</td> |
|
485 |
<td><input type="radio" name="auftrnr" value="1" <?= ($auftrnr==1)?"checked":"" ?>> LxO</td> |
|
486 |
<td><input type="radio" name="auftrnr" value="0" <?= ($auftrnr<>1)?"checked":"" ?>> Shop</td> |
|
487 |
</tr> |
|
488 |
<tr> |
|
489 |
<td colspan="2">Kundennummern durch</td> |
|
490 |
<td><input type="radio" name="kdnum" value="1" <?= ($kdnum==1)?"checked":"" ?>> LxO</td> |
|
491 |
<td><input type="radio" name="kdnum" value="0" <?= ($kdnum<>1)?"checked":"" ?>> Shop</td> |
|
492 |
</tr> |
|
493 |
<tr> |
|
494 |
<td colspan="2">Nummernerweiterung</td> |
|
495 |
<td>Auftrag<input type="text" name="preA" size="5" value="<?= $preA ?>"></td> |
|
496 |
<td>Kunde<input type="text" name="preK" size="5" value="<?= $preK ?>"></td> |
|
497 |
</tr> |
|
498 |
<tr> |
|
499 |
<td>Logging</td> |
|
500 |
<td>ein<input type="radio" name="debug" value="true" <?= ($debug=="true")?"checked":"" ?>> |
|
501 |
aus<input type="radio" name="debug" value="false" <?= ($debug!="true")?"checked":"" ?>></td> |
|
502 |
<td></td><td></td> |
|
503 |
</tr> |
|
504 |
|
|
505 |
<tr><td colspan="4" align="center"><input type="submit" name="ok" value="sichern"></td></tr> |
|
506 |
</form> |
|
507 |
</table> |
|
508 |
</center> |
|
509 |
</body> |
|
510 |
</html> |
|
511 |
<? } ?> |
olcom/diff.php | ||
---|---|---|
1 |
<? |
|
2 |
// $Id: diff.php,v 1.1 2004/06/30 10:12:15 hli Exp $ |
|
3 |
require_once "DB.php"; |
|
4 |
require_once "conf.php"; |
|
5 |
if ($dbprefix<>"") { define("PREFIX",$dbprefix."_"); } else { define("PREFIX",""); } |
|
6 |
|
|
7 |
if (!$db) { |
|
8 |
$db=DB::connect($SHOPdns); |
|
9 |
if (!$db) dbFehler("",$db->getDebugInfo()); |
|
10 |
if (DB::isError($db)) { |
|
11 |
dbFehler("",$db->getDebugInfo()); |
|
12 |
die ($db->getDebugInfo()); |
|
13 |
}; |
|
14 |
$db2=DB::connect($ERPdns); |
|
15 |
if (!$db2) dbFehler("",$db2->getDebugInfo()); |
|
16 |
if (DB::isError($db2)) { |
|
17 |
dbFehler("",$db2->getDebugInfo()); |
|
18 |
die ($db2->getDebugInfo()); |
|
19 |
}; |
|
20 |
} |
|
21 |
if ($_POST["ok"]) { |
|
22 |
foreach($_POST as $key=>$val) { |
|
23 |
if ($key=="ok") continue; |
|
24 |
if ($key=="alle") continue; |
|
25 |
$sql="update ".PREFIX."products set products_status=0 where products_model=$key"; |
|
26 |
echo "$key "; |
|
27 |
if ($db->query($sql)) { echo "deaktiviert<br>"; } |
|
28 |
else { echo "konnte nicht deaktiviert werden<br>"; }; |
|
29 |
} |
|
30 |
} else { |
|
31 |
$sql="select partnumber from parts where shop='1' order by partnumber"; |
|
32 |
$erp=$db2->getAll($sql,DB_FETCHMODE_ASSOC); |
|
33 |
if ($erp) foreach ($erp as $zeile) { $arE[]=$zeile["partnumber"]; }; |
|
34 |
|
|
35 |
if ($SHOPlang>0) { |
|
36 |
$defLang=$SHOPlang; |
|
37 |
} else { |
|
38 |
$sql="select * from ".PREFIX."languages L left join ".PREFIX."configuration C on L.code=C.configuration_value where configuration_key = 'DEFAULT_LANGUAGE'"; |
|
39 |
$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC); |
|
40 |
if ($rs) { |
|
41 |
$defLang=$rs[0]["languages_id"]; |
|
42 |
} else { |
|
43 |
$defLang=1; |
|
44 |
} |
|
45 |
} |
|
46 |
|
|
47 |
$sql="select products_model,P.products_id,products_name from ".PREFIX."products P left join ".PREFIX."products_description D on P.products_id=D.products_id where language_id=$defLang and products_status=1 order by products_model"; |
|
48 |
$shop=$db->getAll($sql,DB_FETCHMODE_ASSOC); |
|
49 |
if ($shop) foreach ($shop as $zeile) { |
|
50 |
$arS[]=$zeile["products_model"]; |
|
51 |
$arID[$zeile["products_model"]]=array("id"=>$zeile["products_id"],"name"=>$zeile["products_name"]); |
|
52 |
} |
|
53 |
$result=@array_diff($arS,$arE); |
|
54 |
if ($result) { |
|
55 |
?> |
|
56 |
<html> |
|
57 |
<head><title>Artikelpflege</title> |
|
58 |
<script language="JavaScript"> |
|
59 |
<!-- |
|
60 |
function sel() { |
|
61 |
val=document.doppel.alle.checked; |
|
62 |
cnt=document.doppel.length; |
|
63 |
for (i=0; i<cnt; i++) { |
|
64 |
document.doppel.elements[i].checked=val; |
|
65 |
} |
|
66 |
} |
|
67 |
//--> |
|
68 |
</script> |
|
69 |
</head> |
|
70 |
<body> |
|
71 |
Folgende Artikel sind in der ERP nicht mehr als Shopartikel markiert.<br> |
|
72 |
Markieren Sie die Artikel, die deaktiviert werden sollen.<br> |
|
73 |
<form name='doppel' method='post' action='diff.php'> |
|
74 |
<table> |
|
75 |
<? |
|
76 |
foreach ($result as $data) { |
|
77 |
echo "\t<tr><td><input type='checkbox' name='".$data."' value='1'></td><td>".$data."</td><td>".$arID[$data]["name"]."</td></tr>\n"; |
|
78 |
} |
|
79 |
?> |
|
80 |
<tr><td><input type='checkbox' name='alle' value='1' onClick="sel()"></td><td></td><td>alle Artikel</td></tr> |
|
81 |
<tr><td colspan='3'><input type='submit' name='ok' value='ok'></td></tr> |
|
82 |
</table> |
|
83 |
<form> |
|
84 |
<? } |
|
85 |
else { "Artikelbestand identisch"; }; |
|
86 |
} ?> |
|
87 |
<!--a href="trans.php">zurück</a--> |
olcom/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: kivitendo ERP 3.0.0 |
|
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 "DB.php"; |
|
38 |
require_once "./conf.php"; |
|
39 |
$db=DB::connect($ERPdns); |
|
40 |
if (!$db) dbFehler("",$db->getDebugInfo()); |
|
41 |
if (DB::isError($db)) { |
|
42 |
dbFehler("",$db->getDebugInfo()); |
|
43 |
die ($db->getDebugInfo()); |
|
44 |
}; |
|
45 |
/**************************************************** |
|
46 |
* dbFehler |
|
47 |
* in: sql,err = string |
|
48 |
* out: |
|
49 |
* Fehlermeldungen ausgeben |
|
50 |
*****************************************************/ |
|
51 |
function dbFehler($sql,$err) { |
|
52 |
global $showErr; |
|
53 |
if ($showErr) |
|
54 |
echo "</td></tr></table><font color='red'>$sql : $err</font><br>"; |
|
55 |
} |
|
56 |
|
|
57 |
function shopartikel() { |
|
58 |
global $db; |
|
59 |
$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 "; |
|
60 |
$sql.="parts P left join partsgroup PG on PG.id=P.partsgroup_id "; |
|
61 |
$sql.="left join chart c on c.id = P.income_accno_id "; |
|
62 |
$sql.="left join tax T on T.taxkey=C.taxkey_id "; |
|
63 |
$sql.="where shop = 't'"; |
|
64 |
$rs=$db->getAll($sql,DB_FETCHMODE_ASSOC); |
|
65 |
return $rs; |
|
66 |
} |
|
67 |
if ($_POST["export"]) { |
|
68 |
$data=shopartikel(); |
|
69 |
$delim=($_POST["deli"])?$_POST["deli"]:","; |
|
70 |
if (get_magic_quotes_gpc()) { |
|
71 |
$crln = stripslashes($_POST["crln"]); |
|
72 |
} |
|
73 |
$crln = str_replace('\\r', "\015", $crln); |
|
74 |
$crln = str_replace('\\n', "\012", $crln); |
|
75 |
$crln = str_replace('\\t', "\011", $crln); |
|
76 |
$encl=$_POST["encl"]; |
|
77 |
$i=0; |
|
78 |
$f=fopen($ERPdir,"w"); |
|
79 |
if ($_POST["partnumber"]) {$header.=$_POST["PN"].$delim; }; |
|
80 |
if ($_POST["desctiption"]) {$header.=$_POST["BEZ"].$delim; }; |
|
81 |
if ($_POST["unit"]) {$header.=$_POST["EINHEIT"].$delim; }; |
|
82 |
if ($_POST["onhand"]) {$header.=$_POST["LAGER"].$delim; }; |
|
83 |
if ($_POST["weight"]) {$header.=$_POST["GEWICHT"].$delim; }; |
|
84 |
if ($_POST["rate"]) {$header.=$_POST["MWST"].$delim; }; |
|
85 |
if ($_POST["sellprice"]) {$header.=$_POST["VK"].$delim; }; |
|
86 |
if ($_POST["listprice"]) {$header.=$_POST["EK"].$delim; }; |
|
87 |
if ($_POST["priceupdate"]) {$header.=$_POST["PDATE"].$delim; }; |
|
88 |
if ($_POST["partsgroup"]) {$header.=$_POST["PG"].$delim; }; |
|
89 |
if ($_POST["notes"]) {$header.=$_POST["BESCHR"].$delim; }; |
|
90 |
if ($_POST["image"]) {$header.=$_POST["IMAGE"].$delim; }; |
|
91 |
$header=substr($header,0,-1); |
|
92 |
?> |
|
93 |
<table class="liste"> |
|
94 |
<!-- BEGIN Artikel --> |
|
95 |
<? $i=0; |
|
96 |
$f=fopen($ERPdir,"w"); |
|
97 |
if ($_POST["head"]) fputs($f,$header.$crln); |
|
98 |
foreach($data as $zeile) { |
|
99 |
$file=""; $html=""; |
|
100 |
if ($_POST["shop"]=="pepper") { |
|
101 |
if (preg_match("/^\[.*\].*/",$zeile["partsgroup"])) { $PG=$zeile["partsgroup"]; } |
|
102 |
else { $PG="[".$zeile["partsgroup"]."]"; }; |
|
103 |
$mwst=$zeile["rate"]*100; |
|
104 |
} else if ($_POST["shop"]=="oscomm") { |
|
105 |
$mwst=sprintf("%01.4f",($zeile["rate"]*100)); |
|
106 |
$PG=$zeile["partsgroup"]; |
|
107 |
} else { |
|
108 |
$PG=$zeile["partsgroup"]; |
|
109 |
$mwst=$zeile["rate"]*100; |
|
110 |
}; |
|
111 |
$LineCol = $bgcol[$i%2+1]; |
|
112 |
if ($_POST["partnumber"]) {$file.=$encl.$zeile["partnumber"].$encl.$delim; $html.="<td>".$zeile["partnumber"]."</td>";}; |
|
113 |
if ($_POST["desctiption"]) {$file.=$encl.strtr($zeile["description"],chr(13).chr(10)," ").$encl.$delim; $html.="<td>".$zeile["description"]."</td>";}; |
|
114 |
if ($_POST["unit"]) {$file.=$encl.$zeile["unit"].$encl.$delim; $html.="<td>".$zeile["unit"]."</td>";}; |
|
115 |
if ($_POST["onhand"]) {$file.=$encl.$zeile["onhand"].$encl.$delim; $html.="<td>".$zeile["onhand"]."</td>";}; |
|
116 |
if ($_POST["weight"]) {$file.=$encl.$zeile["weight"].$encl.$delim; $html.="<td>".$zeile["weight"]."</td>";}; |
|
117 |
if ($_POST["rate"]) {$file.=$encl.$mwst.$encl.$delim; $html.="<td>".$mwst."</td>";}; |
|
118 |
if ($_POST["sellprice"]) {$file.=$encl.(sprintf("%02.2f",$zeile["sellprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["sellprice"]))."</td>";}; |
|
119 |
if ($_POST["listprice"]) {$file.=$encl.(sprintf("%02.2f",$zeile["listprice"])).$encl.$delim; $html.="<td>".(sprintf("%02.2f",$zeile["listprice"]))."</td>";}; |
|
120 |
if ($_POST["partsgroup"]) {$file.=$encl.$PG.$encl.$delim; $html.="<td>".$zeile["partsgroup"]."</td>";}; |
|
121 |
if ($_POST["notes"]) {$file.=$encl.strtr($zeile["notes"],chr(13).chr(10)," ").$encl.$delim; $html.="<td>".$zeile["notes"]."</td>";}; |
|
122 |
if ($_POST["image"]) {$file.=$encl.$zeile["image"].$encl.$delim; $html.="<td>".$zeile["image"]."</td>";}; |
|
123 |
$i++; |
|
124 |
fputs($f,substr($file,0,-1).$crln); |
|
125 |
if ($_POST["show"]) { |
|
126 |
?> |
|
127 |
<tr class="smal" onMouseover="this.bgColor='#FF0000';" onMouseout="this.bgColor='<?= $LineCol ?>';" bgcolor="<?= $LineCol ?>"> |
|
128 |
<?= $html ?> |
|
129 |
</tr> |
|
130 |
<? } |
|
131 |
} |
|
132 |
?> |
|
133 |
<!-- END Artikel --> |
|
134 |
</table> |
|
135 |
Anzahl der Artikel: <?= $i ?><br> |
|
136 |
Export am : <?= date("d.m.Y : H:i") ?><br> |
|
137 |
download <a href="tmp/shopartikel.csv">Exportfile</a><br><hr> |
|
138 |
<? |
|
139 |
fclose($f); |
|
140 |
} // if ($export) |
|
141 |
?> |
|
142 |
Export der Shopartikel aus Lx-ERP <br> |
|
143 |
Mögliche Felder |
|
144 |
<form name="fld" action="erpexport.php" method="post"> |
|
145 |
<input type="hidden" name="shop" value=""> |
|
146 |
<table> |
|
147 |
<tr> |
|
148 |
<td><input type="checkbox" name="partnumber" value="1">Artikelnummer</td> |
|
149 |
<td><input type="checkbox" name="desctiption" value="1">Bezeichnung</td> |
|
150 |
<td><input type="checkbox" name="unit" value="1">Einheit</td> |
|
151 |
<td><input type="checkbox" name="weight" value="1">Gewicht</td> |
|
152 |
</tr> |
|
153 |
<tr> |
|
154 |
<td><input type="text" name="PN" size="23"></td> |
|
155 |
<td><input type="text" name="BEZ" size="23"></td> |
|
156 |
<td><input type="text" name="EINHEIT" size="23"></td> |
|
157 |
<td><input type="text" name="GEWICHT" size="23"></td> |
|
158 |
</tr> |
|
159 |
<tr><td colspan=5></td></tr> |
|
160 |
<tr> |
|
161 |
<td><input type="checkbox" name="sellprice" value="1">Verkaufspreis</td> |
|
162 |
<td><input type="checkbox" name="listprice" value="1">Listenpreis</td> |
|
163 |
<td><input type="checkbox" name="onhand" value="1">Lagerbestand</td> |
|
164 |
<td><input type="checkbox" name="rate" value="1">MwSt</td> |
|
165 |
</tr> |
|
166 |
<tr> |
|
167 |
<td><input type="text" name="VK" size="23"></td> |
|
168 |
<td><input type="text" name="EK" size="23"></td> |
|
169 |
<td><input type="text" name="LAGER" size="23"></td> |
|
170 |
<td><input type="text" name="MWST" size="23"></td> |
|
171 |
</tr> |
|
172 |
<tr><td colspan=5></td></tr> |
|
173 |
<tr> |
|
174 |
<td><input type="checkbox" name="partsgroup" value="1">Gruppe</td> |
|
175 |
<td><input type="checkbox" name="notes" value="1">Beschreibung</td> |
|
176 |
<td><input type="checkbox" name="image" value="1">Bild</td> |
|
177 |
<td><input type="checkbox" name="show" value="1" checked>HTML-Anzeige</td> |
|
178 |
</tr> |
|
179 |
<tr> |
|
180 |
<td><input type="text" name="PG" size="23"></td> |
|
181 |
<td><input type="text" name="BESCHR" size="23"></td> |
|
182 |
<td><input type="text" name="IMAGE" size="23"></td> |
|
183 |
<td></td> |
|
184 |
</tr> |
|
185 |
<tr> |
|
186 |
<td>Feldtrenner <input type="text" name="deli" size="2" value=","></td> |
|
187 |
<td>Feldumrahmung <input type="text" name="encl" size="2" value="""></td> |
|
188 |
<td>Zeilenende <input type="text" name="crln" size="2" value="\n"></td> |
|
189 |
<td><input type="checkbox" name="head" value="1" checked>Headline</td> |
|
190 |
</tr> |
|
191 |
<tr> |
|
192 |
<td colspan=5><input type="submit" name="export" value="Export"> <input type="button" name="xsc" value="xtCommerce" onClick="xtcomm()"></td> |
|
193 |
</tr> |
|
194 |
</table> |
|
195 |
<a href="trans.php">zurück</a> |
|
196 |
</form> |
|
197 |
</body> |
|
198 |
</html> |
olcom/menu.ini | ||
---|---|---|
1 |
|
|
2 |
[olCom] |
|
3 |
|
|
4 |
[olCom--Warenexport] |
|
5 |
module=olcom/shopimport_db.php |
|
6 |
|
|
7 |
[olCom--Bestellungen] |
|
8 |
module=olcom/olcomexport.php |
|
9 |
|
|
10 |
[olCom--Konfiguration] |
|
11 |
module=olcom/confedit.php |
|
12 |
|
olcom/olcomexport.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: xt::Commerce |
|
9 |
*ERP: kivitendo ERP 3.0.0 |
|
10 |
***************************************************************/ |
|
11 |
/* |
|
12 |
* Noch einzubauen: |
|
13 |
*/ |
|
14 |
//echo <<<EOF |
|
15 |
echo "<html>"; |
|
16 |
echo " <head><title>Lx-ERP Export der Shopartikel</title>"; |
|
17 |
echo ' <link type="text/css" REL="stylesheet" HREF="css/main.css"></link>'; |
|
18 |
echo "<body>"; |
|
19 |
//EOF; |
|
20 |
|
|
21 |
require_once "shoplib.php"; |
|
22 |
|
|
23 |
|
|
24 |
/********************************************** |
|
25 |
* getAttribut($oid,$pid) |
|
26 |
* |
|
27 |
**********************************************/ |
|
28 |
function getAttribut($oid,$pid) { |
|
29 |
$sql="select * from ".PREFIX."orders_products_attributes where orders_id=$oid and orders_products_id=$pid"; |
|
30 |
$rs=getAll("shop",$sql,"getAttribut"); |
|
31 |
$txt=""; |
|
32 |
foreach ($rs as $zeile) { |
|
33 |
$txt.="\n - ".$zeile["products_options"].":".$zeile["products_options_values"]; |
|
34 |
}; |
|
35 |
return $txt; |
|
36 |
} |
|
37 |
|
|
38 |
/********************************************** |
|
39 |
* getBrutto($id) |
|
40 |
* |
|
41 |
**********************************************/ |
|
42 |
function getBrutto($id) { |
|
43 |
$sql="select * from ".PREFIX."orders_total where orders_id=$id and class='ot_total'"; |
|
44 |
$rs=getAll("shop",$sql,"getBrutto"); |
|
45 |
if ($rs) { |
|
46 |
return $rs[0]["value"]; |
|
47 |
} else { |
|
48 |
return 0; |
|
49 |
} |
|
50 |
} |
|
51 |
|
|
52 |
/********************************************** |
|
53 |
* getMwst($id) |
|
54 |
* |
|
55 |
**********************************************/ |
|
56 |
function getMwst($id) { |
|
57 |
$sql="select * from ".PREFIX."orders_total where orders_id=$id and class='ot_tax'"; |
|
58 |
$rs=getAll("shop",$sql,"getMwst"); |
|
59 |
$mwst=0; |
|
60 |
if ($rs) { |
|
61 |
foreach ($rs as $zeile) { |
|
62 |
$mwst+=$zeile["value"]; |
|
63 |
} |
|
64 |
} |
|
65 |
return $mwst; |
|
66 |
} |
|
67 |
|
|
68 |
/********************************************** |
|
69 |
* getSonderkosten($id,$art) |
|
70 |
* |
|
71 |
**********************************************/ |
|
72 |
function getSonderkosten($id,$art) { |
|
73 |
$sql="select * from ".PREFIX."orders_total where orders_id=$id and class='".$GLOBALS["skosten"][$art]."'"; |
|
74 |
$rs=getAll("shop",$sql,"getSonderkosten"); |
|
75 |
if ($rs[0]["value"]) { |
|
76 |
$kosten=round($rs[0]["value"]/(100+$GLOBALS["versand"]["TAX"])*100,2); |
|
77 |
} else { |
|
78 |
$kosten=false; |
|
79 |
} |
|
80 |
return $kosten; |
|
81 |
} |
|
82 |
|
|
83 |
/********************************************** |
|
84 |
* insBestArtikel($zeile,$transID) |
|
85 |
* |
|
86 |
**********************************************/ |
|
87 |
function insBestArtikel($ordersID,$transID) { |
|
88 |
global $div07,$div16; |
|
89 |
$sql="select * from ".PREFIX."orders_products where orders_id=$ordersID"; |
|
90 |
$rs=getAll("shop",$sql,"insBestArtikel"); |
|
91 |
$ok=true; |
|
92 |
if ($rs) foreach ($rs as $zeile) { |
|
93 |
$sql="select * from parts where partnumber='".$zeile["products_model"]."'"; |
|
94 |
$rs2=getAll("erp",$sql,"insBestArtikel"); |
|
95 |
if ( $rs2[0]["id"]) {$artID=$rs2[0]["id"]; $artNr=$rs2[0]["partnumber"]; } |
|
96 |
else { |
|
97 |
if ($zeile["products_tax"]=="7.0000") { |
|
98 |
$artID=$div07["ID"]; |
|
99 |
$artNr=$div07["NR"]; |
|
100 |
} else { |
|
101 |
$artID=$div16["ID"]; |
|
102 |
$artNr=$div16["NR"]; |
|
103 |
}; |
|
104 |
} |
|
105 |
$preis=round($zeile["products_price"]/(100+$zeile["products_tax"])*100,2); |
|
106 |
$text=getAttribut($ordersID,$zeile["orders_products_id"]); |
|
107 |
$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values ("; |
|
108 |
$sql.=$transID.",".$artID.",'".$zeile["products_name"].$text."',".$zeile["products_quantity"].",".$preis.",'Stck',0,0)"; |
|
109 |
echo " - Artikel:[ BuNr.:$artID ArtNr:<b>$artNr</b> ".$zeile["products_name"]." ]<br>"; |
|
110 |
$rc=query("erp",$sql,"insBestArtikel"); |
|
111 |
if ($rc === -99) { $ok=false; break; }; |
|
112 |
} |
|
113 |
return $ok; |
|
114 |
} |
|
115 |
|
|
116 |
function insAuftrag($data) { |
|
117 |
global $ERPusr,$versand,$nachn,$minder,$paypal,$auftrnr; |
|
118 |
$Zahlmethode=array("authorizenet"=>"Authorize.net","banktransfer"=>"Lastschriftverfahren","cc"=>"Kreditkarte", |
|
119 |
"cod"=>"Nachnahme","eustandardtransfer"=>"EU-Standard Bank Transfer","iclear"=>"iclear Rechnungskauf", |
|
120 |
"invoice"=>"Rechnung","ipayment"=>"iPayment","liberecobanktransfer"=>"Lastschriftverfahren", |
|
121 |
"liberecocc"=>"Kreditkarte","moneybookers"=>"Moneybookers.com","moneyorder"=>"Scheck/Vorkasse", |
|
122 |
"nochex"=>"NOCHEX","paypal"=>"PayPal","pm2checkout"=>"2CheckOut","psigate"=>"PSiGate", |
|
123 |
"qenta"=>"qenta.at","secpay"=>"SECPay"); |
|
124 |
$brutto=getBrutto($data["orders_id"]); |
|
125 |
$mwst=getMwst($data["orders_id"]); |
|
126 |
$netto=$brutto-$mwst; |
|
127 |
$versandK=getSonderkosten($data["orders_id"],"Versand"); |
|
128 |
$nachnK =getSonderkosten($data["orders_id"],"NachName"); |
|
129 |
$mindermK=getSonderkosten($data["orders_id"],"Minder"); |
|
130 |
$paypalK =getSonderkosten($data["orders_id"],"Paypal"); |
|
131 |
// Hier beginnt die Transaktion |
|
132 |
$rc=query("erp","BEGIN","chkKunde"); |
|
133 |
if ($rc === -99) { echo "Probleme mit Datenbank, Abbruch!"; exit(); }; |
|
134 |
if ($auftrnr) { |
|
135 |
$auftrag=$GLOBALS["preA"].getNextAnr(); |
|
136 |
} else { |
|
137 |
$auftrag=$GLOBALS["preA"].$data["orders_id"]; |
|
138 |
} |
|
139 |
$sql="select count(*) as cnt from oe where ordnumber = '$auftrag'"; |
|
140 |
$rs=getAll("erp",$sql,"insAuftrag"); |
|
141 |
if ($rs[0]["cnt"]>0) { |
|
142 |
$auftrag=$GLOBALS["preA"].getNextAnr(); |
|
143 |
} |
|
144 |
$newID=uniqid (rand()); |
|
145 |
$sql="insert into oe (notes,ordnumber,cusordnumber) values ('$newID','$auftrag','".$data["kdnr"]."')"; |
|
146 |
$rc=query("erp",$sql,"insAuftrag"); |
|
147 |
$sql="select * from oe where notes = '$newID'"; |
|
148 |
$rs2=getAll("erp",$sql,"insAuftrag"); |
|
149 |
if ($data["cc_type"]) { |
|
150 |
$BEZAHLEN.=$data["cc_type"]."\n".$data["cc_owner"]."\n".$data["cc_number"]."\n".$data["cc_expires"]."\n"; |
|
151 |
} else { |
|
152 |
$BEZAHLEN=$Zahlmethode[$data["payment_method"]]."\nKontoinhaber: "; |
|
153 |
$BEZAHLEN.=$data["banktransfer_owner"]."\nBanknummer: ".$data["banktransfer_blz"]; |
|
154 |
$BEZAHLEN.="\nKontonummer: ".$data["banktransfer_number"]."\nBank: ".$data["banktransfer_bankname"]."\n"; |
|
155 |
} |
|
156 |
$sql="update oe set cusordnumber=".$data["orders_id"].", transdate='".$data["date_purchased"]."', customer_id=".$data["kdnr"].", "; |
|
157 |
$sql.="amount=".$brutto.", netamount=".$netto.", reqdate='".$data["date_purchased"]."', taxincluded='f', "; |
|
158 |
if ($data["shipto"]>0) $sql.="shipto_id=".$data["shipto"].", "; |
|
159 |
$sql.="intnotes='".$data["comments"]."',notes='".$BEZAHLEN."', curr='EUR',employee_id=".$ERPusr["ID"].", vendor_id=0 "; |
|
160 |
$sql.="where id=".$rs2[0]["id"]; |
|
161 |
$rc=query("erp",$sql,"insAuftrag"); |
|
162 |
if ($rc === -99) { |
|
163 |
echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>"; |
|
164 |
$rc=query("erp","ROLLBACK","chkKunde"); |
|
165 |
return false; |
|
166 |
} |
|
167 |
echo "Auftrag:[ Buchungsnummer:".$rs2[0]["id"]." AuftrNr:<b>".$auftrag."</b> ]<br>"; |
|
168 |
if (!insBestArtikel($data["orders_id"],$rs2[0]["id"])) { |
|
169 |
echo "Auftrag ".$data["orders_id"]." konnte nicht angelegt werden.<br>"; |
|
170 |
$rc=query("erp","ROLLBACK","chkKunde"); |
|
171 |
return false; |
|
172 |
}; |
|
173 |
if ($versandK) { |
|
174 |
$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values ("; |
|
175 |
$sql.=$rs2[0]["id"].",".$versand["ID"].",'".$versand["TXT"]."',1,".$versandK.",'mal',0,0)"; |
|
176 |
$rc=query("erp",$sql,"insAuftrag"); |
|
177 |
if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den Versandkosten<br>"; |
|
178 |
} |
|
179 |
if ($nachnK) { |
|
180 |
$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values ("; |
|
181 |
$sql.=$rs2[0]["id"].",".$nachn["ID"].",'".$nachn["TXT"]."',1,".$nachnK.",'mal',0,0)"; |
|
182 |
$rc=query("erp",$sql,"insAuftrag"); |
|
183 |
if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den Nachnamekosten<br>"; |
|
184 |
} |
|
185 |
if ($mindermK) { |
|
186 |
$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values ("; |
|
187 |
$sql.=$rs2[0]["id"].",".$minder["ID"].",'".$minder["TXT"]."',1,".$mindermK.",'mal',0,0)"; |
|
188 |
$rc=query("erp",$sql,"insAuftrag"); |
|
189 |
if ($rc === -99) echo "Auftrag $auftrag : Fehler beim Mindermengenzuschlag<br>"; |
|
190 |
} |
|
191 |
if ($paypalK) { |
|
192 |
$sql="insert into orderitems (trans_id, parts_id, description, qty, sellprice, unit, ship, discount) values ("; |
|
193 |
$sql.=$rs2[0]["id"].",".$paypal["ID"].",'".$paypal["TXT"]."',1,".$paypalK.",'mal',0,0)"; |
|
194 |
$rc=query("erp",$sql,"insAuftrag"); |
|
195 |
if ($rc === -99) echo "Auftrag $auftrag : Fehler bei den PayPal-Kosten<br>"; |
|
196 |
} |
|
197 |
$rc=query("erp","COMMIT","Auftrag"); |
|
198 |
if ($rc === -99) { |
|
199 |
echo "Probleme mit Datenbank, Abbruch!"; |
|
200 |
exit(); |
|
201 |
} |
|
202 |
$sql="update ".PREFIX."orders set orders_status ='3' WHERE orders_id =".$data["orders_id"]; |
|
203 |
$rc=query("shop",$sql,"insBestArtikel"); |
|
204 |
return true; |
|
205 |
} |
|
206 |
|
|
207 |
/********************************************** |
|
208 |
* getBestellung() |
|
209 |
* |
|
210 |
**********************************************/ |
|
211 |
function getBestellung() { |
|
212 |
$sql="select b.*,h.comments,o.*,cn.kdnr from ".PREFIX."orders o left join ".PREFIX."orders_status_history h on h.orders_id=o.orders_id "; |
|
213 |
$sql.="left join ".PREFIX."banktransfer b on b.orders_id =o.orders_id left join ".PREFIX."customers_number cn on "; |
|
214 |
$sql.="cn.customers_id=o.customers_id where o.orders_status=1 order by o.orders_id"; |
|
215 |
$rs=getAll("shop",$sql,"getBestellung"); |
|
216 |
return $rs; |
|
217 |
} |
|
218 |
|
|
219 |
/********************************************** |
|
220 |
* chkKdData() |
|
221 |
* |
|
222 |
**********************************************/ |
|
223 |
function chkKunden() { |
|
224 |
$felder=array("firstname","lastname","company","street_address","city","postcode","country"); |
|
225 |
foreach ($GLOBALS["bestellungen"] as $bestellung) { |
|
226 |
$rc=query("erp","BEGIN","chkKunde"); |
|
227 |
if ($rc === -99) { echo "Probleme mit Datenbank, Abbruch!"; exit(); }; |
|
228 |
if ($bestellung["kdnr"]>0) { |
|
229 |
$msg="update "; |
|
230 |
$kdnr=chkOldKd($bestellung); |
|
231 |
if ($kdnr == -1) { //Kunde nicht gefunden, neu anlegen. |
|
232 |
$msg="insert "; |
|
233 |
$kdnr=insNewKd($bestellung); |
|
234 |
$GLOBALS["neuKd"]++; |
|
235 |
} |
|
236 |
} else { |
|
237 |
$msg="insert "; |
|
238 |
$kdnr=insNewKd($bestellung); |
|
239 |
$GLOBALS["neuKd"]++; |
|
240 |
} |
|
241 |
echo $bestellung["customers_company"]." ".$bestellung["customers_name"]." $kdnr<br>"; |
|
242 |
$GLOBALS["bestellungen"][$GLOBALS["gesKd"]]["kdnr"]=$kdnr; |
|
243 |
$sql="delete from ".PREFIX."customers_number where customers_id=".$bestellung["customers_id"]; |
|
244 |
$rc=query("shop",$sql,"chkKunde"); |
|
245 |
$sql="insert into ".PREFIX."customers_number (customers_id,kdnr) values(".$bestellung["customers_id"].",".$kdnr.")"; |
|
246 |
$rc=query("shop",$sql,"chkKunde"); |
|
247 |
if ($kdnr>0) { |
|
248 |
foreach($felder as $feld) { |
|
249 |
if ($bestellung["delivery_$feld"]<>$bestellung["customers_$feld"]) { |
|
250 |
$rc=insShData($bestellung,$kdnr); |
|
251 |
if ($rc>0) $GLOBALS["bestellungen"][$GLOBALS["gesKd"]]["shipto"]=$rc; |
|
252 |
break; |
|
253 |
} |
|
254 |
} |
|
255 |
} |
|
256 |
if (!$kdnr || $rc === -99) { |
|
257 |
$rc=query("erp","ROLLBACK","chkKunde"); |
|
258 |
echo $msg." ".$bestellung["customers_name"]." fehlgeschlagen!<br>"; |
|
259 |
return false; |
|
260 |
} else { |
|
261 |
$rc=query("erp","COMMIT","chkKunde"); |
|
262 |
} |
|
263 |
$GLOBALS["gesKd"]++; |
|
264 |
} |
|
265 |
return true; |
|
266 |
} |
|
267 |
|
|
268 |
function chkOldKd($data) { |
|
269 |
$sql="select * from customer where id = ".$data["kdnr"]; |
|
270 |
$rs=getAll("erp",$sql,"chkKdData"); |
|
271 |
if ($rs[0]["id"]<>$data["kdnr"]) { return -1; }; // Kunde nicht gefunden |
|
272 |
if ($rs[0]["zipcode"]<>$data["customers_postcode"]) $set.="zipcode='".$data["customers_postcode"]."',"; |
|
273 |
if ($rs[0]["city"]<>$data["customers_city"]) $set.="city='".$data["customers_city"]."',"; |
|
274 |
if ($rs[0]["country"]<>$GLOBALS["LAND"][$data["customers_country"]]) $set.="land='".$GLOBALS["LAND"][$data["customers_country"]]."',"; |
|
275 |
if ($rs[0]["phone"]<>$data["customers_phone"])$set.="phone='".$data["customers_phone"]."',"; |
|
276 |
if ($rs[0]["email"]<>$data["customers_email_address"])$set.="email='".$data["customers_mail_address"]."',"; |
|
277 |
if ($data["customers_company"]) { |
|
278 |
if ($rs[0]["name"]<>$data["customers_company"]) $set.="set name='".$data["customers_company"]."',"; |
|
279 |
if ($rs[0]["department_1"]<>$data["customers_name"]) $set.="department_1='".$data["customers_name"]."',"; |
|
280 |
} else { |
|
281 |
if ($rs[0]["name"]<>$data["customers_name"]) $set.="name='".$data["customers_name"]."',"; |
|
282 |
} |
|
283 |
if ($rs[0]["street"]<>$data["customers_street_address"]) $set.="street='".$data["customers_street_address"]."',"; |
|
284 |
if ($set) { |
|
285 |
$sql="update customer set ".substr($set,0,-1)." where id=".$rs[0]["id"]; |
|
286 |
$rc=query("erp",$sql,"chkKdData"); |
|
287 |
if ($rc === -99) { |
|
288 |
return false; |
|
289 |
} else { |
|
290 |
return $data["kdnr"]; |
|
291 |
} |
|
292 |
} else { |
|
293 |
return $data["kdnr"]; |
|
294 |
} |
|
295 |
} |
|
296 |
|
|
297 |
/********************************************** |
|
298 |
* insShData($data,$id) |
|
299 |
* |
|
300 |
**********************************************/ |
|
301 |
function insShData($data,$id) { |
|
302 |
$set=$id; |
|
303 |
if ($data["delivery_company"]) { $set.=",'".$data["delivery_company"]."','".$data["delivery_name"]."',"; } |
|
304 |
else { $set.=",'".$data["delivery_name"]."','',"; } |
|
305 |
$set.="'".$data["delivery_street_address"]."',"; |
|
306 |
$set.="'".$data["delivery_postcode"]."',"; |
|
307 |
$set.="'".$data["delivery_city"]."',"; |
|
308 |
$set.="'".$data["delivery_country"]."',"; |
|
309 |
$set.="'".$data["customers_telephone"]."',"; |
|
310 |
$set.="'".$data["customers_email_address"]."'"; |
|
311 |
$sql="insert into shipto (trans_id,shiptoname,shiptodepartment_1,shiptostreet,shiptozipcode,shiptocity,"; |
|
312 |
$sql.="shiptocountry,shiptophone,shiptoemail,module) values ($set,'CT')"; |
|
313 |
$rc=query("erp",$sql,"insShData"); |
|
314 |
if ($rc === -99) return false; |
|
315 |
$sql="select shipto_id from shipto where trans_id = $id and module='CT' order by itime desc limit 1"; |
|
316 |
$rs=getAll("erp",$sql,"insKdData"); |
|
317 |
if ($rs[0]["shipto_id"]>0) { |
|
318 |
$sid=$rs[0]["shipto_id"]; |
|
319 |
$sql="update ".PREFIX."customers_number set shipto = $sid where kdnr = $id"; |
|
320 |
$rc2=query("shop",$sql,"insShData"); |
|
321 |
if ($rc2 === -99) { |
|
322 |
return false; |
|
323 |
} |
|
324 |
} else { |
|
325 |
echo "Fehler bei abweichender Anschrift ".$data["delivery_name"]; |
|
326 |
} |
|
327 |
if ($rc === -99) { |
|
328 |
return false; |
|
329 |
} else { |
|
330 |
return $sid; |
|
331 |
} |
|
332 |
} |
|
333 |
|
|
334 |
/********************************************** |
|
335 |
* insKdData($BID) |
|
336 |
* |
|
337 |
**********************************************/ |
|
338 |
function insNewKd($data) { |
|
339 |
$taxid=array("DE"=>0,"CH"=>2,"AU"=>1,"FR"=>1,"IT"=>1,"ES"=>1,"NL"=>1); // Muß erweitert werden |
|
340 |
$newID=uniqid(rand(time(),1)); |
|
341 |
//Kundennummer generieren |
|
342 |
if ($GLOBALS["kdnum"]==1) { // von der ERP |
|
343 |
$kdnr=$GLOBALS["preK"].getNextKnr(); |
|
344 |
} else { // durch Shop |
|
345 |
$kdnr=$GLOBALS["preK"].$data["customers_id"]; |
|
346 |
} |
|
347 |
$sql="select count(*) as cnt from customer where customernumber = '$kdnr'"; |
|
348 |
$rs=getAll("erp",$sql,"insKdData"); |
|
349 |
if ($rs[0]["cnt"]>0) { // Kundennummer gibt es schon, eine neue aus ERP |
|
350 |
$kdnr=$GLOBALS["preK"].getNextKnr(); |
|
351 |
} |
|
352 |
$sql="insert into customer (name,customernumber) values ('$newID','$kdnr')"; |
|
353 |
$rc=query("erp",$sql,"insKdData"); |
|
354 |
if ($rc === -99) return false; |
|
355 |
$sql="select * from customer where name = '$newID'"; |
|
356 |
$rs=getAll("erp",$sql,"insKdData"); |
|
357 |
if (!$rs) return false; |
|
358 |
if ($data["customers_company"]) { |
|
359 |
$set.="set name='".$data["customers_company"]."',contact='".$data["customers_name"]."',"; |
|
360 |
}else { |
|
361 |
$set.="set name='".$data["customers_lastname"].", ".$data["customers_firstname"]."',"; |
|
362 |
} |
|
363 |
$set.="street='".$data["customers_street_address"]."',"; |
|
364 |
$set.="zipcode='".$data["customers_postcode"]."',"; |
|
365 |
$set.="city='".$data["customers_city"]."',"; |
|
366 |
$set.="country='".$data["billing_country_iso_code_2"]."',"; |
|
367 |
$set.="phone='".$data["customers_telephone"]."',"; |
|
368 |
$set.="email='".$data["customers_email_address"]."',"; |
|
369 |
$tid=(in_array($data["billing_country_iso_code_2"],$taxid))?$taxid[$data["billing_country_iso_code_2"]]:3; |
|
370 |
$set.="taxzone_id=$tid,"; |
|
371 |
$set.="taxincluded='f' "; |
|
372 |
$sql="update customer ".$set; |
|
373 |
$sql.="where id=".$rs[0]["id"]; |
|
374 |
$rc=query("erp",$sql,"insKdData"); |
|
375 |
if ($rc === -99) { return false; } |
|
376 |
else { return $rs[0]["id"]; } |
|
377 |
} |
|
378 |
|
|
379 |
$LAND=array("Germany"=>"D","Austria"=>"A","Switzerland"=>"CH"); |
|
380 |
$skosten=array("Versand"=>"ot_shipping","NachName"=>"ot_cod_fee","Paypal"=>"ot_cod_fee","Minder"=>"ot_loworderfee"); |
|
381 |
$bestellungen=getBestellung(); |
|
382 |
$ok=count($bestellungen); |
|
383 |
$gesKd=0; |
|
384 |
$neuKd=0; |
|
385 |
if ($ok) { |
|
386 |
echo "Es liegen $ok Bestellungen vor. <br>"; |
|
387 |
chkKunden(); |
|
388 |
echo $gesKd." Kunde(n), davon ".$neuKd." neue(r) Kunde(n).<br>"; |
|
389 |
foreach ($bestellungen as $bestellung) { |
|
390 |
$ok=insAuftrag($bestellung); |
|
391 |
} |
|
392 |
} else { echo "Es liegen keine Bestellungen vor!<br>"; }; |
|
393 |
?> |
|
394 |
<!--a href='trans.php'>zurück</a--> |
|
395 |
</body> |
|
396 |
</html> |
olcom/readme.first | ||
---|---|---|
1 |
Shop - Schnittstelle Lx-ERP <-> osCommerce/xt:Commerce |
|
2 |
|
|
3 |
Vorraussetzungen: |
|
4 |
Lx-ERP Version >= 2.4.0 |
|
5 |
xt:Commerce 2.0 RC1.2 |
|
6 |
Pear DB, PHP-ImageMagick |
|
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/xtcomm.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/xtcomm/confedit.php |
|
24 |
|
|
25 |
z.B.: http://localhost/xtcomm/confedit.php |
|
26 |
|
|
27 |
Benutzer und Kennwort f?r die Erstinstallation sind: |
|
28 |
|
|
29 |
xtcom / xtcom |
|
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 |
|
37 |
CSV-Dir hier wird die csv-Datei erwartet (Schreibrechte!) |
|
38 |
Image-Dir hier liegen die Bilder |
|
39 |
ftp-Host Webserver der jeweiligen Anwendung |
|
40 |
ftp-User Name und Kennwort f?r ftp-Zugang |
|
41 |
ID-xxxx Interne ID der Waren. Lx-ERP: |
|
42 |
Shopsprache Die Id der Voreingestellten Sprache. Nur f?r diese |
|
43 |
werden die Artikel eingestellt. |
|
44 |
Bildergr??e in Byte |
|
45 |
|
|
46 |
Das Formular abschicken. |
|
47 |
|
|
48 |
Sollen sp?ter ?nderungen durchgef?hrt werden, so mu? bei der Anmeldung |
|
49 |
der ERP-ftp-User als Benutzer verwendet werden. |
|
50 |
|
|
51 |
In der Shopinstanz mu? noch eine Tabelle angelegt werden. Das wird |
|
52 |
normalerweise durch das Programm condedit.php erledigt. Sollte das aus |
|
53 |
irgend einem Grund nicht funktionieren, f?hren Sie dazu die |
|
54 |
Datei oscom.sql als Datenbankbenutzer auf die Shopinstanz aus. |
|
55 |
|
|
56 |
$ mysql -p -u dbuser dbinstanz < xtcom.sql |
|
57 |
Enter password: |
|
58 |
|
|
59 |
Ist diese Tabelle nicht angelegt, werden Kunden in der ERP immer wieder neu |
|
60 |
angelegt. |
|
61 |
|
|
62 |
Fehlerquellen: |
|
63 |
Befinden sich ERP und Shop nicht auf dem gleichen Server, achten Sie darauf, das |
|
64 |
die entsprechende Datenbank von Aussen erreichbar ist. Dazu m?ssen folgende Ports |
|
65 |
freigeschaltet werden: |
|
66 |
|
|
67 |
MySQL 3306 |
|
68 |
PostgreSQL 5432 |
|
69 |
|
|
70 |
Auch mu? auf dem Shopserver ein ftp-Dienst eingerichtet werden, wenn Bilder ?ber- |
|
71 |
tragen werden sollen. Die Firewal ist entsprechend anzupassen. |
|
72 |
|
|
73 |
Arbeiten: |
|
74 |
In der ERP kann nun bei den Artikeln das H?ckchen Shop gesetzt werden. |
|
75 |
Bitte auch eine Warengruppe vergeben, da sonst alle Artikel in Default landen. |
|
76 |
Da die ERP nur eine Kategorieebene verwalten kann, mu? der ganze Kategorienpfad |
|
77 |
hintelegt werden. Die einzelnen Kategorien werden durch Ausrufezeichen (!) getrennt. |
|
78 |
|
|
79 |
Hardware -> Monitore -> LCD = Hardware!Monitore!LCD |
|
80 |
|
|
81 |
Die URL f?r die Shopschnittstelle lautet: |
|
82 |
|
Auch abrufbar als: Unified diff
Wird nicht mehr weiterentwickelt / gepflegt. Funktion fraglich.
Evtl. Nachfolgeprojekt auf Basis der neuen PHPeppershop-Schnittstelle.