diff --git a/htdocs/oscommerce_ws/clients/fiche.php b/htdocs/oscommerce_ws/clients/fiche.php new file mode 100644 index 00000000000..51702d3934d --- /dev/null +++ b/htdocs/oscommerce_ws/clients/fiche.php @@ -0,0 +1,148 @@ + + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Source$ + * + */ +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/societe.class.php"); +require_once("../includes/configure.php"); + +llxHeader(); + +if ($action == '' && !$cancel) { + + if ($_GET['custid']) + { + $osc_cust = new Osc_customer($_GET['custid']); + $result = $osc_cust->fetch($_GET['custid']); + + if ( !$result) + { + print '
Fiche client OSC : '.$osc_cust->osc_custfirstname.' '.$osc_cust->osc_custlastname.'

'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
Ville'.$osc_cust->osc_custcity.'
Pays'.$osc_cust->osc_custcountry.'
Id OSC'.$osc_cust->osc_custid.'
Téléphone'.$osc_cust->osc_custtel.'
E-mail'.$osc_cust->osc_custmail.'
"; + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + print "\n
\n"; + + if ( $user->rights->societe->creer) { + print ''.$langs->trans("Import").''; + } + print "\n

\n"; +// seule action importer + + } + else + { + print "

ERROR 1c

\n"; + dolibarr_print_error('',"erreur webservice ".$osc_cust->error); + } + } + else + { + print "

ERROR 1b

\n"; + print "Error"; + } +} +/* action Import création de l'objet product de dolibarr +* +*/ + if (($_GET["action"] == 'import' ) && ( $_GET["custid"] != '' ) && $user->rights->produit->creer) + { + $osc_cust = new Osc_customer(); + $result = $osc_cust->fetch($_GET['custid']); + + if ( !$result ) + { + $societe = new Societe($db); + if ($_error == 1) + { + print '
erreur 1
'; + exit; + } + + /* initialisation */ + $societe->nom = $osc_cust->osc_custsoc.' '.$osc_cust->osc_custlastname; + $societe->adresse = $osc_cust->osc_cutstreet; + $societe->cp = $osc_cust->osc_custpostcode; + $societe->ville = $osc_cust->osc_custcity; + $societe->departement_id = 0; + $societe->pays_code = $osc_cust->osc_custcodecountry; + $societe->tel = $osc_cust->osc_custtel; + $societe->fax = $osc_cust->osc_custfax; + $societe->email = $osc_cust->osc_custmail; + /* on force */ + $societe->url = ''; + $societe->siren = ''; + $societe->siret = ''; + $societe->ape = ''; + $societe->client = 1; // mettre 0 si prospect + } + + $id = $societe->create($user); + + if ($id == 0) + { + print '
création réussie nouveau client/prospect '.$id.' nom : '.$societe->nom.'
'; + } + else + { + if ($id == -3) + { + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + if ($id == -2) + { + /* la référence existe on fait un update */ + $societe_control = new Societe($db); + if ($_error == 1) + { + print '
erreur 1
'; + exit; + } + $idp = $societe_control->fetch($socid = $osc_cust->osc_ref); + + if ($idp > 0) + { + $res = $societe->update($idp, $user); + if ($res < 0) print '
Erreur update '.$idp.'
'; + $res = $osc_cust->transcode($osc_cust->custid,$idp); + if ($res < 0) print '
Erreur update '.$idp.'
'; + + } + else print '
update impossible $id : '.$idp.'
'; + } + } + + } + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/oscommerce_ws/clients/index.php b/htdocs/oscommerce_ws/clients/index.php new file mode 100644 index 00000000000..07295d60d0b --- /dev/null +++ b/htdocs/oscommerce_ws/clients/index.php @@ -0,0 +1,98 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + */ + +require("./pre.inc.php"); + +$langs->load("companies"); + +llxHeader(); + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des clients de la boutique web", $page, "index.php"); + +set_magic_quotes_runtime(0); + +//WebService Client. +require_once(NUSOAP_PATH."nusoap.php"); +require_once("../includes/configure.php"); + +// Set the parameters to send to the WebService +$parameters = array("custid"=>"0"); + +// Set the WebService URL +$client = new soapclient(OSCWS_DIR."ws_customers.php"); + +$result = $client->call("get_Client",$parameters ); + +// echo '

Result

'; print_r($result); echo '
'; + +if ($client->fault) { + dolibarr_print_error('',"erreur de connection "); +} +elseif (!($err = $client->getError()) ) +{ + $num=0; + if ($result) $num = sizeof($result); + $var=True; + $i=0; + + if ($num > 0) { + print "

