diff --git a/htdocs/oscommerce_ws/commandes/fiche.php b/htdocs/oscommerce_ws/commandes/fiche.php index 722fec0a760..299cad0d23f 100644 --- a/htdocs/oscommerce_ws/commandes/fiche.php +++ b/htdocs/oscommerce_ws/commandes/fiche.php @@ -23,6 +23,7 @@ require("./pre.inc.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); require_once("../includes/configure.php"); require_once("../clients/osc_customer.class.php"); +require_once("../produits/osc_product.class.php"); llxHeader(); @@ -35,14 +36,22 @@ if ($action == '' && !$cancel) { if ( !$result) { + $osc_prod = new Osc_Product($db); print '
Fiche commande OSC : '.$osc_order->osc_orderid.'

'; print ''; print ''; print ''; - print ''; + print ''; print ''; print ''; + print "
client OSC'.$osc_order->osc_custid.'
Nom client'.$osc_order->osc_custname.'
Montant'.$osc_order->osc_ordertotal.'
Montant'.convert_price($osc_order->osc_ordertotal).'
Date commande'.$osc_order->osc_orderdate.'
Méthode de paiement'.$osc_order->osc_orderpaymet.'
"; + print ''; + // les articles + for ($l=0;$l < sizeof($osc_order->osc_lines); $l++) + { + print ''; + } print "
'.$osc_order->osc_lines[$l]["products_id"].''.$osc_prod->get_productid($osc_order->osc_lines[$l]["products_id"]).''.$osc_order->osc_lines[$l]["products_name"].''.convert_price($osc_order->osc_lines[$l]["products_price"]).''.$osc_order->osc_lines[$l]["quantity"].'
"; /* ************************************************************************** */ @@ -87,7 +96,8 @@ if ($action == '' && !$cancel) { if ( !$result ) { $commande = $osc_order->osc2dolibarr($_GET["orderid"]); - } + } + /* utilisation de la table de transco*/ if ($osc_order->get_orderid($osc_order->osc_orderid)>0) { @@ -141,8 +151,19 @@ if ($action == '' && !$cancel) { } } } - - $id = $commande->create($user); +// vérifier l'existence des produits commandés + $osc_product = new Osc_Product($db); + $err = 0; + + for ($lig = 0; $lig < sizeof($commande->lines); $lig++) + { + if (! $commande->lines[$lig]->fk_product) $err ++; + } + if ($err > 0) { + print ("

Des produits de la commande sont inexistants

"); + $id =-9; + } + else $id = $commande->create($user); if ($id > 0) { @@ -150,7 +171,7 @@ if ($action == '' && !$cancel) { print '
création réussie nouvelle commande '.$id; $res = $osc_order->transcode($osc_order->osc_orderid,$id); print 'pour la commande osc : '.$osc_order->osc_orderid.'

'; - print ''.$langs->trans("Retour").''; + print '

'.$langs->trans("Retour").'

'; print "\n
\n"; if ($id > 0) exit; @@ -182,6 +203,7 @@ if ($action == '' && !$cancel) { } else print '
update impossible $id : '.$id.'
'; } + print '

'.$langs->trans("Retour").'

'; } } diff --git a/htdocs/oscommerce_ws/commandes/index.php b/htdocs/oscommerce_ws/commandes/index.php index d93db02bc74..14cec607d54 100644 --- a/htdocs/oscommerce_ws/commandes/index.php +++ b/htdocs/oscommerce_ws/commandes/index.php @@ -69,6 +69,7 @@ elseif (!($err = $client->getError()) ) print "Date"; print "Montant"; print 'Paiement'; + print 'Statut'; print 'Importer'; print "\n"; @@ -81,9 +82,10 @@ elseif (!($err = $client->getError()) ) print ''.$ordid." \n"; print "".$result[$i][customers_name]."\n"; print "".$result[$i][date_purchased]."\n"; - print "".$result[$i][value]."\n"; + $tot = convert_price($result[$i][total]) + convert_price($result[$i][port]); + print "".$tot."\n"; print ''.' '.$result[$i][payment_method]."\n"; -// print ''/*.$result[$i][customers_telephone]*/."\n"; + print ''.$result[$i][statut]."\n"; if ($ordid) $lib = "modifier"; else $lib = "importer"; print ''.$lib."\n"; diff --git a/htdocs/oscommerce_ws/commandes/osc_order.class.php b/htdocs/oscommerce_ws/commandes/osc_order.class.php index 0244e618ffa..19e95fcb935 100644 --- a/htdocs/oscommerce_ws/commandes/osc_order.class.php +++ b/htdocs/oscommerce_ws/commandes/osc_order.class.php @@ -30,7 +30,7 @@ require("../clients/osc_customer.class.php"); require("../produits/osc_product.class.php"); require_once(DOL_DOCUMENT_ROOT."/commande/commande.class.php"); - +require_once("../includes/configure.php"); /** @@ -49,6 +49,7 @@ class Osc_order var $osc_ordertotal; var $osc_orderpaymet; var $osc_orderport; + var $osc_orderstatus; var $osc_lines = array(); @@ -154,7 +155,8 @@ class Osc_order $commande->socid = $clientid; $commande->ref = $this->osc_orderid; - $commande->date = $this->orderdate; + $commande->date = $this->osc_orderdate; + $commande->date_commande = $this->osc_orderdate; /* on force */ $commande->statut = 0; //à voir $commande->source = 0; // à vérifier @@ -164,19 +166,31 @@ class Osc_order for ($i = 0; $i < sizeof($this->osc_lines);$i++) { $commande->lines[$i]->libelle = $this->osc_lines[$i][products_id]; $commande->lines[$i]->desc = $this->osc_lines[$i][products_name]; - $commande->lines[$i]->price = $this->osc_lines[$i][products_price]; - $commande->lines[$i]->subprice = $this->osc_lines[$i][products_price]; + $commande->lines[$i]->price = convert_price($this->osc_lines[$i][products_price]); + $commande->lines[$i]->subprice = convert_price($this->osc_lines[$i][products_price]); $commande->lines[$i]->qty = $this->osc_lines[$i][quantity]; $commande->lines[$i]->tva_tx = $this->osc_lines[$i][products_tax]; $commande->lines[$i]->fk_product = $oscproduct->get_productid($this->osc_lines[$i][products_id]); $commande->lines[$i]->remise_percent = 0; // à calculer avec le finalprice } + // les frais de port + $fp = sizeof($this->osc_lines); + $commande->lines[$fp]->libelle = "Frais de port"; + $commande->lines[$fp]->desc = "Frais de port"; + $commande->lines[$fp]->price = convert_price($this->osc_orderport); + $commande->lines[$fp]->subprice = convert_price($this->osc_orderport); + $commande->lines[$fp]->qty = 1; + $commande->lines[$fp]->tva_tx = 0; + $commande->lines[$fp]->fk_product = FK_PORT; + $commande->lines[$fp]->remise_percent = 0; return $commande; } } - /** + + +/** * \brief Mise à jour de la table de transition * \param oscid Id du produit dans OsC * \param prodid champ référence diff --git a/htdocs/oscommerce_ws/includes/configure.php b/htdocs/oscommerce_ws/includes/configure.php index 7e4ce8384c2..856b8fcc879 100644 --- a/htdocs/oscommerce_ws/includes/configure.php +++ b/htdocs/oscommerce_ws/includes/configure.php @@ -7,12 +7,26 @@ ----------------------------------------------*/ //base url des webservices -define(OSCWS_DIR,'http://www.tiaris.info/ws_OSC'); -//define(OSCWS_DIR,'http://www.tiaris.info/ws_OSC'); +define(OSCWS_DIR,'http://www.tiaris.info/catalog/ws_OSC/'); //affichages dans la page d'accueil define(OSC_MAXNBCOM, 5); define(OSC_ORDWAIT,'4'); // code du statut de commande en attente define(OSC_ORDPROCESS,'1'); // code du statut de commande en traitement // -define(OSC_ENTREPOT, 1); //l'entrepot lié au stock du site web +define(OSC_ENTREPOT, 1); //l'entrepot lié au stock du site web +define(TX_CURRENCY, 1); // le taux de conversion monnaie site osc - monnaie dolibarr +define(NB_DECIMALS, 0); +define(FK_PORT, 0); // l'id du service frais de port défini. + +// fonctions +/** +* \brief assure la conversion en monnaie de dolibarr +* \param oscid Id du produit dans OsC +* \param prodid champ référence +* \return int <0 si ko, >0 si ok +*/ + function convert_price($price) + { + return round($price * TX_CURRENCY, NB_DECIMALS); + } ?> diff --git a/htdocs/oscommerce_ws/index.php b/htdocs/oscommerce_ws/index.php index ea68a563348..0586cd4bb4b 100644 --- a/htdocs/oscommerce_ws/index.php +++ b/htdocs/oscommerce_ws/index.php @@ -30,6 +30,7 @@ require("./pre.inc.php"); $langs->load("boutique"); +$langs->load("orders"); llxHeader("",$langs->trans("OSCOmmerceShop")); @@ -60,13 +61,15 @@ $client = new soapclient(OSCWS_DIR."ws_orders.php"); print_titre($langs->trans('SalesTurnover')); print ''; -print ''; +print ''; +print ''; print ''; // Call the WebService and store its result in $result. $result = $client->call("get_CAmensuel",$parameters ); if ($client->fault) { dolibarr_print_error('',"Erreur de connection "); + print_r($client->faultstring); } elseif (!($err = $client->getError()) ) { @@ -80,8 +83,9 @@ elseif (!($err = $client->getError()) ) { $var=!$var; print ""; - print ''; - print ''; + print ''; + print ''; + print ''; print "\n"; $i++; @@ -127,7 +131,7 @@ elseif (!($err = $client->getError()) ) { while ($i < $num) { $var=!$var; print ""; - print ''; + print ''; $i++; } } @@ -163,10 +167,10 @@ elseif (!($err = $client->getError()) ) { $num = min($num,OSC_MAXNBCOM); while ($i < $num) { - print ""; - print ''; - $i++; $var=!$var; + print ""; + print ''; + $i++; } } } @@ -201,7 +205,7 @@ elseif (!($err = $client->getError()) ) { while ($i < $num) { print ""; - print ''; + print ''; $i++; $var=!$var; } @@ -240,7 +244,7 @@ elseif (!($err = $client->getError()) ) { while ($i < $num) { print ""; - print ""; + print ""; $i++; $var=!$var; } diff --git a/htdocs/oscommerce_ws/produits/fiche.php b/htdocs/oscommerce_ws/produits/fiche.php index 119a12a911f..27ba76fe580 100644 --- a/htdocs/oscommerce_ws/produits/fiche.php +++ b/htdocs/oscommerce_ws/produits/fiche.php @@ -88,17 +88,7 @@ if ($action == '' && !$cancel) { print '
erreur 1
'; // exit; } - /* initialisation */ - $product->ref = $osc_prod->osc_ref; - $product->libelle = $osc_prod->osc_name; - $product->description = $osc_prod->osc_desc; - $product->price = $osc_prod->osc_price; - $product->tva_tx = $osc_prod->osc_tva; - $product->type = 0; - $product->seuil_stock_alerte = 0; /* on force */ - /* on force */ - $product->catid = 0; /* à voir avec la gestion des catégories */ - $product->status = 1; /* en vente */ + $product = $osc_prod->osc2dolibarr($_GET['id']); } /* utilisation de la table de transco*/ @@ -106,7 +96,8 @@ if ($action == '' && !$cancel) { { print '

Ce produit existe déjà

'; } - else { + else + { $id = $product->create($user); if ($id > 0) @@ -129,31 +120,36 @@ if ($action == '' && !$cancel) { $_GET["action"] = "create"; $_GET["type"] = $_POST["type"]; } - if ($id == -2) - { - /* la référence existe on fait un update */ - $product_control = new Product($db); - if ($_error == 1) - { - print '
erreur 1
'; - exit; - } - $id = $product_control->fetch($ref = $osc_prod->osc_ref); + if ($id == -2) + { + /* la référence existe on fait un update */ + $product_control = new Product($db); + if ($_error == 1) + { + print '
erreur 1
'; + // exit; + } + $id = $product_control->fetch($ref = $osc_prod->osc_ref); - if ($id > 0) - { - $id = $product->update($id, $user); - if ($id > 0) { - $id_entrepot = 1; - $id = $product->correct_stock($id_entrepot,$osc_prod->osc_stock); + if ($id > 0) + { + $id = $product->update($id, $user); + if ($id > 0) + { + $id_entrepot = 1; + $id = $product->correct_stock($user, $id_entrepot,$osc_prod->osc_stock, 0); + } + else print '
Erreur update '.$product->error().'
'; } - else print '
Erreur update '.$id.'
'; + else print '
update impossible $id : '.$product_control->error().'
'; } - else print '
update impossible $id : '.$id.'
'; - } - } - } - + if ($id == -1) + { + print '

erreur'.$product->error().'

'; + } + print '

'.$langs->trans("Retour").'

'; + } + } } llxFooter('$Date$ - $Revision$'); diff --git a/htdocs/oscommerce_ws/produits/osc_product.class.php b/htdocs/oscommerce_ws/produits/osc_product.class.php index 2a6b752887a..adb9a72b93b 100644 --- a/htdocs/oscommerce_ws/produits/osc_product.class.php +++ b/htdocs/oscommerce_ws/produits/osc_product.class.php @@ -116,6 +116,35 @@ class Osc_product return 0; } +// renvoie un objet commande dolibarr + function osc2dolibarr($osc_productid) + { + + $result = $this->fetch($osc_productid); + if ( !$result ) + { + $product = new Product($this->db); + if ($_error == 1) + { + print '
erreur 1
'; + return ''; + } + /* initialisation */ + $product->ref = $this->osc_ref; + $product->libelle = $this->osc_name; + $product->description = $this->osc_desc; + $product->price = convert_price($this->osc_price); + $product->tva_tx = $this->osc_tva; + $product->type = 0; + $product->seuil_stock_alerte = 0; /* on force */ + /* on force */ + $product->catid = 0; /* à voir avec la gestion des catégories */ + $product->status = 1; /* en vente */ + + return $product; + } + + } /** * \brief Mise à jour de la table de transition * \param oscid Id du produit dans OsC @@ -157,7 +186,7 @@ class Osc_product } return 0; } -// converti le client osc en client dolibarr +// converti le produit osc en produit dolibarr function get_productid($osc_product) { diff --git a/htdocs/oscommerce_ws/ws_server/includes/configure.php b/htdocs/oscommerce_ws/ws_server/includes/configure.php index e3eec2b7272..da209f33675 100644 --- a/htdocs/oscommerce_ws/ws_server/includes/configure.php +++ b/htdocs/oscommerce_ws/ws_server/includes/configure.php @@ -7,10 +7,10 @@ ----------------------------------------------*/ /* paramètres de connexion à OSC */ -define("OSC_DB_SERVER",""); -define("OSC_DB_SERVER_USERNAME", ""); -define("OSC_DB_SERVER_PASSWORD", ""); -define("OSC_DB_DATABASE", ""); +define("DB_SERVER","localhost"); +define("DB_SERVER_USERNAME", "root"); +define("DB_SERVER_PASSWORD", ""); +define("DB_DATABASE", "tahitirimai"); /* constantes utiles */ define("OSC_LANGUAGE_ID",1); diff --git a/htdocs/oscommerce_ws/ws_server/ws_articles.php b/htdocs/oscommerce_ws/ws_server/ws_articles.php index 197237390bd..4d04e3285e7 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_articles.php +++ b/htdocs/oscommerce_ws/ws_server/ws_articles.php @@ -29,9 +29,10 @@ require_once('./lib/nusoap.php'); // Create the soap Object $s = new soap_server; -$ns='oscommerce'; +/* $ns='oscommerce'; $s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns); $s->wsdl->schemaTargetNamespace=$ns; +*/ // Register a method available for clients $s->register('get_article'); diff --git a/htdocs/oscommerce_ws/ws_server/ws_customers.php b/htdocs/oscommerce_ws/ws_server/ws_customers.php index 6998f267225..d8db1cd5e44 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_customers.php +++ b/htdocs/oscommerce_ws/ws_server/ws_customers.php @@ -29,9 +29,10 @@ require_once('./includes/configure.php'); // Create the soap Object $s = new soap_server; -$ns='oscommerce'; +/* $ns='oscommerce'; $s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns); $s->wsdl->schemaTargetNamespace=$ns; +*/ // Register the methods available for clients $s->register('get_Client'); diff --git a/htdocs/oscommerce_ws/ws_server/ws_orders.php b/htdocs/oscommerce_ws/ws_server/ws_orders.php index 018896a1388..3342ed07550 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_orders.php +++ b/htdocs/oscommerce_ws/ws_server/ws_orders.php @@ -1,4 +1,4 @@ - * * @@ -19,24 +19,21 @@ * $Source$ * */ -set_magic_quotes_runtime(0); - -// Soap Server. -require_once('./lib/nusoap.php'); +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; -$ns='oscommerce'; -$s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns); -$s->wsdl->schemaTargetNamespace=$ns; - -// Register the methods available for clients + +// Create the soap Object +$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'); +$s->register('get_Order'); /*---------------------------------------------- * renvoie un tableau avec le CA mensuel réalisé @@ -44,22 +41,23 @@ $s->register('get_Order'); function get_CAmensuel() { //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 (!($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"; + $sql = "SELECT sum(t.value) as value, MONTH(o.date_purchased) as mois, YEAR(o.date_purchased) as an"; $sql .= " FROM orders_total as t"; $sql .= " JOIN orders as o ON o.orders_id = t.orders_id"; - $sql .= " WHERE t.class = 'ot_subtotal' AND YEAR(o.date_purchased) = YEAR(now()) "; - $sql .= " GROUP BY mois ORDER BY mois"; + $sql .= " WHERE t.class = 'ot_subtotal' "; +//AND YEAR(o.date_purchased) = YEAR(now()) "; + $sql .= " GROUP BY an, mois ORDER BY an desc ,mois desc limit 1,12"; 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 4", "produit inexistant"); - break; + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 4", $sql); + break; default : $i = 0; while ( $i < $numrows) { @@ -76,7 +74,7 @@ return $result; function get_orders($limit='', $status='') { //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 (!($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 @@ -90,10 +88,10 @@ 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 : + switch ($numrows = mysql_numrows($resquer)) { + case 0 : //return new soap_fault("Server", "MySQL 4", "produit inexistant"); - break; + break; default : $i = 0; while ( $i < $numrows) { @@ -111,23 +109,23 @@ 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 (!($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"; + $sql .= " WHERE t.class = 'ot_subtotal' and o.orders_status < 5 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 : + switch ($numrows = mysql_numrows($resquer)) { + case 0 : return new soap_fault("Server", "MySQL 4", "produit inexistant"); - break; + break; default : $i = 0; while ( $i < $numrows) { @@ -147,24 +145,31 @@ 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 (!($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 = "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 = "SELECT o.orders_id, o.customers_name, o.customers_id, o.date_purchased, o.payment_method, t.value as total, sum(p.value) as port, s.orders_status_name as statut "; +$sql .= " FROM orders as o "; +$sql .= " JOIN orders_total as t on o.orders_id = t.orders_id and t.class = 'ot_subtotal' "; +$sql .= " JOIN orders_total as p on o.orders_id = p.orders_id and (p.class = 'ot_shipping' OR p.class = 'ot_fixed_payment_chg') "; +$sql .= " JOIN orders_status as s on o.orders_status = s.orders_status_id and s.language_id = 1"; +$sql .= " WHERE o.orders_status < 5 "; // élimine les commandes annulées, remboursées +if ($orderid > 0) $sql .= " AND o.orders_id = ".$orderid; +$sql .= " GROUP BY p.orders_id "; $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; + switch ($numrows = mysql_numrows($resquer)) { + case 0 : + return new soap_fault("Server", "MySQL 4", "commande inexistante ".$sql); + break; default : $i = 0; while ( $i < $numrows) { @@ -185,10 +190,10 @@ if ($orderid > 0) if (!($resquer = mysql_query($sql,$connexion))) return new soap_fault("Server", "MySQL 3 ".$sql, mysql_error()); - switch ($numrows = mysql_numrows($resquer)) { - case 0 : + switch ($numrows = mysql_numrows($resquer)) { + case 0 : return new soap_fault("Server", "MySQL 5", "commande sans articles"); - break; + break; default : while ( $i < $numrows) { @@ -203,8 +208,8 @@ mysql_close($connexion); return $result; } - -// Return the results. + +// Return the results. $s->service($HTTP_RAW_POST_DATA); - -?> + +?> diff --git a/htdocs/oscommerce_ws/ws_server/ws_test.php b/htdocs/oscommerce_ws/ws_server/ws_test.php index a9d33d13685..d53f8f4bdac 100644 --- a/htdocs/oscommerce_ws/ws_server/ws_test.php +++ b/htdocs/oscommerce_ws/ws_server/ws_test.php @@ -1,25 +1,25 @@ -configureWSDL('WebServicesOSCommerceForDolibarr',$ns); $s->wsdl->schemaTargetNamespace=$ns; - -// Register a method available for clients -$s->register('hello'); - -function hello($name){ - -$returnedString = "Hello de Tetiaroa ".$name." !"; -return $returnedString; - -} - -// Return the results. -$s->service($HTTP_RAW_POST_DATA); -?> + +// Register a method available for clients +$s->register('hello'); + +function hello($name){ + +$returnedString = "Hello de Tetiaroa ".$name." !"; +return $returnedString; + +} + +// Return the results. +$s->service($HTTP_RAW_POST_DATA); +?>
'.$langs->trans("Description").'
'.$langs->trans("année").''.$langs->trans("mois").''.$langs->trans("Total").'
'.$result[$i][mois].''.price($result[$i][value]).''.$result[$i][an].''.$result[$i][mois].''.convert_price($result[$i][value]).'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.price($result[$i][value]).''.$result[$i][payment_method].'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.convert_price($result[$i][value]).''.$result[$i][payment_method].'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.price($result[$i][value]).''.$result[$i][payment_method].'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.convert_price($result[$i][value]).''.$result[$i][payment_method].'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.price($result[$i][value]).''.$result[$i][payment_method].'
'.$result[$i][orders_id].''.$result[$i][customers_name].''.convert_price($result[$i][value]).''.$result[$i][payment_method].'
".$result[$i][date_purchased]."".$result[$i][customers_name]."".$result[$i][delivery_country]."".price($result[$i][value])."".$result[$i][payment_method]."".$result[$i][orders_id]."".$result[$i][statut]."
".$result[$i][date_purchased]."".$result[$i][customers_name]."".$result[$i][delivery_country]."".convert_price($result[$i][value])."".$result[$i][payment_method]."".$result[$i][orders_id]."".$result[$i][statut]."