PageRenderTime 59ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 0ms

/extra addons/extra addons/extra-trunk/esale_osc/connector/openerp-synchro.php

http://hornerp.googlecode.com/
PHP | 979 lines | 865 code | 35 blank | 79 comment | 43 complexity | bf57f6c9fde47719469704aeb49584da MD5 | raw file
Possible License(s): MIT, MPL-2.0-no-copyleft-exception, GPL-2.0, GPL-3.0
  1. <?php
  2. /*# -*- encoding: utf-8 -*-
  3. ##############################################################################
  4. #
  5. # OpenERP, Open Source Management Solution
  6. # Copyright (c) 2008 Zikzakmedia S.L. (http://zikzakmedia.com) All Rights Reserved.
  7. # Jordi Esteve <jesteve@zikzakmedia.com>
  8. # $Id$
  9. #
  10. # This program is free software: you can redistribute it and/or modify
  11. # it under the terms of the GNU General Public License as published by
  12. # the Free Software Foundation, either version 3 of the License, or
  13. # (at your option) any later version.
  14. #
  15. # This program is distributed in the hope that it will be useful,
  16. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. # GNU General Public License for more details.
  19. #
  20. # You should have received a copy of the GNU General Public License
  21. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. #
  23. ##############################################################################*/
  24. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  25. //////////////////////// ////////////////////
  26. //////////////////////// PLEASE CONFIGURE THE RIGHT INCLUDES FOR YOUR CONFIGURATION ////////////////////
  27. include("xmlrpcutils/xmlrpc.inc");
  28. include("xmlrpcutils/xmlrpcs.inc");
  29. include("../../includes/configure.php");
  30. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  31. $con = mysql_pconnect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD);
  32. mysql_select_db(DB_DATABASE);
  33. function debug($s) {
  34. $fp = fopen("../../temp/debug.xmlrpc.txt","a");
  35. fwrite($fp, $s."\n");
  36. fclose($fp);
  37. }
  38. function fixEncoding($in_str) {
  39. // $arr = array(
  40. // "Ăą" => "ń",
  41. // "ĂŠ" => "e",
  42. // "ĂĄ" => "a",
  43. // "Ăł" => "o",
  44. // "Ăş" => "u",
  45. // "Ú" => "u",
  46. // "Ó" => "o",
  47. // "Ă&shy;"=> "i",
  48. // "ş" => " ",
  49. // "Âş" => ".",
  50. // "ÂŞ" => ".",
  51. // "°" => ".",
  52. // "¡" => ".",
  53. // "Ă­-" => "i",
  54. // "è" => "e",
  55. // "Ă" => "i"
  56. // );
  57. $arrfrom = array("Ăą","ĂŠ","ĂĄ","Ăł","Ăş","Ú","Ó","Ă&shy;","ş" ,"Âş","ÂŞ","°","¡","Ă­-", "è","Ă");
  58. $arrto = array( "ń" ,"e" , "a","a" , "o", "u", "u", "o" , "i", " ", ".", ".", ".", ".", "i", "e");
  59. $cur_encoding = mb_detect_encoding($in_str);
  60. if($cur_encoding == "UTF-8" && mb_check_encoding($in_str,"UTF-8")) {
  61. return str_replace($arrFrom, $arrTo, $in_str);
  62. } else {
  63. fwrite($f,'Sin Encoding UTF-8 en else: ' . str_replace($arrFrom, $arrTo, $in_str) ."\n");
  64. // return utf8_encode(str_replace($arrFrom, $arrTo, $in_str)); // Use this sentence if your server is WINDOWS
  65. return str_replace($arrFrom, $arrTo, $in_str);
  66. }
  67. fclose($f);
  68. } // fixEncoding
  69. function debug_arr($para_arr,$tab='') {
  70. if (is_array($para_arr)) {
  71. foreach($para_arr as $key=>$values) {
  72. debug($tab.'Key :'.$key.' Value :'.$values);
  73. /*
  74. if (is_array($values)) {
  75. $tab.='\t';
  76. debug_arr($values,$tab);
  77. }*/
  78. }
  79. }
  80. }
  81. function get_taxes() {
  82. $taxes = array();
  83. $result = mysql_query("select tax_class_id, tax_class_title from tax_class;");
  84. if ($result) while ($row = mysql_fetch_row($result)) {
  85. $taxes[] = new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval($row[1], "string")), "array");
  86. }
  87. return new xmlrpcresp( new xmlrpcval($taxes, "array"));
  88. }
  89. function get_languages() {
  90. $languages = array();
  91. $result = mysql_query("select languages_id, name from languages;");
  92. if ($result) while ($row = mysql_fetch_row($result)) {
  93. $languages[] = new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval($row[1], "string")), "array");
  94. }
  95. return new xmlrpcresp(new xmlrpcval($languages, "array"));
  96. }
  97. function get_categories() {
  98. $categories = array();
  99. $result = mysql_query("select categories_id, min(language_id) from categories_description group by categories_id;");
  100. if ($result) while ($row = mysql_fetch_row($result)) {
  101. $resultb = mysql_query("select categories_id, categories_name from categories_description where categories_id=".$row[0]." and language_id=".$row[1].";");
  102. if ($resultb and $row = mysql_fetch_row($resultb)) {
  103. $categories[] = new xmlrpcval(array(new xmlrpcval($row[0], "int"), new xmlrpcval(parent_category($row[0],$row[1]), "string")), "array");
  104. }
  105. }
  106. return new xmlrpcresp( new xmlrpcval($categories, "array"));
  107. }
  108. function get_categories_parent($languages) {
  109. $categories = array();
  110. $lang_ids = "";
  111. foreach ($languages as $lang)
  112. $lang_ids = $lang.", ";
  113. $lang_ids = substr($lang_ids, 0, strlen($lang_ids)-2);
  114. $result = mysql_query("select categories_id, parent_id from categories order by parent_id;");
  115. if ($result) while ($row = mysql_fetch_row($result)) {
  116. //debug('Category: ' . $row[0].'-'. $row[1]);
  117. $cat = array(new xmlrpcval($row[0], "int"), new xmlrpcval($row[1], "int"));
  118. $resultlang = mysql_query("select categories_id, categories_name from categories_description where categories_id=".$row[0]." and language_id in ($lang_ids);");
  119. if ($resultlang) while ($rowl = mysql_fetch_row($resultlang)) {
  120. //debug('Category language: ' .$rowl[1]);
  121. $cat[] = new xmlrpcval($rowl[1], "string");
  122. }
  123. $categories[] = new xmlrpcval($cat, "array");
  124. }
  125. return new xmlrpcresp(new xmlrpcval($categories, "array"));
  126. }
  127. function get_products($languages, $mini, $maxi) {
  128. $products = array();
  129. $prod = array();
  130. $prod_desc = array();
  131. $row_product = array();
  132. $products_description_str = "";
  133. $products_url_str = "";
  134. $row_manuf = array();
  135. $manufacturers_name = "";
  136. $manuf_url = array();
  137. $manufacturers_url = "";
  138. $lang_ids = implode(", ", $languages);
  139. //debug('Languages ids = '.$lang_ids);
  140. $result = mysql_query("select products_id,
  141. products_quantity,
  142. products_model,
  143. products_image,
  144. products_price,
  145. products_date_added,
  146. products_last_modified,
  147. products_date_available,
  148. products_weight,
  149. products_status,
  150. products_tax_class_id,
  151. manufacturers_id
  152. from products where products_id >= " . $mini . " and products_id <= " . $maxi . " order by products_id;");
  153. //debug('IF-WHILE-get_products');
  154. if ($result) while ($row_product = mysql_fetch_row($result)) {
  155. $resultcateg = mysql_query("select min(categories_id) from products_to_categories
  156. where products_id=".$row_product[0]." group by products_id;");
  157. if ($resultcateg) {
  158. $row = mysql_fetch_row($resultcateg);
  159. $prod_cat = $row[0];
  160. //debug('Product Category: ' .$prod_cat);
  161. }
  162. //Get product's manufacturer name
  163. if ($row_product[11] > 0){
  164. $resultmanuf = mysql_query("select manufacturers_name from manufacturers where manufacturers_id = ".$row_product[11].";");
  165. if ($resultmanuf){
  166. $row_manuf = mysql_fetch_row($resultmanuf);
  167. if (strlen($row_manuf[0]) > 0)
  168. $manufacturers_name = $row_manuf[0];
  169. else
  170. $manufacturers_name = "";
  171. }
  172. //Get product's manufacturer url on each language
  173. $manuf_url = array();
  174. $resultmanuflang = mysql_query("select manufacturers_url, languages_id
  175. from manufacturers_info where manufacturers_id = ".$row_product[11]." and languages_id in (".$lang_ids.");");
  176. if ($resultmanuflang) while ($row_manuflang = mysql_fetch_row($resultmanuflang)) {
  177. if (strlen($row_manuflang[0]) == 0)
  178. $manufacturers_url = "";
  179. else
  180. $manufacturers_url = $row_manuflang[0];
  181. $manuf_url[] = new xmlrpcval(array(
  182. "languages_id" => new xmlrpcval($row_manuflang[1],"int"),
  183. "manufacturers_url" => new xmlrpcval($manufacturers_url,"string"),
  184. ), "struct");
  185. }
  186. } else {
  187. $manufacturers_name = "";
  188. $manuf_url = array();
  189. }
  190. $prod = new xmlrpcval(array(
  191. "products_id" => new xmlrpcval($row_product[0],"int"),
  192. "products_quantity" => new xmlrpcval($row_product[1],"int"),
  193. "products_model" => new xmlrpcval(fixEncoding($row_product[2]),"string"),
  194. "products_image" => new xmlrpcval(fixEncoding($row_product[3]),"string"),
  195. "products_price" => new xmlrpcval(fixEncoding($row_product[4]),"string"),
  196. "products_date_added" => new xmlrpcval(fixEncoding($row_product[5]),"string"),
  197. "products_last_modified" => new xmlrpcval(fixEncoding($row_product[6]),"string"),
  198. "products_date_available" => new xmlrpcval(fixEncoding($row_product[7]),"string"),
  199. "products_weight" => new xmlrpcval(fixEncoding($row_product[8]),"string"),
  200. "products_status" => new xmlrpcval($row_product[9],"int"),
  201. "products_tax_class_id" => new xmlrpcval($row_product[10],"int"),
  202. "manufacturers_name" => new xmlrpcval(fixEncoding($manufacturers_name),"string"),
  203. "categ_id" => new xmlrpcval($prod_cat,"int")), "struct");
  204. //debug('Product_id: ' . $row_product[0] . '-IMG:' .$row_product[3]. '-CAT:' . $prod_cat);
  205. // Get product information in different languages
  206. $prod_desc = array();
  207. $resultlang = mysql_query("select products_id,
  208. language_id,
  209. products_name,
  210. products_description,
  211. products_url,
  212. products_viewed
  213. from products_description where products_id=".$row_product[0]." and language_id in (".$lang_ids.");");
  214. if ($resultlang) while ($row_desc = mysql_fetch_row($resultlang)) {
  215. /* if (strlen($row_desc[3] == 0))
  216. $products_description_str = "";
  217. else
  218. $products_description_str = $row_desc[3];
  219. if (strlen($row_desc[4] == 0))
  220. $products_url_str = "";
  221. else
  222. $products_url_str = $row_desc[4];
  223. */
  224. $prod_desc[] = new xmlrpcval(array(
  225. //"products_id" => new xmlrpcval($row_desc[0],"int"),
  226. "language_id" => new xmlrpcval($row_desc[1],"int"),
  227. "products_name" => new xmlrpcval(fixEncoding($row_desc[2]),"string"),
  228. "products_description" => new xmlrpcval(fixEncoding($row_desc[3]),"string"),
  229. "products_url" => new xmlrpcval(fixEncoding($row_desc[4]),"string"),
  230. "products_viewed" => new xmlrpcval(fixEncoding($row_desc[5]),"string"),
  231. //debug('Product_id: ' . $row_desc[0] . 'language_id: ' . $row_desc[1] . 'products_name: ' . $row_desc[2]);
  232. }
  233. // Get product discounts
  234. $prod_spec = new xmlrpcval(array(), "struct"); // If product has not any discount
  235. $resultspec = mysql_query("select specials_new_products_price,
  236. specials_date_added,
  237. specials_last_modified,
  238. expires_date,
  239. date_status_change,
  240. status
  241. from specials where products_id=". $row_product[0] .
  242. " and specials_date_added =
  243. (select max(specials_date_added) from specials where products_id=". $row_product[0] . ");");
  244. if ($resultspec) {
  245. $rowesp = mysql_fetch_row($resultspec);
  246. //debug('Product specials: ' . $rowesp[0] . " " . $rowesp[3]);
  247. $prod_spec = new xmlrpcval(array(
  248. "specials_new_products_price" => new xmlrpcval($rowesp[0],"string"),
  249. //"specials_date_added" => new xmlrpcval($rowesp[1],"string"),
  250. //"specials_last_modified" => new xmlrpcval($rowesp[2],"string"),
  251. "expires_date" => new xmlrpcval($rowesp[3],"string"),
  252. //"date_status_change" => new xmlrpcval($rowesp[4],"string"),
  253. "status" => new xmlrpcval($rowesp[5],"int")), "struct");
  254. }
  255. $products[] = new xmlrpcval(array(
  256. 'product' => $prod,
  257. 'product_description' => new xmlrpcval($prod_desc, "array"),
  258. 'product_special' => $prod_spec,
  259. 'manufacturers_url' => new xmlrpcval($manuf_url, "array"),
  260. ), "struct");
  261. }
  262. //debug('END-IF-WHILE-get_products');
  263. return new xmlrpcresp(new xmlrpcval($products, "array"));
  264. }
  265. function get_payment_methods() {
  266. $payment_methods = array();
  267. $result_modules = mysql_query("SELECT configuration_value FROM configuration WHERE (configuration_key = 'MODULE_PAYMENT_INSTALLED');");
  268. if ($result_modules && $row_modules=mysql_fetch_row($result_modules)) {
  269. $modules = explode(';', $row_modules[0]);
  270. }
  271. reset($modules);
  272. while (list($key, $value) = each($modules)) {
  273. include("../../includes/modules/payment/".$value);
  274. include("../../includes/languages/espanol/modules/payment/".$value);
  275. $class = substr($value, 0, strrpos($value, '.'));
  276. $obj = new $class();
  277. $payment_methods[] = new xmlrpcval(array(new xmlrpcval($key, "int"), new xmlrpcval(fixEncoding($obj->title), "string")), "array");
  278. }
  279. return new xmlrpcresp( new xmlrpcval($payment_methods, "array"));
  280. }
  281. function search_payment_method($payment_name) {
  282. $languages = array();
  283. $result_modules = mysql_query("SELECT configuration_value FROM configuration WHERE (configuration_key = 'MODULE_PAYMENT_INSTALLED');");
  284. if ($result_modules && $row_modules = mysql_fetch_row($result_modules)) {
  285. $modules = explode(';', $row_modules[0]);
  286. }
  287. $result=mysql_query("select directory from languages;");
  288. if ($result) while ($row=mysql_fetch_row($result)) {
  289. $languages[] = $row[0];
  290. }
  291. reset($modules);
  292. while (list($key, $value) = each($modules)) {
  293. foreach ($languages as $lang) {
  294. $title = "";
  295. // We must extract the payment method name from the translation file of the payment module
  296. // We search lines containing the TEXT_TITLE constant like: define('MODULE_PAYMENT_COD_TEXT_TITLE', 'Cash on Delivery');
  297. $gestor = @fopen("../../includes/languages/$lang/modules/payment/$value", "r");
  298. if ($gestor) {
  299. while (!feof($gestor) and $title=="") {
  300. // Read translation file line by line
  301. $pieces = explode("'", fgets($gestor));
  302. if (strpos($pieces[1], "TEXT_TITLE")) {
  303. $title = $pieces[3];
  304. }
  305. }
  306. fclose ($gestor);
  307. }
  308. if ($title == $payment_name) {
  309. return $key;
  310. }
  311. }
  312. }
  313. return 0;
  314. }
  315. function parent_category($id, $name) {
  316. $result = mysql_query("select parent_id from categories where categories_id=".$id.";");
  317. if ($result && $row = mysql_fetch_row($result)) {
  318. if ($row[0] == 0) {
  319. return $name;
  320. } else {
  321. $resultb = mysql_query("select min(language_id) from categories_description where categories_id=".$row[0].";");
  322. if ($resultb && $rowb=mysql_fetch_row($resultb)) {
  323. $resultb = mysql_query("select categories_name from categories_description where categories_id=".$row[0]." and language_id=".$rowb[0].";\n");
  324. if ($resultb && $rowb=mysql_fetch_row($resultb)) {
  325. $name = parent_category($row[0], $rowb[0] . " \\ ". $name);
  326. return $name;
  327. }
  328. }
  329. }
  330. }
  331. return $name;
  332. }
  333. function set_product_stock($tiny_product) {
  334. mysql_query("update products set products_quantity=".$tiny_product['quantity']." where products_id=".$tiny_product['product_id'].";");
  335. mysql_query("update products set products_status=".(($tiny_product['quantity']>0)?1:0)." where products_id=".$tiny_product['product_id'].";");
  336. return new xmlrpcresp(new xmlrpcval(0,"int"));
  337. }
  338. function set_product_manufacturer($tiny_product) {
  339. $oscom_id = 0;
  340. if(array_key_exists('manufacturers_name',$tiny_product)) {
  341. $result = mysql_query("select l.languages_id from languages as l ,configuration as c where
  342. c.configuration_key='DEFAULT_LANGUAGE' and c.configuration_value=l.code;");
  343. if ($result && $row = mysql_fetch_row($result)) {
  344. $lang_id = $row[0];
  345. }
  346. $result = mysql_query("select manufacturers_id from manufacturers where (manufacturers_name='".$tiny_product['manufacturers_name']."');");
  347. if ($result && $row = mysql_fetch_row($result)) {
  348. $id_exist = 1;
  349. $oscom_id = $row[0];
  350. }
  351. if ($id_exist == 0) {
  352. mysql_query("insert into manufacturers (manufacturers_name, date_added) values ('".$tiny_product['manufacturers_name']."', now());");
  353. $oscom_id = mysql_insert_id();
  354. mysql_query("insert into manufacturers_info (manufacturers_id, languages_id,manufacturers_url) values (".$oscom_id.",".$lang_id.",'".$tiny_product['manufacturers_url']."');");
  355. foreach ($tiny_product['manufacturer_langs'] as $lang=>$values){
  356. mysql_query("insert into manufacturers_info (manufacturers_id, languages_id,manufacturers_url) values (".$oscom_id.",".$lang.",'".$values['manufacturers_url']."');");
  357. }
  358. } else {
  359. mysql_query("update manufacturers_info set manufacturers_url='".$tiny_product['manufacturers_url']."' where manufacturers_id=".$oscom_id." and languages_id=".$lang_id.";");
  360. foreach ($tiny_product['manufacturer_langs'] as $lang=>$values){
  361. mysql_query("delete from manufacturers_info where manufacturers_id=".$oscom_id." and languages_id=".$lang.";");
  362. mysql_query("insert into manufacturers_info (manufacturers_id, languages_id,manufacturers_url) values (".$oscom_id.",".$lang.",'".$values['manufacturers_url']."');");
  363. }
  364. }
  365. }
  366. return $oscom_id;
  367. }
  368. function remove_product($tiny_product) {
  369. if (array_key_exists('oscom_product_ids',$tiny_product)) {
  370. $i = 0;
  371. foreach($tiny_product['oscom_product_ids'] as $key=>$values) {
  372. if($i == 0) {
  373. $a .= $values;
  374. } else {
  375. $a .= ",".$values;
  376. }
  377. $i = $i + 1;
  378. }
  379. foreach(array('_description','_to_categories','') as $key) {
  380. mysql_query("delete from products".$key." where products_id in (".$a.");");
  381. }
  382. }
  383. return new xmlrpcresp(new xmlrpcval(1, "int"));
  384. }
  385. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  386. function del_spe_price($tiny_val) {
  387. mysql_query("delete from specials where products_id = ".$tiny_val.";");
  388. return new xmlrpcresp(new xmlrpcval(1, "int"));
  389. }
  390. //////////////////////////////////////////////////////////////////////////////////////////////////////////
  391. function set_product_spe($tiny_product) {
  392. $lang_id = 1;
  393. $id_exist = 0;
  394. ////////Check for existance of product_id ///////////
  395. $result = mysql_query("select products_id from products where (products_id=".$tiny_product['product_id'].");");
  396. if ($result && $row=mysql_fetch_row($result)) {
  397. $id_exist = 1;
  398. }
  399. $result = mysql_query("select l.languages_id from languages as l configuration as c where c.configuration_key='DEFAULT_LANGUAGE' and c.configuration_value = l.code;");
  400. if ($result && $row = mysql_fetch_row($result)) {
  401. $lang_id = $row[0];
  402. }
  403. //if ($tiny_product['quantity']>0) {
  404. // $tiny_product['status']=1;
  405. //} else {
  406. // $tiny_product['status']=0;
  407. //}
  408. $manufacturers_id = set_product_manufacturer($tiny_product);
  409. if ($id_exist == 0) {
  410. mysql_query("insert into products (products_quantity, products_model, products_price, products_weight, products_tax_class_id, products_status, manufacturers_id, products_date_added) values (".$tiny_product['quantity'].", '". $tiny_product['model']."', ".$tiny_product['price'].", ".$tiny_product['weight'].", ".$tiny_product['tax_class_id'].", ".$tiny_product['status'].", ".$manufacturers_id.", now());");
  411. $oscom_id = mysql_insert_id();
  412. if ( $tiny_product['date_available'] != 'NULL') {
  413. mysql_query("update products set products_date_available='".$tiny_product['date_available']."' where products_id=".$oscom_id.";");
  414. }
  415. mysql_query("insert into specials (products_id, specials_new_products_price, specials_date_added, date_status_change, status) values (".$oscom_id.",".$tiny_product['spe_price'].",now(),now(),".$tiny_product['spe_price_status'].");");
  416. if ( $tiny_product['exp_date'] != 'NULL') {
  417. mysql_query("update specials set expires_date='".$tiny_product['exp_date']."' where products_id=".$oscom_id.";");
  418. }
  419. mysql_query("insert into products_description (products_id, language_id, products_name, products_description, products_url) values (".$oscom_id.", ".$lang_id.", '".$tiny_product['name']."', '".$tiny_product['description']."', '".$tiny_product['url']."');");
  420. mysql_query("insert into products_to_categories (categories_id, products_id) values(".$tiny_product['category_id'].",".$oscom_id.");");
  421. foreach ($tiny_product['langs'] as $lang=>$values) {
  422. mysql_query("insert into products_description(products_id, language_id, products_name, products_description, products_url)
  423. values (".$oscom_id.", ".$lang.", '".$values['name']."', '".$values['description']."', '".$values['url']."');");
  424. }
  425. } else {
  426. $oscom_id = $tiny_product['product_id'];
  427. foreach (array('quantity', 'price', 'weight', 'tax_class_id', 'status', 'date_available') as $key) {
  428. if ($key == 'date_available' and $tiny_product[$key] != 'NULL') {
  429. mysql_query("update products set products_".$key."='".$tiny_product[$key]."' where products_id=".$oscom_id.";");
  430. } else {
  431. mysql_query("update products set products_".$key."=".$tiny_product[$key]." where products_id=".$oscom_id.";");
  432. }
  433. }
  434. mysql_query("delete from specials where products_id=".$oscom_id.";");
  435. mysql_query("insert into specials (products_id, specials_new_products_price, specials_date_added, date_status_change, status) values (".$oscom_id.",".$tiny_product['spe_price'].",now(),now(),".$tiny_product['spe_price_status'].");");
  436. if ( $tiny_product['exp_date'] != 'NULL') {
  437. mysql_query("update specials set expires_date='".$tiny_product['exp_date']."' where products_id=".$oscom_id.";");
  438. }
  439. mysql_query("update products set products_model='".$tiny_product['model']."', manufacturers_id=".$manufacturers_id." where products_id=".$oscom_id.";");
  440. foreach (array('name', 'description','url') as $key) {
  441. mysql_query("update products_description set products_".$key."='".$tiny_product[$key]."' where products_id=".$oscom_id." and language_id=".$lang_id.";");
  442. }
  443. mysql_query("update products_to_categories set categories_id=".$tiny_product['category_id']." where products_id=".$oscom_id.";");
  444. foreach ($tiny_product['langs'] as $lang=>$values) {
  445. mysql_query("delete from products_description where products_id=".$oscom_id." and language_id=".$lang.";");
  446. mysql_query("insert into products_description(products_id, language_id, products_name, products_description, products_url)
  447. values (".$oscom_id.", ".$lang.", '".$values['name']."', '".$values['description']."', '".$values['url']."');");
  448. }
  449. }
  450. $cpt = 0;
  451. if ($tiny_product['haspic']==1) {
  452. if (file_exists('../../images/'.$cpt.'-'.$tiny_product['fname'])) {
  453. unlink('../../images/'.$cpt.'-'.$tiny_product['fname']); // DELETE THE EXISTING IMAGES
  454. }
  455. if ($hd = fopen('../../images/'.$cpt.'-'.$tiny_product['fname'], "w")) {
  456. fwrite($hd, base64_decode($tiny_product['picture']));
  457. fclose($hd);
  458. mysql_query("update products set products_image='".$cpt."-".$tiny_product['fname']."' where products_id=".$oscom_id.";");
  459. }
  460. } else if ($tiny_product['haspic']==2) {
  461. if (file_exists('../../images/'.$cpt.'-'.$tiny_product['fname'])) {
  462. unlink('../../images/'.$cpt.'-'.$tiny_product['fname']); // DELETE THE EXISTING IMAGES
  463. }
  464. mysql_query("update products set products_image='".$tiny_product['fname']."' where products_id=".$oscom_id.";");
  465. } else {
  466. mysql_query("update products set products_image=NULL where products_id=".$oscom_id.";");
  467. }
  468. return new xmlrpcresp(new xmlrpcval($oscom_id, "int"));
  469. }
  470. ////////////////////////////////////////////////////////////////////////////////////////////////////
  471. function set_product_classical($tiny_product) {
  472. $lang_id = 1;
  473. $id_exist = 0;
  474. ////////Check for existance of product_id ///////////
  475. $result = mysql_query("select products_id from products where (products_id=".$tiny_product['product_id'].");");
  476. if ($result && $row=mysql_fetch_row($result)) {
  477. $id_exist = 1;
  478. }
  479. $result = mysql_query("select l.languages_id from languages as l configuration as c where c.configuration_key='DEFAULT_LANGUAGE' and c.configuration_value=l.code;");
  480. if ($result && $row = mysql_fetch_row($result)) {
  481. $lang_id = $row[0];
  482. }
  483. //if ($tiny_product['quantity']>0) {
  484. // $tiny_product['status']=1;
  485. //} else {
  486. // $tiny_product['status']=0;
  487. //}
  488. $manufacturers_id = set_product_manufacturer($tiny_product);
  489. if ($id_exist == 0) {
  490. mysql_query("insert into products (products_quantity, products_model, products_price, products_weight, products_tax_class_id, products_status, manufacturers_id, products_date_added) values (".$tiny_product['quantity'].", '". $tiny_product['model']."', ".$tiny_product['price'].", ".$tiny_product['weight'].", ".$tiny_product['tax_class_id'].", ".$tiny_product['status'].", ".$manufacturers_id.", now());");
  491. $oscom_id = mysql_insert_id();
  492. if ( $tiny_product['date_available'] != 'NULL') {
  493. mysql_query("update products set products_date_available='".$tiny_product['date_available']."' where products_id=".$oscom_id.";");
  494. }
  495. mysql_query("insert into products_description (products_id, language_id, products_name, products_description, products_url) values (".$oscom_id.", ".$lang_id.", '".$tiny_product['name']."', '".$tiny_product['description']."', '".$tiny_product['url']."');");
  496. mysql_query("insert into products_to_categories (categories_id, products_id) values(".$tiny_product['category_id'].",".$oscom_id.");");
  497. foreach ($tiny_product['langs'] as $lang=>$values) {
  498. mysql_query("insert into products_description(products_id, language_id, products_name, products_description, products_url)
  499. values (".$oscom_id.", ".$lang.", '".$values['name']."', '".$values['description']."', '".$values['url']."');");
  500. }
  501. } else {
  502. $oscom_id = $tiny_product['product_id'];
  503. foreach (array('quantity', 'price', 'weight', 'tax_class_id', 'status', 'date_available') as $key) {
  504. if ($key == 'date_available' and $tiny_product[$key] != 'NULL') {
  505. mysql_query("update products set products_".$key."='".$tiny_product[$key]."' where products_id=".$oscom_id.";");
  506. } else {
  507. mysql_query("update products set products_".$key."=".$tiny_product[$key]." where products_id=".$oscom_id.";");
  508. }
  509. }
  510. mysql_query("update products set products_model='".$tiny_product['model']."', manufacturers_id=".$manufacturers_id." where products_id=".$oscom_id.";");
  511. foreach (array('name', 'description','url') as $key) {
  512. mysql_query("update products_description set products_".$key."='".$tiny_product[$key]."' where products_id=".$oscom_id." and language_id=".$lang_id.";");
  513. }
  514. mysql_query("update products_to_categories set categories_id=".$tiny_product['category_id']." where products_id=".$oscom_id.";");
  515. foreach ($tiny_product['langs'] as $lang=>$values) {
  516. mysql_query("delete from products_description where products_id=".$oscom_id." and language_id=".$lang.";");
  517. mysql_query("insert into products_description(products_id, language_id, products_name, products_description, products_url)
  518. values (".$oscom_id.", ".$lang.", '".$values['name']."', '".$values['description']."', '".$values['url']."');");
  519. }
  520. }
  521. $cpt = 0;
  522. if ($tiny_product['haspic']==1) {
  523. if (file_exists('../../images/'.$cpt.'-'.$tiny_product['fname'])) {
  524. unlink('../../images/'.$cpt.'-'.$tiny_product['fname']); // DELETE THE EXISTING IMAGES
  525. }
  526. if ($hd=fopen('../../images/'.$cpt.'-'.$tiny_product['fname'], "w")){
  527. fwrite($hd, base64_decode($tiny_product['picture']));
  528. fclose($hd);
  529. mysql_query("update products set products_image='".$cpt."-".$tiny_product['fname']."' where products_id=".$oscom_id.";");
  530. }
  531. } else if ($tiny_product['haspic']==2) {
  532. if (file_exists('../../images/'.$cpt.'-'.$tiny_product['fname'])) {
  533. unlink('../../images/'.$cpt.'-'.$tiny_product['fname']); // DELETE THE EXISTING IMAGES
  534. }
  535. mysql_query("update products set products_image='".$tiny_product['fname']."' where products_id=".$oscom_id.";");
  536. } else {
  537. mysql_query("update products set products_image=NULL where products_id=".$oscom_id.";");
  538. }
  539. return new xmlrpcresp(new xmlrpcval($oscom_id, "int"));
  540. }
  541. function get_partner_address($address_condition, $email="", $phone="", $fax="") {
  542. $addresses = array();
  543. $query = "SELECT address_book_id,CONCAT(entry_firstname,' ',entry_lastname) as name, entry_street_address, entry_suburb, entry_postcode, entry_city, entry_state, entry_country_id, entry_zone_id FROM address_book";
  544. if (is_array($address_condition)) {
  545. $where = " where ";
  546. $flag = true;
  547. foreach($address_condition as $key=>$values) {
  548. if ($flag) {
  549. if (!is_numeric($values)) {
  550. $where.=$key."='".str_replace("'", "''", $values)."'";
  551. } else {
  552. $where.=$key."=".$values;
  553. }
  554. $flag=false;
  555. } else {
  556. if (!is_numeric($values)) {
  557. $where.=" and ".$key."='".str_replace("'", "''", $values)."'";
  558. } else {
  559. $where.=" and ".$key."=".$values;
  560. }
  561. }
  562. }
  563. $result = mysql_query($query.$where);
  564. }
  565. if ($result) while ($row_address=mysql_fetch_array($result, MYSQL_ASSOC)) {
  566. $country_data = get_country_detail($row_address['entry_country_id']);
  567. if ($row_address['entry_state'] != '') {
  568. $state_name = $row_address['entry_state'];
  569. } else {
  570. $state_name = $row_address['entry_zone_id'];
  571. }
  572. $state_data = get_state_detail($row_address['entry_country_id'],$state_name);
  573. $ret_address = array(
  574. "esale_oscom_id" => new xmlrpcval($row_address['address_book_id'],"int"),
  575. "name" => new xmlrpcval(fixEncoding($row_address['name']),"string"),
  576. "street" => new xmlrpcval(fixEncoding($row_address['entry_street_address']),"string"),
  577. "street2" => new xmlrpcval(fixEncoding($row_address['entry_suburb']),"string"),
  578. "zip" => new xmlrpcval(fixEncoding($row_address['entry_postcode']),"string"),
  579. "city" => new xmlrpcval(fixEncoding($row_address['entry_city']),"string"),
  580. "state" => $state_data,
  581. "country" => $country_data,
  582. "email" => new xmlrpcval(fixEncoding($email),"string"),
  583. "phone" => new xmlrpcval(fixEncoding($phone),"string"),
  584. "fax" => new xmlrpcval(fixEncoding($fax),"string")
  585. );
  586. $addresses[] = new xmlrpcval($ret_address,"struct");
  587. }
  588. return new xmlrpcval($addresses,"array");
  589. }
  590. function get_customer($cust_id) {
  591. $ret_partners = array();
  592. $condition = '';
  593. $query = "SELECT customers_id, CONCAT(customers_firstname,' ',customers_lastname) as name, customers_email_address, customers_default_address_id, customers_telephone, customers_fax from customers";
  594. if ($cust_id != 0) {
  595. $condition = " where customers_id=".$cust_id;
  596. }
  597. $result = mysql_query($query.$condition.';');
  598. if ($result) while ($row_cust=mysql_fetch_array($result, MYSQL_ASSOC)) {
  599. $addresses = get_partner_address(array('customers_id'=>$row_cust['customers_id']));
  600. $query_company = "select entry_nif, entry_company from address_book where customers_id = " . $row_cust['customers_id'];
  601. $result_company = mysql_query($query_company);
  602. $partner = array();
  603. $partner['esale_oscom_id'] = new xmlrpcval($row_cust['customers_id'],"int");
  604. $partner['nif'] = $result_company[0];
  605. $partner['company'] = $result_company[1];
  606. if ($partner['company']<> '' ) {
  607. $partner['name'] = new xmlrpcval(fixEncoding($row_cust['name']),"string");
  608. }else{
  609. $partner['name'] = new xmlrpcval(fixEncoding($partner['company']),"string");
  610. }
  611. $partner['addresses'] = $addresses;
  612. $ret_partners[] = new xmlrpcval($partner,"struct");
  613. }
  614. return new xmlrpcresp(new xmlrpcval($ret_partners,"array"));
  615. }
  616. function get_country_detail($country_name) {
  617. $query = "select countries_id, countries_name, countries_iso_code_2, countries_iso_code_3 from countries";
  618. $ret_country = '0';
  619. if (!is_numeric($country_name)) {
  620. if($country_name != '') {
  621. $result = mysql_query($query." where countries_name='".$country_name."';");
  622. }
  623. } else {
  624. $result = mysql_query($query." where countries_id=".$country_name.";");
  625. }
  626. if ($result && $row=mysql_fetch_row($result)) {
  627. $ret_country = new xmlrpcval( array (
  628. "esale_oscom_id" => new xmlrpcval($row[0],"int"),
  629. "name" => new xmlrpcval(fixEncoding($row[1]),"string"),
  630. "code" => new xmlrpcval(fixEncoding($row[2]),"string"),
  631. "code3" => new xmlrpcval(fixEncoding($row[3]),"string")
  632. ),"struct");
  633. return $ret_country;
  634. }
  635. return new xmlrpcval($ret_country,'string');
  636. }
  637. function get_state_detail($country_id,$state_name) {
  638. $ret_state = '0';
  639. $query = "select zone_id, zone_code, zone_name from zones";
  640. $condition = '';
  641. if (!is_numeric($state_name)) {
  642. if ($state_name != '') {
  643. $condition = " where zone_name='".$state_name."' and zone_country_id=".$country_id;
  644. }
  645. } else {
  646. $condition = " where zone_id=".$state_name." and zone_country_id=".$country_id;
  647. }
  648. $result = mysql_query($query.$condition.";");
  649. if ($result && $row=mysql_fetch_row($result)) {
  650. $ret_state = new xmlrpcval( array (
  651. "esale_oscom_id" => new xmlrpcval($row[0],"int"),
  652. "name" => new xmlrpcval(fixEncoding($row[2]),"string"),
  653. "code" => new xmlrpcval(fixEncoding($row[1]),"string")
  654. ),"struct");
  655. return $ret_state;
  656. }
  657. $ret_state = new xmlrpcval( array (
  658. "esale_oscom_id" => new xmlrpcval(0,"int"),
  659. "name" => new xmlrpcval(fixEncoding($state_name),"string"),
  660. "code" => new xmlrpcval('',"string")
  661. ),"struct");
  662. return $ret_state;
  663. }
  664. function get_saleorders($last_so) {
  665. $saleorders = array();
  666. $result = mysql_query("SELECT `orders_id` , `customers_name` , `customers_street_address` , `customers_city` , `customers_postcode` , `customers_state` , `customers_country` , `customers_telephone` , `customers_email_address` , `delivery_name` , `delivery_street_address` , `delivery_city` , `delivery_postcode` , `delivery_state` , `delivery_country` , `billing_name` , `billing_street_address` , `billing_city` , `billing_postcode` , `billing_state` , `billing_country` , `date_purchased` , `orders_status`, `customers_id`, `payment_method`, `customers_id`,`customers_company`,`delivery_company`,`billing_company` FROM `orders` where (orders_id > ".$last_so." and orders_status = 1);");
  667. if ($result){
  668. while ($row = mysql_fetch_row($result)) {
  669. $shopping_price = 0;
  670. $result_shopping = mysql_query("SELECT value, title from orders_total where class='ot_shipping' and orders_id=".$row[0].";");
  671. if ($result_shopping && $row_shopping=mysql_fetch_row($result_shopping)) {
  672. $shopping_price = $row_shopping[0];
  673. $shipping_title = $row_shopping[1];
  674. }
  675. $dcoupon_price = 0;
  676. $result_coupon = mysql_query("SELECT value, title from orders_total where class='ot_discount_coupon' and orders_id=".$row[0].";");
  677. if ($result_coupon && $row_coupon=mysql_fetch_row($result_coupon)) {
  678. $dcoupon_price = $row_coupon[0];
  679. $dcoupon_title = $row_coupon[1];
  680. }
  681. $cash_price = 0;
  682. $result_cash = mysql_query("SELECT value, title from orders_total where class='ot_fixed_payment_chg' and orders_id=".$row[0].";");
  683. if ($result_cash && $row_cash=mysql_fetch_row($result_cash)) {
  684. $cash_price = $row_cash[0];
  685. $cash_title = $row_cash[1];
  686. }
  687. $result_customer = mysql_query("SELECT customers_email_address, customers_telephone, customers_fax FROM customers WHERE customers_id=".$row[25].";");
  688. if ($result_customer && $row_customer=mysql_fetch_row($result_customer)) {
  689. $email = $row_customer[0];
  690. $phone = $row_customer[1];
  691. $fax = $row_customer[2];
  692. }
  693. $default_condition = array("customers_id"=>$row[25],
  694. "entry_company"=>$row[26],
  695. "CONCAT(entry_firstname,' ',entry_lastname)"=>$row[1],
  696. "entry_street_address"=>$row[2],
  697. "entry_city"=>$row[3],
  698. "entry_postcode"=>$row[4]
  699. );
  700. $default_address = get_partner_address($default_condition, $email, $phone, $fax);
  701. $delivery_condition = array("customers_id"=>$row[25],
  702. "entry_company"=>$row[27],
  703. "CONCAT(entry_firstname,' ',entry_lastname)"=>$row[9],
  704. "entry_street_address"=>$row[10],
  705. "entry_city"=>$row[11],
  706. "entry_postcode"=>$row[12]
  707. );
  708. $delivery_address = get_partner_address($delivery_condition, $email, $phone, $fax);
  709. $billing_condition = array("customers_id"=>$row[25],
  710. "entry_company"=>$row[28],
  711. "CONCAT(entry_firstname,' ',entry_lastname)"=>$row[15],
  712. "entry_street_address"=>$row[16],
  713. "entry_city"=>$row[17],
  714. "entry_postcode"=>$row[18]
  715. );
  716. $billing_address = get_partner_address($billing_condition, $email, $phone, $fax);
  717. $result_status = mysql_query("select orders_status_name from orders_status where orders_status_id = " . $row[22].";");
  718. if ($result_status && $row_status=mysql_fetch_row($result_status)) {
  719. $status = $row_status[0];
  720. }
  721. $orderlines = array();
  722. $resultb = mysql_query("select products_id, products_quantity, products_price, products_tax, products_name, orders_products_id from orders_products where orders_id=".$row[0].";");
  723. if ($resultb){
  724. while ($rowb = mysql_fetch_row($resultb)) {
  725. $values_array = array("product_id" => new xmlrpcval($rowb[0], "int"),
  726. "product_qty" => new xmlrpcval($rowb[1], "int"),
  727. "price" => new xmlrpcval($rowb[2], "double"),
  728. "tax_rate" => new xmlrpcval($rowb[3],"double"),
  729. "name" => new xmlrpcval(fixEncoding($rowb[4]),"string"));
  730. $result_orders_product_attributes = mysql_query("select products_options, products_options_values, options_values_price, price_prefix from orders_products_attributes where orders_id=".$row[0]." and orders_products_id=".$rowb[5].";");
  731. if($result_orders_product_attributes && $row_orders_product_attributes= mysql_fetch_row($result_orders_product_attributes)) {
  732. $orders_product_attributes = new xmlrpcval( array(
  733. "products_options" => new xmlrpcval(fixEncoding($row_orders_product_attributes[0]),"string"),
  734. "products_options_values" => new xmlrpcval(fixEncoding($row_orders_product_attributes[1]),"string"),
  735. "options_values_price" => new xmlrpcval($row_orders_product_attributes[2],"double"),
  736. "price_prefix" => new xmlrpcval(fixEncoding($row_orders_product_attributes[3]),"string")), "struct");
  737. $values_array["attributes"] = $orders_product_attributes;
  738. }
  739. $orderlines[] = new xmlrpcval($values_array, "struct");
  740. }
  741. }
  742. $note = "";
  743. $result_comments = mysql_query("select comments FROM orders_status_history where (orders_id = ".$row[0]." and orders_status_id = 1);");
  744. if ($result_comments && $row_comments=mysql_fetch_row($result_comments)) {
  745. $note=$row_comments[0];
  746. }
  747. // $result_price_with_tax = mysql_query("SELECT configuration_value FROM configuration where (configuration_key = 'DISPLAY_PRICE_WITH_TAX');");
  748. // if ($result_price_with_tax && $row_price_with_tax=mysql_fetch_row($result_price_with_tax)) {
  749. // if ($row_price_with_tax[0] == 'false') {
  750. $price_type="tax_excluded";
  751. // } else {
  752. // $price_type="tax_included";
  753. // }
  754. // }
  755. $saleorders[] = new xmlrpcval( array("id" => new xmlrpcval( $row[0], "int"),
  756. "price_type" => new xmlrpcval( fixEncoding($price_type), "string" ),
  757. "note" => new xmlrpcval(fixEncoding($note), "string" ),
  758. "lines" => new xmlrpcval( $orderlines, "array"),
  759. "pay_met" => new xmlrpcval( search_payment_method($row[24]), "int"),
  760. "pay_met_title" => new xmlrpcval( fixEncoding($row[24]), "string"),
  761. "shipping_price" => new xmlrpcval( $shopping_price, "double"),
  762. "shipping_title" => new xmlrpcval(fixEncoding($shipping_title), "string"),
  763. "dcoupon_price" => new xmlrpcval( $dcoupon_price, "double"),
  764. "dcoupon_title" => new xmlrpcval(fixEncoding($dcoupon_title), "string"),
  765. "cash_price" => new xmlrpcval( $cash_price, "double"),
  766. "cash_title" => new xmlrpcval(fixEncoding($cash_title), "string"),
  767. "orders_status" => new xmlrpcval( fixEncoding($status), "string"),
  768. "partner" => get_customer($row[25]),
  769. "date" => new xmlrpcval( $row[21], "string"),
  770. "address" => $default_address,
  771. "delivery" => $delivery_address,
  772. "billing" => $billing_address
  773. ), "struct");
  774. }
  775. }
  776. return new xmlrpcresp(new xmlrpcval($saleorders, "array"));
  777. }
  778. function get_min_open_orders($last_so) {
  779. $result = mysql_query("SELECT min(`orders_id`) as min FROM `orders` where (orders_id <= ".$last_so.") and (orders_status = 2);");
  780. if ($result) {
  781. $min = mysql_fetch_row($result);
  782. return new xmlrpcresp( new xmlrpcval($min[0], "int"));
  783. } else
  784. return new xmlrpcresp( new xmlrpcval(-1, "int"));
  785. }
  786. function get_max_products_id() {
  787. $result = mysql_query("SELECT max(`products_id`) as max FROM `products`;");
  788. if ($result) {
  789. $max = mysql_fetch_row($result);
  790. return new xmlrpcresp( new xmlrpcval($max[0], "int"));
  791. } else
  792. return new xmlrpcresp( new xmlrpcval(-1, "int"));
  793. }
  794. function get_min_products_id() {
  795. $result = mysql_query("SELECT min(`products_id`) as min FROM `products`;");
  796. if ($result) {
  797. $min = mysql_fetch_row($result);
  798. return new xmlrpcresp( new xmlrpcval($min[0], "int"));
  799. } else
  800. return new xmlrpcresp( new xmlrpcval(-1, "int"));
  801. }
  802. function close_open_orders($order_id) {
  803. mysql_query("update orders set orders_status=3 where orders_id=".$order_id.";");
  804. return new xmlrpcresp(new xmlrpcval(0, "int"));
  805. }
  806. function process_order($order_id) {
  807. mysql_query("update orders set orders_status=2 where orders_id=".$order_id.";");
  808. return new xmlrpcresp(new xmlrpcval(0, "int"));
  809. }
  810. $server = new xmlrpc_server( array( "get_taxes" => array( "function" => "get_taxes",
  811. "signature" => array( array($xmlrpcArray)
  812. )
  813. ),
  814. "get_languages" => array( "function" => "get_languages",
  815. "signature" => array( array($xmlrpcArray)
  816. )
  817. ),
  818. "get_categories" => array( "function" => "get_categories",
  819. "signature" => array( array($xmlrpcArray)
  820. )
  821. ),
  822. "get_categories_parent" => array( "function" => "get_categories_parent",
  823. "signature" => array( array($xmlrpcArray, $xmlrpcArray)
  824. )
  825. ),
  826. "get_products" => array( "function" => "get_products",
  827. "signature" => array( array($xmlrpcArray, $xmlrpcArray, $xmlrpcInt, $xmlrpcInt)
  828. )
  829. ),
  830. "get_payment_methods" => array( "function" => "get_payment_methods",
  831. "signature" => array( array($xmlrpcArray)
  832. )
  833. ),
  834. "get_saleorders" => array( "function" => "get_saleorders",
  835. "signature" => array( array($xmlrpcArray, $xmlrpcInt)
  836. )
  837. ),
  838. "get_min_products_id" => array( "function" => "get_min_products_id",
  839. "signature" => array( array($xmlrpcInt)
  840. )
  841. ),
  842. "get_max_products_id" => array( "function" => "get_max_products_id",
  843. "signature" => array( array($xmlrpcInt)
  844. )
  845. ),
  846. "get_min_open_orders" => array( "function" => "get_min_open_orders",
  847. "signature" => array( array($xmlrpcInt, $xmlrpcInt)
  848. )
  849. ),
  850. "set_product_spe" => array( "function" => "set_product_spe",
  851. "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
  852. )
  853. ),
  854. "set_product_classical" => array( "function" => "set_product_classical",
  855. "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
  856. )
  857. ),
  858. "remove_product" => array( "function" => "remove_product",
  859. "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
  860. )
  861. ),
  862. "del_spe_price" => array( "function" => "del_spe_price",
  863. "signature" => array( array($xmlrpcInt, $xmlrpcInt)
  864. )
  865. ),
  866. "set_product_stock" => array( "function" => "set_product_stock",
  867. "signature" => array( array($xmlrpcInt, $xmlrpcStruct)
  868. )
  869. ),
  870. "process_order" => array( "function" => "process_order",
  871. "signature" => array( array($xmlrpcInt, $xmlrpcInt)
  872. )
  873. ),
  874. "close_open_orders" => array( "function" => "close_open_orders",
  875. "signature" => array( array($xmlrpcInt, $xmlrpcInt)
  876. )
  877. ),
  878. "get_customer" => array( "function" => "get_customer",
  879. "signature" => array( array($xmlrpcArray, $xmlrpcInt)
  880. )
  881. )
  882. ), false);
  883. $server->functions_parameters_type = 'phpvals';
  884. $server->service();
  885. ?>