"; + print ''; + print ""; + print ''; + print ""; + print ""; + print ""; + print ''; + print "\n"; + + while ($i < $num) { + $var=!$var; + + print ""; + print '\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; + print '\n"; + print "\n"; + $i++; + } + print "
idSociétéNomVillePaysTéléphone
'.$result[$i][customers_id]."".$result[$i][entry_company]."".$result[$i][entry_lastname]."".$result[$i][entry_city]."'.$result[$i][countries_name]."'.$result[$i][customers_telephone]."

"; + } + else { + dolibarr_print_error('',"Aucun client trouvé"); + } +} +else { + dolibarr_print_error('',"Erreur service web ".$err); +} + +print ""; + + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/oscommerce_ws/clients/osc_customer.class.php b/htdocs/oscommerce_ws/clients/osc_customer.class.php new file mode 100644 index 00000000000..d41dca469c6 --- /dev/null +++ b/htdocs/oscommerce_ws/clients/osc_customer.class.php @@ -0,0 +1,174 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/oscommerce_ws/clients/osc_customer.class.php + \ingroup oscommerce_ws/clients + \brief Fichier de la classe des clients issus de OsCommerce + \version $Revision$ +*/ + + +/** + \class Osc_customer + \brief Classe permettant la gestion des clients/prospects issus d'une base OSC +*/ + +class Osc_customer +{ + var $db; + + var $osc_custid; + var $osc_custsoc; + var $osc_custfirstname; + var $osc_custlastname; + var $osc_custstreet; + var $osc_custpostcode; + var $osc_custcity; + var $osc_custtel; + var $osc_custfax; + var $osc_custmail; + var $osc_custidcountry; + var $osc_custcodecountry; + var $osc_custcountry; + + var $error; + + /** + * \brief Constructeur de la classe + * \param id Id client (0 par defaut) + */ + function Osc_customer($id=0) { + + global $langs; + + $this->osc_custid = $id ; + + /* les initialisations nécessaires */ + } + + +/** +* \brief Charge le client OsC en mémoire +* \param id Id du client dans OsC +* \return int <0 si ko, >0 si ok +*/ + function fetch($id='') + { + global $langs; + global $conf; + + $this->error = ''; + dolibarr_syslog("Osc_customer::fetch $id=$id ref=$ref"); + // Verification parametres + if (! $id ) + { + $this->error=$langs->trans('ErrorWrongParameters'); + return -1; + } + + set_magic_quotes_runtime(0); + + //WebService Client. + require_once(NUSOAP_PATH."/nusoap.php"); + require_once("../includes/configure.php"); + + // Set the parameters to send to the WebService + $parameters = array("custid"=>$id); + + // Set the WebService URL + $client = new soapclient(OSCWS_DIR."/ws_customers.php"); + + // Call the WebSeclient->fault)rvice and store its result in $obj + $obj = $client->call("get_Client",$parameters ); +// Attention c'est un tableau !! + + if ($client->fault) { + $this->error="Fault detected ".$client->getError(); + return -1; + } + elseif (!($err=$client->getError()) ) { + $this->osc_custid = $obj[0][customers_id]; + $this->osc_custsoc = $obj[0][entry_company]; + $this->osc_custfirstname = $obj[0][entry_firstname]; + $this->osc_custlastname = $obj[0][entry_lastname]; + $this->osc_custstreet = $obj[0][entry_street_address]; + $this->osc_custpostcode = $obj[0][entry_postcode]; + $this->osc_custcity = $obj[0][entry_city]; + $this->osc_custtel = $obj[0][customers_telephone]; + $this->osc_custfax = $obj[0][customers_fax]; + $this->osc_custmail = $obj[0][customers_email_address]; + $this->osc_custidcountry = $obj[0][entry_country_id]; + $this->osc_custcodecountry = $obj[0][countries_iso_code_2]; + $this->osc_custcountry = $obj[0][countries_name]; + } + else { + $this->error = 'Erreur '.$err ; + return -1; + } + return 0; + } + +/** +* \brief Mise à jour de la table de transition +* \param oscid Id du client dans OsC +* \param socidp champ société.idp +* \return int <0 si ko, >0 si ok +*/ + function transcode($oscid, $socidp) + { + global $conf; + + /* suppression et insertion */ + $sql = "DELETE FROM ".MAIN_DB_PREFIX." osc_customer WHERE osc_custid = ".$oscid; + $this->$db = $DB; + $result=$this->db->query($sql); + if ($result) + { + print "suppression ok ".$result; + } + else + { + print "suppression rate ".$result; + dolibarr_syslog("osc_customer::transcode echec suppression"); +// $this->db->rollback(); +// return -1; + } + $sql = "INSERT INTO ".MAIN_DB_PREFIX." osc_customer VALUES (".$oscid." , CURDATE() , ".$socidp.")"; + $this->$db = $DB; + $result=$this->db->query($sql); + if ($result) + { + print "insertion ok ". $sql." ". $result; + } + else + { + print "insertion rate ".$sql." , ".$result; + dolibarr_syslog("osc_customer::transcode echec insert"); +// $this->db->rollback(); +// return -1; + } + return 0; + } + + } + +?> diff --git a/htdocs/oscommerce_ws/clients/pre.inc.php b/htdocs/oscommerce_ws/clients/pre.inc.php new file mode 100644 index 00000000000..3a3c6935fdd --- /dev/null +++ b/htdocs/oscommerce_ws/clients/pre.inc.php @@ -0,0 +1,50 @@ + + * Copyright (C) 2006 Laurent Destailleur + * Copyright (C) 2006 Jean Heimburger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/oscommerce_ws/clients/pre.inc.php + \brief Fichier gestionnaire du menu de gauche + \version $Revision$ +*/ + +require("../../main.inc.php"); +require("./osc_customer.class.php"); + +function llxHeader($head = "", $urlp = "") +{ + global $user, $conf, $langs; + $langs->load("shop"); + + top_menu($head); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/oscommerce_ws/index.php", $langs->trans("OSCommerceShop")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/produits/", $langs->trans("Products")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/clients/", $langs->trans("Clients")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/commandes/", $langs->trans("Commandes")); + + left_menu($menu->liste); +} + +?> diff --git a/htdocs/oscommerce_ws/commandes/fiche.php b/htdocs/oscommerce_ws/commandes/fiche.php new file mode 100644 index 00000000000..9def4e3a84f --- /dev/null +++ b/htdocs/oscommerce_ws/commandes/fiche.php @@ -0,0 +1,146 @@ + + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Source$ + * + */ +require("./pre.inc.php"); +require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); +require_once("../includes/configure.php"); + +llxHeader(); + +if ($action == '' && !$cancel) { + + if ($_GET["orderid"]) + { + $osc_order = new Osc_order($_GET["orderid"]); + $result = $osc_order->fetch($_GET["orderid"]); + + if ( !$result) + { + print '
Fiche commande OSC : '.$osc_order->osc_orderid.'

'; + + print ''; + print ''; + print ''; + print ''; + print ''; + print ''; + print "
client OSC'.$osc_order->osc_custid.'
Nom client'.$osc_order->osc_custname.'
Montant'.$osc_order->osc_ordertotal.'
Date commande'.$osc_order->osc_orderdate.'
Méthode de paiement'.$osc_order->osc_orderpaymet.'
"; + + /* ************************************************************************** */ + /* */ + /* Barre d'action */ + /* */ + /* ************************************************************************** */ + print "\n
\n"; + + if ( $user->rights->commande->creer) { + print ''.$langs->trans("Import").''; + } + print "\n

\n"; +// seule action importer + + } + else + { + print "

ERROR 1c

\n"; + dolibarr_print_error('',"erreur webservice ".$osc_order->error); + } + } + else + { + print "

ERROR 1b

\n"; + print "Error"; + } +} +/* action Import création de l'objet product de dolibarr +* +*/ + if (($_GET["action"] == 'import' ) && ( $_GET["orderid"] != '' ) && $user->rights->commande->creer) + { + $osc_order = new osc_order(); + $result = $osc_order->fetch($_GET["orderid"]); + print '
on passe 1
'; + if ( !$result ) + { + $commande = new Commande($db); + if ($_error == 1) + { + print '
erreur 1
'; + exit; + } + print '
on passe 2
'; + /* initialisation */ + $societe->nom = $osc_order->osc_ordersoc.' '.$osc_order->osc_orderlastname; + $societe->adresse = $osc_order->osc_cutstreet; + $societe->cp = $osc_order->osc_orderpostcode; + $societe->ville = $osc_order->osc_ordercity; + $societe->departement_id = 0; + $societe->pays_code = $osc_order->osc_ordercodecountry; + $societe->tel = $osc_order->osc_ordertel; + $societe->fax = $osc_order->osc_orderfax; + $societe->email = $osc_order->osc_ordermail; + /* on force */ + $societe->url = ''; + $societe->siren = ''; + $societe->siret = ''; + $societe->ape = ''; + $societe->client = 1; // mettre 0 si prospect + } + print '
on passe 3
'; + $id = $societe->create($user); + + if ($id > 0) + { + print '
création réussie nouveau client/prospect '.$id.' nom : '.$societe->nom.'
'; + if ($id > 0) exit; + } + else + { + if ($id == -3) + { + $_error = 1; + $_GET["action"] = "create"; + $_GET["type"] = $_POST["type"]; + } + if ($id == -2) + { + /* la référence existe on fait un update */ + $societe_control = new Societe($db); + if ($_error == 1) + { + print '
erreur 1
'; + exit; + } + $id = $societe_control->fetch($ref = $osc_order->osc_ref); + + if ($id > 0) + { + $id = $societe->update($id, $user); + if ($id < 0) print '
Erreur update '.$id.'
'; + } + else print '
update impossible $id : '.$id.'
'; + } + } + + } + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/oscommerce_ws/commandes/index.php b/htdocs/oscommerce_ws/commandes/index.php new file mode 100644 index 00000000000..d99ec7d638d --- /dev/null +++ b/htdocs/oscommerce_ws/commandes/index.php @@ -0,0 +1,98 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * + */ + +require("./pre.inc.php"); + +$langs->load("companies"); + +llxHeader(); + + +if ($page == -1) { $page = 0 ; } +$limit = $conf->liste_limit; +$offset = $limit * $page ; + +print_barre_liste("Liste des commandes de la boutique web", $page, "index.php"); + +set_magic_quotes_runtime(0); + +//WebService Client. +require_once(NUSOAP_PATH."nusoap.php"); +require_once("../includes/configure.php"); + +// Set the parameters to send to the WebService +$parameters = array("orderid"=>"0"); + +// Set the WebService URL +$client = new soapclient(OSCWS_DIR."ws_orders.php"); + +$result = $client->call("get_Order",$parameters ); + +// echo '

Result

'; print_r($result); echo '
'; + +if ($client->fault) { + dolibarr_print_error('',"erreur de connection "); +} +elseif (!($err = $client->getError()) ) +{ + $num=0; + if ($result) $num = sizeof($result); + $var=True; + $i=0; + + if ($num > 0) { + print "

"; + print ''; + print ""; + print ''; + print ""; + print ""; + print ""; + print ''; + print "\n"; + + while ($i < $num) { + $var=!$var; + + print ""; + print '\n"; + print "\n"; + print "\n"; + print "\n"; + print '\n"; +// print '\n"; + print "\n"; + $i++; + } + print "
idCommandeClientDateMontantPaiement
'.$result[$i][orders_id]."".$result[$i][customers_name]."".$result[$i][date_purchased]."".$result[$i][value]."'.$result[$i][payment_method]."'/*.$result[$i][customers_telephone]*/."

"; + } + else { + dolibarr_print_error('',"Aucune commande trouvée"); + } +} +else { + dolibarr_print_error('',"Erreur service web ".$err); +} + +print ""; + + +llxFooter('$Date$ - $Revision$'); +?> diff --git a/htdocs/oscommerce_ws/commandes/osc_order.class.php b/htdocs/oscommerce_ws/commandes/osc_order.class.php new file mode 100644 index 00000000000..761b1c8b5cf --- /dev/null +++ b/htdocs/oscommerce_ws/commandes/osc_order.class.php @@ -0,0 +1,115 @@ + + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/oscommerce_ws/orders/osc_order.class.php + \ingroup oscommerce_ws/orders + \brief Fichier de la classe des commandes issus de OsCommerce + \version $Revision$ +*/ + + +/** + \class Osc_order + \brief Classe permettant la gestion des commandes issues d'une base OSC +*/ + +class Osc_order +{ + var $osc_orderid; + var $osc_custid; //identifant du client osc + var $osc_custname; + var $osc_orderdate; + var $osc_ordertotal; + var $osc_orderpaymet; + + var $error; + + /** + * \brief Constructeur de la classe + * \param id Id client (0 par defaut) + */ + function Osc_order($id=0) { + + global $langs; + + $this->osc_orderid = $id ; + + /* les initialisations nécessaires */ + } + + +/** +* \brief Charge la commande OsC en mémoire +* \param id Id de la commande dans OsC +* \return int <0 si ko, >0 si ok +*/ + function fetch($id='') + { + global $langs; + global $conf; + + $this->error = ''; + dolibarr_syslog("Osc_order::fetch $id=$id "); + // Verification parametres + if (! $id ) + { + $this->error=$langs->trans('ErrorWrongParameters'); + return -1; + } + + set_magic_quotes_runtime(0); + + //WebService Client. + require_once(NUSOAP_PATH."/nusoap.php"); + require_once("../includes/configure.php"); + + // Set the parameters to send to the WebService + $parameters = array("orderid"=>$id); + + // Set the WebService URL + $client = new soapclient(OSCWS_DIR."/ws_orders.php"); + + // Call the WebSeclient->fault)rvice and store its result in $obj + $obj = $client->call("get_Order",$parameters ); + + if ($client->fault) { + $this->error="Fault detected ".$client->getError(); + return -1; + } + elseif (!($err=$client->getError()) ) { + $this->osc_orderid = $obj[0][orders_id]; + $this->osc_custname = $obj[0][customers_name]; + $this->osc_custid = $obj[0][customers_id]; + $this->osc_orderdate = $obj[0][date_purchased]; + $this->osc_ordertotal = $obj[0][value]; + $this->osc_orderpaymet = $obj[0][payment_method]; + } + else { + $this->error = 'Erreur '.$err ; + return -1; + } + return 0; + } + + } + +?> diff --git a/htdocs/oscommerce_ws/commandes/pre.inc.php b/htdocs/oscommerce_ws/commandes/pre.inc.php new file mode 100644 index 00000000000..e722bbaa7af --- /dev/null +++ b/htdocs/oscommerce_ws/commandes/pre.inc.php @@ -0,0 +1,50 @@ + + * Copyright (C) 2006 Laurent Destailleur + * Copyright (C) 2006 Jean Heimburger + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Id$ + * $Source$ + */ + +/** + \file htdocs/oscommerce_ws/clients/pre.inc.php + \brief Fichier gestionnaire du menu de gauche + \version $Revision$ +*/ + +require("../../main.inc.php"); +require("./osc_order.class.php"); + +function llxHeader($head = "", $urlp = "") +{ + global $user, $conf, $langs; + $langs->load("shop"); + + top_menu($head); + + $menu = new Menu(); + + $menu->add(DOL_URL_ROOT."/oscommerce_ws/index.php", $langs->trans("OSCommerceShop")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/produits/", $langs->trans("Products")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/clients/", $langs->trans("Clients")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/commandes/", $langs->trans("Commandes")); + + left_menu($menu->liste); +} + +?> diff --git a/htdocs/oscommerce_ws/includes/configure.php b/htdocs/oscommerce_ws/includes/configure.php index 7d19b7c8c8e..1e957d53185 100644 --- a/htdocs/oscommerce_ws/includes/configure.php +++ b/htdocs/oscommerce_ws/includes/configure.php @@ -7,8 +7,8 @@ ----------------------------------------------*/ //base url des webservices -//define(OSCWS_DIR,'http://osc-tiaris/ws_OSC/'); -define(OSCWS_DIR,'http://osc.tiaris.info/ws_OSC/'); +define(OSCWS_DIR,'http://osc-tiaris/ws_OSC/'); +//define(OSCWS_DIR,'http://osc.tiaris.info/ws_OSC/'); //affichages dans la page d'accueil define(OSC_MAXNBCOM, 5); define(OSC_ORDWAIT,'4'); // code du statut de commande en attente diff --git a/htdocs/oscommerce_ws/index.php b/htdocs/oscommerce_ws/index.php index e2621257efb..ea68a563348 100644 --- a/htdocs/oscommerce_ws/index.php +++ b/htdocs/oscommerce_ws/index.php @@ -66,7 +66,7 @@ print ''.$langs->trans("Total").''; // Call the WebService and store its result in $result. $result = $client->call("get_CAmensuel",$parameters ); if ($client->fault) { - dolibarr_print_error("Erreur de connection "); + dolibarr_print_error('',"Erreur de connection "); } elseif (!($err = $client->getError()) ) { @@ -90,7 +90,7 @@ elseif (!($err = $client->getError()) ) } else { - dolibarr_print_error("Erreur du service web ".$err); + dolibarr_print_error('',"Erreur du service web ".$err); } @@ -113,7 +113,7 @@ $parameters = array("limit"=>OSC_MAXNBCOM); $result = $client->call("get_orders",$parameters ); if ($client->fault) { - dolibarr_print_error("Erreur de connection "); + dolibarr_print_error('',"Erreur de connection "); } elseif (!($err = $client->getError()) ) { $num=0; @@ -133,7 +133,7 @@ elseif (!($err = $client->getError()) ) { } } else { - dolibarr_print_error("Erreur du service web ".$err); + dolibarr_print_error('',"Erreur du service web ".$err); } print "
"; @@ -150,7 +150,7 @@ $parameters = array("limit"=>OSC_MAXNBCOM, "status"=>OSC_ORDWAIT); $result = $client->call("get_orders",$parameters ); if ($client->fault) { - dolibarr_print_error("Erreur webservice ".$client->faultstring); + dolibarr_print_error('',"Erreur webservice ".$client->faultstring); } elseif (!($err = $client->getError()) ) { $var=True; @@ -171,7 +171,7 @@ elseif (!($err = $client->getError()) ) { } } else { - dolibarr_print_error("Erreur du service web ".$err); + dolibarr_print_error('',"Erreur du service web ".$err); } print "
"; @@ -187,7 +187,7 @@ $parameters = array("limit"=>OSC_MAXNBCOM, "status"=>OSC_ORDPROCESS); $result = $client->call("get_orders",$parameters ); if ($client->fault) { - dolibarr_print_error("Erreur webservice ".$client->faultstring); + dolibarr_print_error('',"Erreur webservice ".$client->faultstring); } elseif (!($err = $client->getError()) ) { $var=True; @@ -208,7 +208,7 @@ elseif (!($err = $client->getError()) ) { } } else { - dolibarr_print_error("Erreur du service web ".$err); + dolibarr_print_error('',"Erreur du service web ".$err); } print "
"; @@ -226,7 +226,7 @@ $parameters = array("limit"=>OSC_MAXNBCOM); $result = $client->call("get_lastOrderClients",$parameters ); if ($client->fault) { - dolibarr_print_error("Erreur webservice ".$client->faultstring); + dolibarr_print_error('',"Erreur webservice ".$client->faultstring); } elseif (!($err = $client->getError()) ) { $var=True; @@ -248,12 +248,12 @@ elseif (!($err = $client->getError()) ) { } } else { - dolibarr_print_error("Erreur du service web ".$err); + dolibarr_print_error('',"Erreur du service web ".$err); } print ''; -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/oscommerce_ws/pre.inc.php b/htdocs/oscommerce_ws/pre.inc.php index 98d2fe407bc..b1606a2189c 100644 --- a/htdocs/oscommerce_ws/pre.inc.php +++ b/htdocs/oscommerce_ws/pre.inc.php @@ -1,6 +1,7 @@ * Copyright (C) 2006 Laurent Destailleur + * Copyright (C) 2006 Jean Heimburger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -38,7 +39,9 @@ function llxHeader($head = "", $urlp = "") $menu = new Menu(); $menu->add(DOL_URL_ROOT."/oscommerce_ws/index.php", $langs->trans("OSCommerceShop")); - $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/produits/", $langs->trans("Products")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/produits/index.php", $langs->trans("Products")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/clients/index.php", $langs->trans("Clients")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/commandes/index.php", $langs->trans("Commandes")); left_menu($menu->liste); } diff --git a/htdocs/oscommerce_ws/produits/fiche.php b/htdocs/oscommerce_ws/produits/fiche.php index 56145947de2..798c3d6146b 100644 --- a/htdocs/oscommerce_ws/produits/fiche.php +++ b/htdocs/oscommerce_ws/produits/fiche.php @@ -1,6 +1,5 @@ - * Copyright (C) 2003-2005 Éric Seigne +/* Copyright (C) 2006 Jean Heimburger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -62,7 +61,7 @@ if ($action == '' && !$cancel) { else { print "

ERROR 1

\n"; - dolibarr_print_error("erreur webservice ".$osc_prod->error); + dolibarr_print_error('',"erreur webservice ".$osc_prod->error); } } else @@ -143,5 +142,5 @@ if ($action == '' && !$cancel) { } -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/oscommerce_ws/produits/index.php b/htdocs/oscommerce_ws/produits/index.php index 34cfd04d517..e77d408afb0 100644 --- a/htdocs/oscommerce_ws/produits/index.php +++ b/htdocs/oscommerce_ws/produits/index.php @@ -1,6 +1,6 @@ - * Copyright (C) 2004 Laurent Destailleur +/* Copyright (C) 2006 Jean Heimburger + * * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -48,7 +48,7 @@ $client = new soapclient(OSCWS_DIR."ws_articles.php"); $result = $client->call("get_listearticles",$parameters ); if ($client->fault) { - dolibarr_print_error("erreur de connection "); + dolibarr_print_error('',"erreur de connection "); } elseif (!($err = $client->getError()) ) { @@ -84,15 +84,15 @@ elseif (!($err = $client->getError()) ) print "

"; } else { - dolibarr_print_error("Aucun article trouvé"); + dolibarr_print_error('',"Aucun article trouvé"); } } else { - dolibarr_print_error("Erreur service web ".$err); + dolibarr_print_error('',"Erreur service web ".$err); } print ""; -llxFooter("Dernière modification $Date$ révision $Revision$"); +llxFooter('$Date$ - $Revision$'); ?> diff --git a/htdocs/oscommerce_ws/produits/osc_product.class.php b/htdocs/oscommerce_ws/produits/osc_product.class.php index 5ac12f806b5..5fd84476c21 100644 --- a/htdocs/oscommerce_ws/produits/osc_product.class.php +++ b/htdocs/oscommerce_ws/produits/osc_product.class.php @@ -1,9 +1,5 @@ - * Copyright (C) 2004-2006 Laurent Destailleur - * Copyright (C) 2005-2006 Regis Houssin - * Copyright (C) 2006 Andre Cianfarani - * Copyright (C) 2006 Jean Heimburger +/* Copyright (C) 2006 Jean Heimburger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -24,9 +20,9 @@ */ /** - \file htdocs/product.class.php - \ingroup produit - \brief Fichier de la classe des produits prédéfinis + \file htdocs/oscommerce_ws/produits/osc_product.class.php + \ingroup oscommerce_ws/produits/ + \brief Fichier de la classe des produits issus de OSC \version $Revision$ */ @@ -64,9 +60,9 @@ class Osc_product } /** - * \brief Charge le produit/service en mémoire - * \param id Id du produit/service à charger - * \param ref Ref du produit/service à charger + * \brief Charge le produit OsC en mémoire + * \param id Id du produit dans OsC + * \param ref Ref du produit dans OsC (doit être unique dans OsC) * \return int <0 si ko, >0 si ok */ function fetch($id='',$ref='') diff --git a/htdocs/oscommerce_ws/produits/pre.inc.php b/htdocs/oscommerce_ws/produits/pre.inc.php index 9f8c510b4f6..a81913dbeea 100644 --- a/htdocs/oscommerce_ws/produits/pre.inc.php +++ b/htdocs/oscommerce_ws/produits/pre.inc.php @@ -1,6 +1,7 @@ * Copyright (C) 2006 Laurent Destailleur + * Copyright (C) 2006 Jean Heimburger * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -27,7 +28,7 @@ */ require("../../main.inc.php"); -require_once('./osc_product.class.php'); +require("./osc_product.class.php"); function llxHeader($head = "", $urlp = "") { @@ -40,7 +41,9 @@ function llxHeader($head = "", $urlp = "") $menu->add(DOL_URL_ROOT."/oscommerce_ws/index.php", $langs->trans("OSCommerceShop")); $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/produits/", $langs->trans("Products")); - + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/clients/", $langs->trans("Clients")); + $menu->add_submenu(DOL_URL_ROOT."/oscommerce_ws/commandes/", $langs->trans("Commandes")); + left_menu($menu->liste); } diff --git a/htdocs/oscommerce_ws/ws_server/ws_articles.php b/htdocs/oscommerce_ws/ws_server/ws_articles.php index 8388ca2a9b5..a43599e8958 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_articles.php +++ b/htdocs/oscommerce_ws/ws_server/ws_articles.php @@ -1,4 +1,25 @@ + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Source$ + * + */ + set_magic_quotes_runtime(0); require_once("./includes/configure.php"); @@ -17,8 +38,8 @@ $s->register('get_listearticles'); function get_article($id='',$ref='') { //on se connecte - if (!($connexion = mysql_connect(OSC_DB_SERVER, OSC_DB_SERVER_USERNAME, OSC_DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); - if (!($db = mysql_select_db(OSC_DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); //on recherche $sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, p.products_price, d.products_name, d.products_description, m.manufacturers_name, m.manufacturers_id"; @@ -49,11 +70,11 @@ return $res_article; function get_listearticles() { //on se connecte - if (!($connexion = mysql_connect(OSC_DB_SERVER, OSC_DB_SERVER_USERNAME, OSC_DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); - if (!($db = mysql_select_db(OSC_DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); //on recherche - $sql = "SELECT p.products_id, p.products_model, p.products_quantity, p.products_status, d.products_name, m.manufacturers_name, m.manufacturers_id"; + $sql = "SELECT p.products_id as OSC_id, p.products_model as model, p.products_quantity as quantity, p.products_status as status, d.products_name as name, m.manufacturers_name as manufacturer, m.manufacturers_id"; $sql .= " FROM products as p, products_description as d, manufacturers as m"; $sql .= " WHERE p.products_id = d.products_id AND d.language_id =" . OSC_LANGUAGE_ID; $sql .= " AND p.manufacturers_id=m.manufacturers_id"; diff --git a/htdocs/oscommerce_ws/ws_server/ws_customers.php b/htdocs/oscommerce_ws/ws_server/ws_customers.php new file mode 100644 index 00000000000..583df35af2f --- /dev/null +++ b/htdocs/oscommerce_ws/ws_server/ws_customers.php @@ -0,0 +1,72 @@ + + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Source$ + * + */ + +set_magic_quotes_runtime(0); + +// Soap Server. +require_once('./lib/nusoap.php'); + +require_once('./includes/configure.php'); + +// Create the soap Object +$s = new soap_server; + +// Register the methods available for clients +$s->register('get_Client'); + +// méthodes +function get_Client($custid='') { + +//on se connecte + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + +//la requête + $sql = "SELECT c.customers_id, a.entry_company, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_postcode, a.entry_city, c.customers_telephone, c.customers_fax, c.customers_email_address, a.entry_country_id, b.countries_iso_code_2, b.countries_name "; + $sql .= " from customers c JOIN address_book a ON a.customers_id = c.customers_id JOIN countries b ON b.countries_id = a.entry_country_id JOIN orders o ON o.customers_id = c.customers_id "; +if ($custid > 0) $sql .= "WHERE c.customers_id = ".$custid; + $sql .= " GROUP BY c.customers_id ORDER BY c.customers_id"; + + if (!($resquer = mysql_query($sql,$connexion))) return new soap_fault("Server", "MySQL 3 ".$sql, mysql_error()); + +// $result[$i] = $numrows." lignes trouvées ".$sql; + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 4", "client inexistant ".$sql); + break; + default : + $i = 0; + while ( $i < $numrows) { + $result[$i] = mysql_fetch_array($resquer, MYSQL_ASSOC); + $i++; + } + break; + } + mysql_close($connexion); + /* Sends the results to the client */ +return $result; +} + +// Return the results. +$s->service($HTTP_RAW_POST_DATA); + +?> diff --git a/htdocs/oscommerce_ws/ws_server/ws_orders.php b/htdocs/oscommerce_ws/ws_server/ws_orders.php index 4068163ebe9..7f2d834b3c2 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_orders.php +++ b/htdocs/oscommerce_ws/ws_server/ws_orders.php @@ -1,11 +1,24 @@ + * + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + * + * $Source$ + * + */ set_magic_quotes_runtime(0); // Soap Server. @@ -19,6 +32,8 @@ $s = new soap_server; // Register the methods available for clients $s->register('get_CAmensuel'); $s->register('get_orders'); +$s->register('get_lastOrderClients'); +$s->register('get_Order'); /*---------------------------------------------- * renvoie un tableau avec le CA mensuel réalisé @@ -26,8 +41,8 @@ $s->register('get_orders'); function get_CAmensuel() { //on se connecte - if (!($connexion = mysql_connect(OSC_DB_SERVER, OSC_DB_SERVER_USERNAME, OSC_DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); - if (!($db = mysql_select_db(OSC_DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); //la requête $sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois"; @@ -58,9 +73,9 @@ return $result; function get_orders($limit='', $status='') { //on se connecte - if (!($connexion = mysql_connect(OSC_DB_SERVER, OSC_DB_SERVER_USERNAME, OSC_DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); - if (!($db = mysql_select_db(OSC_DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); - + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + //on recherche $sql = "SELECT o.orders_id, o.customers_name, o.date_purchased, t.value, o.payment_method"; $sql .= " FROM orders_total as t JOIN orders as o on o.orders_id = t.orders_id "; @@ -89,6 +104,103 @@ if ($limit > 0) $sql .= " LIMIT ".$limit; return $result; } + +function get_lastOrderClients($id='',$name='',$limit='') { + +//on se connecte + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + +//on recherche + $sql = "SELECT o.orders_id, o.customers_name, o.delivery_country, o.date_purchased, t.value, s.orders_status_name as statut"; + $sql .= " FROM orders_total as t JOIN orders as o on o.orders_id = t.orders_id "; + $sql .= " JOIN orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1"; + $sql .= " WHERE t.class = 'ot_subtotal' order by o.date_purchased desc"; + if ($limit > 0) $sql .= " LIMIT ".$limit; + + if (!($resquer = mysql_query($sql,$connexion))) return new soap_fault("Server", "MySQL 3 ".$sql, mysql_error()); + $result =''; + + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 4", "produit inexistant"); + break; + default : + $i = 0; + while ( $i < $numrows) { + $result[$i] = mysql_fetch_array($resquer, MYSQL_ASSOC); + $i++; + } + break; + } + mysql_close($connexion); + /* Sends the results to the client */ +return $result; +} + +//renvoie la commande $id ou toute la liste des commandes si $id = 0 + +function get_Order($orderid="0") +{ + +//on se connecte + if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connection impossible"); + if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error()); + +//on recherche la commande +$sql = "SELECT o.orders_id, o.customers_name, o.customers_id, o.date_purchased, t.value, o.payment_method "; +$sql .= " FROM orders_total as t JOIN orders as o on o.orders_id = t.orders_id "; +$sql .= " WHERE t.class = 'ot_subtotal'"; +if ($orderid > 0) $sql .= " and o.orders_id = ".$orderid; +$sql .= " ORDER BY o.date_purchased desc"; + + + if (!($resquer = mysql_query($sql,$connexion))) return new soap_fault("Server", "MySQL 3 ".$sql, mysql_error()); + $result =''; + + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 4", "commande inexistante"); + break; + default : + $i = 0; + while ( $i < $numrows) { + $result[$i] = mysql_fetch_array($resquer, MYSQL_ASSOC); + $i++; + } + break; + } + $j = $i--; + +if ($orderid > 0) +{ + //on recherche les lignes de la commande + $sql = "SELECT l.products_id, l.products_name, l.products_price, l.final_price, l.products_tax, l.products_quantity "; + $sql .= " FROM orders_products l "; + $sql .= " WHERE l.orders_id = ".$orderid; + + + if (!($resquer = mysql_query($sql,$connexion))) return new soap_fault("Server", "MySQL 3 ".$sql, mysql_error()); + + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 5", "commande sans articles"); + break; + default : + + while ( $i < $numrows) { + $result[$j + $i] = mysql_fetch_array($resquer, MYSQL_ASSOC); + $i++; + } + break; + } +} +mysql_close($connexion); + /* Sends the results to the client */ +return $result; +} + + // Return the results. $s->service($HTTP_RAW_POST_DATA);