diff --git a/htdocs/langs/en_US/admin.lang b/htdocs/langs/en_US/admin.lang
index f1b7fbde3d1..d8a7bf616d9 100644
--- a/htdocs/langs/en_US/admin.lang
+++ b/htdocs/langs/en_US/admin.lang
@@ -339,7 +339,7 @@ Module700Desc=Donations' management
Module800Name=OSCommerce by direct database access
Module800Desc=Interface to show an OSCommerce or OSCSS shop via direct database access
Module900Name=OSCommerce by WS
-Module900Desc=Interface to show an OSCommerce shop via Web services.\nThis module requiere you to install components from /oscommerce_ws/ws_server into your OSCommerce server. See README file in /oscommerce_ws/ws_server.
+Module900Desc=Interface to show an OSCommerce shop via Web services. This module requiere you to install components from /oscommerce_ws/ws_server into your OSCommerce server. See README file in /oscommerce_ws/ws_server.
Module1200Name=Mantis
Module1200Desc=Mantis integration
Module1400Name=Accounting
diff --git a/htdocs/langs/fr_FR/admin.lang b/htdocs/langs/fr_FR/admin.lang
index e30a6d7610e..887e826f3ae 100644
--- a/htdocs/langs/fr_FR/admin.lang
+++ b/htdocs/langs/fr_FR/admin.lang
@@ -339,7 +339,7 @@ Module700Desc = Gestion des dons
Module800Name = OSCommerce direct
Module800Desc = Interface de visualisation d'une boutique OSCommerce ou OSCSS par accès direct en base.
Module900Name = OSCommerce by WS
-Module900Desc = Interface de visualisation d'une boutique OSCommerce par accès via des Web services.\nCe module requiert d'installer les fichiers de /oscommerce_ws/ws_server sur OSCommerce. Voir fichier README dans /oscommerce_ws/ws_server.
+Module900Desc = Interface de visualisation d'une boutique OSCommerce par accès via des Web services. Ce module requiert d'installer les fichiers de /oscommerce_ws/ws_server sur OSCommerce. Voir fichier README dans /oscommerce_ws/ws_server.
Module1200Name = Mantis
Module1200Desc = Interface avec le bug tracking Mantis
Module1400Name = Comptabilité
diff --git a/htdocs/oscommerce_ws/clients/index.php b/htdocs/oscommerce_ws/clients/index.php
index 27a590f2cda..69cb34d2dc8 100644
--- a/htdocs/oscommerce_ws/clients/index.php
+++ b/htdocs/oscommerce_ws/clients/index.php
@@ -44,6 +44,10 @@ $parameters = array("custid"=>"0");
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."ws_customers.php");
+if ($client)
+{
+ $client->soap_defencoding='UTF-8';
+}
$result = $client->call("get_Client",$parameters );
@@ -61,7 +65,7 @@ elseif (!($err = $client->getError()) )
// un client osc
$OscClient = new Osc_Customer($db);
-
+
if ($num > 0) {
print "
";
print '';
@@ -74,7 +78,7 @@ elseif (!($err = $client->getError()) )
print '| '.$langs->trans("Phone").' | ';
print 'Importer | ';
print "
\n";
-
+
while ($i < $num) {
$var=!$var;
$custid = $OscClient->get_clientid($result[$i][customers_id]);
@@ -89,7 +93,7 @@ elseif (!($err = $client->getError()) )
print ''.$result[$i][customers_telephone]." | \n";
if ($custid) $lib = "modifier";
else $lib = "importer";
-
+
print '".$lib." | \n";
print "\n";
$i++;
@@ -101,7 +105,7 @@ elseif (!($err = $client->getError()) )
}
}
else {
- dol_print_error('',"Erreur service web ".$err);
+ print $client->getHTTPBody($client->response);
}
print "
";
diff --git a/htdocs/oscommerce_ws/clients/osc_customer.class.php b/htdocs/oscommerce_ws/clients/osc_customer.class.php
index 0e7159f42d4..e467c19bd8d 100644
--- a/htdocs/oscommerce_ws/clients/osc_customer.class.php
+++ b/htdocs/oscommerce_ws/clients/osc_customer.class.php
@@ -55,12 +55,12 @@ class Osc_customer
/**
* \brief Constructeur de la classe
* \param id Id client (0 par defaut)
- */
+ */
function Osc_customer($DB, $id=0) {
global $langs;
global $conf;
-
+
$this->osc_custid = $id ;
/* les initialisations n�cessaires */
@@ -71,14 +71,14 @@ class Osc_customer
/**
* \brief Charge le client OsC en m�moire
-* \param id Id du client dans OsC
+* \param id Id du client dans OsC
* \return int <0 si ko, >0 si ok
*/
function fetch($id='')
{
global $langs;
global $conf;
-
+
$this->error = '';
dol_syslog("Osc_customer::fetch $id=$id ref=$ref");
// Verification parametres
@@ -99,6 +99,10 @@ class Osc_customer
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."/ws_customers.php");
+ if ($client)
+ {
+ $client->soap_defencoding='UTF-8';
+ }
// Call the WebSeclient->fault)rvice and store its result in $obj
$obj = $client->call("get_Client",$parameters );
@@ -126,14 +130,14 @@ class Osc_customer
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 socid champ soci�t�.rowid
+* \param oscid Id du client dans OsC
+* \param socid champ soci�t�.rowid
* \return int <0 si ko, >0 si ok
*/
function transcode($oscid, $socid)
@@ -167,7 +171,7 @@ class Osc_customer
// $this->db->rollback();
// return -1;
}
- return 0;
+ return 0;
}
// converti le client osc en client dolibarr
@@ -179,10 +183,10 @@ class Osc_customer
$resql=$this->db->query($sql);
$obj = $this->db->fetch_object($resql);
// test d'erreurs
- if ($obj) return $obj->fk_soc[0];
+ if ($obj) return $obj->fk_soc[0];
else return '';
}
}
-
+
?>
diff --git a/htdocs/oscommerce_ws/commandes/index.php b/htdocs/oscommerce_ws/commandes/index.php
index f07a52c1331..a0657b31aa2 100644
--- a/htdocs/oscommerce_ws/commandes/index.php
+++ b/htdocs/oscommerce_ws/commandes/index.php
@@ -45,6 +45,10 @@ $parameters = array("orderid"=>"0");
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."ws_orders.php");
+if ($client)
+{
+ $client->soap_defencoding='UTF-8';
+}
$result = $client->call("get_Order",$parameters );
@@ -62,7 +66,7 @@ elseif (!($err = $client->getError()) )
// une commande osc
$OscOrder = new Osc_Order($db);
-
+
if ($num > 0) {
print "";
print '';
@@ -75,7 +79,7 @@ elseif (!($err = $client->getError()) )
print '| Statut | ';
print 'Importer | ';
print "
\n";
-
+
while ($i < $num) {
$var=!$var;
@@ -102,7 +106,7 @@ elseif (!($err = $client->getError()) )
}
}
else {
- dol_print_error('',"Erreur service web ".$err);
+ print $client->getHTTPBody($client->response);
}
print "
";
diff --git a/htdocs/oscommerce_ws/commandes/osc_order.class.php b/htdocs/oscommerce_ws/commandes/osc_order.class.php
index 1fb26b5aa5d..6644e78ebc9 100644
--- a/htdocs/oscommerce_ws/commandes/osc_order.class.php
+++ b/htdocs/oscommerce_ws/commandes/osc_order.class.php
@@ -57,11 +57,11 @@ class Osc_order
/**
* \brief Constructeur de la classe
* \param id Id client (0 par defaut)
- */
+ */
function Osc_order($DB, $id=0) {
global $langs;
-
+
$this->osc_orderid = $id ;
$this->db = $DB;
/* les initialisations n�cessaires */
@@ -70,14 +70,14 @@ class Osc_order
/**
* \brief Charge la commande OsC en m�moire
-* \param id Id de la commande dans OsC
+* \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 = '';
dol_syslog("Osc_order::fetch $id=$id ");
// Verification parametres
@@ -98,6 +98,10 @@ class Osc_order
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."/ws_orders.php");
+ if ($client)
+ {
+ $client->soap_defencoding='UTF-8';
+ }
// Call the WebSeclient->fault)rvice and store its result in $obj
$obj = $client->call("get_Order",$parameters );
@@ -130,7 +134,7 @@ class Osc_order
$this->error = 'Erreur '.$err ;
return -1;
}
-// print_r($this);
+// print_r($this);
return 0;
}
@@ -149,7 +153,7 @@ class Osc_order
/* initialisation */
$oscclient = new Osc_Customer($this->db);
$clientid = $oscclient->get_clientid($this->osc_custid);
-
+
$oscproduct = new Osc_product($this->db);
$commande->socid = $clientid;
@@ -159,7 +163,7 @@ class Osc_order
/* on force */
$commande->statut = 0; //� voir
$commande->source = 0; // � v�rifier
-
+
//les lignes
for ($i = 0; $i < sizeof($this->osc_lines);$i++) {
@@ -184,15 +188,15 @@ class Osc_order
$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
+* \param oscid Id du produit dans OsC
+* \param prodid champ r�f�rence
* \return int <0 si ko, >0 si ok
*/
function transcode($osc_orderid, $doli_orderid)
@@ -226,7 +230,7 @@ class Osc_order
// $this->db->rollback();
// return -1;
}
- return 0;
+ return 0;
}
// converti le client osc en client dolibarr
@@ -238,7 +242,7 @@ class Osc_order
$resql=$this->db->query($sql);
$obj = $this->db->fetch_object($resql);
// test d'erreurs
- if ($obj) return $obj->fk_commande;
+ if ($obj) return $obj->fk_commande;
else return '';
}
diff --git a/htdocs/oscommerce_ws/includes/configure.php b/htdocs/oscommerce_ws/includes/configure.php
index 3b3ad2f5afc..0fadcf50819 100644
--- a/htdocs/oscommerce_ws/includes/configure.php
+++ b/htdocs/oscommerce_ws/includes/configure.php
@@ -28,7 +28,8 @@
*/
// URL To reach web services
-define(OSCWS_DIR,'http://myoscserver/ws_server/');
+//define(OSCWS_DIR,'http://myoscserver/ws_server/');
+define(OSCWS_DIR,'http://127.0.0.1/oscommerce_ws/ws_server/');
// URL To reach OSCommerce
define(OSC_URL, 'http://myoscserver/'); // url du site OSC
diff --git a/htdocs/oscommerce_ws/index.php b/htdocs/oscommerce_ws/index.php
index ef8494884e2..5d3d45f01e6 100644
--- a/htdocs/oscommerce_ws/index.php
+++ b/htdocs/oscommerce_ws/index.php
@@ -16,13 +16,13 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
+
/**
- \file htdocs/oscommerce_ws/index.php
- \ingroup oscommerce2
- \brief Page accueil zone boutique
- \version $Id$
-*/
+ \file htdocs/oscommerce_ws/index.php
+ \ingroup oscommerce2
+ \brief Page accueil zone boutique
+ \version $Id$
+ */
require("./pre.inc.php");
@@ -37,7 +37,7 @@ print_fiche_titre($langs->trans("OSCommerceShop"));
if (! @ini_get('allow_url_fopen'))
{
$langs->load("errors");
- print ''.$langs->trans("WarningAllowUrlFopenMustBeOn").'
';
+ print ''.$langs->trans("WarningAllowUrlFopenMustBeOn").'
';
}
@@ -56,11 +56,17 @@ require_once("./includes/configure.php");
$parameters = array();
// Set the WebService URL
+//print OSCWS_DIR."ws_orders.php"; exit;
$client = new nusoap_client(OSCWS_DIR."ws_orders.php");
+if ($client)
+{
+ $client->soap_defencoding='UTF-8';
+}
-/*
-/* Chiffre d'affaire
-*/
+
+/*
+ /* Chiffre d'affaire
+ */
print_titre($langs->trans('SalesTurnover'));
@@ -69,36 +75,39 @@ print '| '.$langs->trans("Year").' | ';
print ''.$langs->trans("Month").' | ';
print ''.$langs->trans("Total").' |
';
+
+//$client->setDebugLevel(9);
+
// Call the WebService and store its result in $result.
$result = $client->call("get_CAmensuel",$parameters );
if ($client->fault) {
- dol_print_error('',"Erreur de connexion ");
- print_r($client->faultstring);
+ dol_print_error('',"Erreur de connexion ");
+ print_r($client->faultstring);
}
elseif (!($err = $client->getError()) )
{
$num=0;
- if ($result) $num = sizeof($result);
+ if ($result) $num = sizeof($result);
$var=True;
- $i=0;
+ $i=0;
if ($num > 0) {
- while ($i < $num)
+ while ($i < $num)
{
- $var=!$var;
- print "";
- print '| '.$result[$i][an].' | ';
- print ''.$result[$i][mois].' | ';
- print ''.convert_price($result[$i][value]).' | ';
+ $var=!$var;
+ print "
";
+ print '| '.$result[$i][an].' | ';
+ print ''.$result[$i][mois].' | ';
+ print ''.convert_price($result[$i][value]).' | ';
- print "
\n";
- $i++;
- }
+ print "\n";
+ $i++;
+ }
}
}
else
{
- dol_print_error('',"Erreur du service web ".$err);
+ print $client->getHTTPBody($client->response);
}
@@ -115,40 +124,40 @@ print_titre($langs->trans("Orders"));
print '';
print '';
print '| '.$langs->trans("LastOrders").' |
';
-
+
// Call the WebService and store its result in $result.
$parameters = array("limit"=>OSC_MAXNBCOM);
$result = $client->call("get_orders",$parameters );
if ($client->fault) {
- dol_print_error('',"Erreur de connexion ");
+ dol_print_error('',"Erreur de connexion ");
}
elseif (!($err = $client->getError()) ) {
$num=0;
- if ($result) $num = sizeof($result);
+ if ($result) $num = sizeof($result);
$var=True;
- $i=0;
+ $i=0;
- if ($num > 0) {
-
- $num = min($num,OSC_MAXNBCOM);
- while ($i < $num) {
- $var=!$var;
- print "";
- print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
- $i++;
- }
- }
+ if ($num > 0) {
+
+ $num = min($num,OSC_MAXNBCOM);
+ while ($i < $num) {
+ $var=!$var;
+ print "";
+ print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
+ $i++;
+ }
+ }
}
else {
- dol_print_error('',"Erreur du service web ".$err);
+ print $client->getHTTPBody($client->response);
}
print "
";
/*
* 5 derni�res commandes en attente
-*/
+ */
print '';
print '';
@@ -158,28 +167,28 @@ $parameters = array("limit"=>OSC_MAXNBCOM, "status"=>OSC_ORDWAIT);
$result = $client->call("get_orders",$parameters );
if ($client->fault) {
- dol_print_error('',"Erreur webservice ".$client->faultstring);
+ dol_print_error('',"Erreur webservice ".$client->faultstring);
}
elseif (!($err = $client->getError()) ) {
- $var=True;
- $i=0;
- $num=0;
- if ($result) $num = sizeof($result);
- $langs->load("orders");
+ $var=True;
+ $i=0;
+ $num=0;
+ if ($result) $num = sizeof($result);
+ $langs->load("orders");
- if ($num > 0) {
- $num = min($num,OSC_MAXNBCOM);
+ if ($num > 0) {
+ $num = min($num,OSC_MAXNBCOM);
- while ($i < $num) {
- $var=!$var;
- print "
";
- print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
- $i++;
+ while ($i < $num) {
+ $var=!$var;
+ print "";
+ print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
+ $i++;
}
- }
+ }
}
else {
- dol_print_error('',"Erreur du service web ".$err);
+ print $client->getHTTPBody($client->response);
}
print "
";
@@ -190,41 +199,41 @@ print "
";
print '';
print '';
print '| '.$langs->trans("TreatmentInProgress").' |
';
-
+
$parameters = array("limit"=>OSC_MAXNBCOM, "status"=>OSC_ORDPROCESS);
$result = $client->call("get_orders",$parameters );
if ($client->fault) {
- dol_print_error('',"Erreur webservice ".$client->faultstring);
+ dol_print_error('',"Erreur webservice ".$client->faultstring);
}
elseif (!($err = $client->getError()) ) {
- $var=True;
- $i=0;
- $num=0;
- if ($result) $num = sizeof($result);
- $langs->load("orders");
+ $var=True;
+ $i=0;
+ $num=0;
+ if ($result) $num = sizeof($result);
+ $langs->load("orders");
- if ($num > 0) {
- $num = min($num,OSC_MAXNBCOM);
+ if ($num > 0) {
+ $num = min($num,OSC_MAXNBCOM);
- while ($i < $num) {
- print "";
- print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
- $i++;
- $var=!$var;
+ while ($i < $num) {
+ print "";
+ print '| '.$result[$i][orders_id].' | '.$result[$i][customers_name].' | '.convert_price($result[$i][value]).' | '.$result[$i][payment_method].' |
';
+ $i++;
+ $var=!$var;
}
- }
+ }
}
else {
- dol_print_error('',"Erreur du service web ".$err);
+ print $client->getHTTPBody($client->response);
}
print "
";
print '';
/*
-* Derniers clients qui ont command�
-*/
+ * Derniers clients qui ont command�
+ */
print '';
print '';
@@ -234,29 +243,29 @@ $parameters = array("limit"=>OSC_MAXNBCOM);
$result = $client->call("get_lastOrderClients",$parameters );
if ($client->fault) {
- dol_print_error('',"Erreur webservice ".$client->faultstring);
+ dol_print_error('',"Erreur webservice ".$client->faultstring);
}
elseif (!($err = $client->getError()) ) {
- $var=True;
- $i=0;
- $num=0;
- if ($result) $num = sizeof($result);
- $langs->load("orders");
+ $var=True;
+ $i=0;
+ $num=0;
+ if ($result) $num = sizeof($result);
+ $langs->load("orders");
- if ($num > 0) {
- $num = min($num,OSC_MAXNBCOM);
+ if ($num > 0) {
+ $num = min($num,OSC_MAXNBCOM);
- while ($i < $num) {
- print "
";
- print "| ".$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]." |
";
- $i++;
- $var=!$var;
+ while ($i < $num) {
+ print "";
+ print "| ".$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]." |
";
+ $i++;
+ $var=!$var;
}
- print "
";
- }
+ print "
";
+ }
}
else {
- dol_print_error('',"Erreur du service web ".$err);
+ print $client->getHTTPBody($client->response);
}
diff --git a/htdocs/oscommerce_ws/produits/OSCvente.php b/htdocs/oscommerce_ws/produits/OSCvente.php
index 8574436e641..ae5d155df90 100644
--- a/htdocs/oscommerce_ws/produits/OSCvente.php
+++ b/htdocs/oscommerce_ws/produits/OSCvente.php
@@ -29,7 +29,7 @@ if ($_GET["action"] == 'liste' )
{
// affichage des produits en vente a partir de la tavle de transco
$sql = "SELECT o.doli_prodidp as idp, o.osc_prodid as oscid, o.osc_lastmodif as date ";
- $sql .= "FROM ".MAIN_DB_PREFIX."osc_product as o";
+ $sql .= "FROM ".MAIN_DB_PREFIX."osc_product as o";
if ( $db->query($sql) )
{
@@ -46,7 +46,7 @@ if ($_GET["action"] == 'liste' )
{
$var=!$var;
$obj = $db->fetch_object();
-
+
print '
| '.img_object($langs->trans("ShowProduct"),"Product").' '.$obj->idp.' | ';
print ''.img_object($langs->trans("OscProd"),"Product").' '.$obj->oscid.' |
';
$i++;
@@ -69,50 +69,54 @@ if ($_GET["action"] == 'vendre' )
$prod['desc'] = $product->description;
$prod['quant'] = $_POST["qty"];
$prod['prix'] = convert_backprice($product->price);
- // a gerer $product->tx_tva
+ // a gerer $product->tx_tva
$prod['poids'] = $product->weight;
// gerer $product->weight_units
$prod['dispo'] = '';
$prod['status'] = '1';
$prod['fourn'] = '';
$prod['url'] = '';
-
+
//recherche de l'image
$pdir = get_exdir($product->id,2) . $product->id ."/photos/";
$dir = $conf->produit->dir_output . '/'. $pdir;
$img = $product->liste_photos($dir);
-
+
if (sizeof($img) ==0) $prod['image'] = '';
- else
+ else
{
if ($img[0]['photo_vignette']) $filename=$img[0]['photo_vignette'];
- else $filename=$img[0]['photo'];
+ else $filename=$img[0]['photo'];
$prod['image'] = dol_trunc($filename,16);
}
// print_r($prod);
// print '
';
-
+
set_magic_quotes_runtime(0);
//WebService Client.
require_once(NUSOAP_PATH."/nusoap.php");
-
+
// Creation
// Set the parameters to send to the WebService
$parameters = array("prod"=>$prod);
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."ws_articles.php");
-
+ if ($client)
+ {
+ $client->soap_defencoding='UTF-8';
+ }
+
// Call the WebService and store its result in $result.
- $result = $client->call("create_article",$parameters );
- if ($client->fault)
+ $result = $client->call("create_article",$parameters );
+ if ($client->fault)
{
$this->error="Fault detected";
return -1;
}
- elseif (!($err=$client->getError()) )
+ elseif (!($err=$client->getError()) )
{
if ($result > 0)
{
@@ -151,15 +155,15 @@ if ($_GET["action"] == 'vendre' )
/* ************************************************************************** */
- /* */
- /* Barre d'action */
- /* */
+ /* */
+ /* Barre d'action */
+ /* */
/* ************************************************************************** */
print "\n\n";
-
+
llxFooter('$Date$ - $Revision$');
?>
diff --git a/htdocs/oscommerce_ws/produits/categories.php b/htdocs/oscommerce_ws/produits/categories.php
index af03bbde6e1..0029eaa5547 100644
--- a/htdocs/oscommerce_ws/produits/categories.php
+++ b/htdocs/oscommerce_ws/produits/categories.php
@@ -59,18 +59,18 @@ if ($_REQUEST["action"] == 'maj')
{
if ($_POST["dolicat"]) $dolicatid = $_POST["dolicat"];
if ($_POST["catMere"]) $dolicatid = $_POST["catMere"];
-
-
+
+
$myobject=new Osc_categorie($db);
if ($myobject->fetch_dolicat($dolicatid) <0)
{
$mesg = "erreur dans fetch_dolicat";
}
- elseif ($myobject->id > 0)
+ elseif ($myobject->id > 0)
{
$myobject->dolicatid=$dolicatid;
$myobject->osccatid=$_POST["osccat"];
-
+
$result=$myobject->update($user);
if ($result > 0)
{
@@ -88,7 +88,7 @@ if ($_REQUEST["action"] == 'maj')
{
$myobject->dolicatid=$dolicatid;
$myobject->osccatid=$_POST["osccat"];
-
+
$result=$myobject->create($user);
if ($result > 0)
{
@@ -119,20 +119,20 @@ else if ($_REQUEST["action"] == 'create')
if ($res = 1)
{
$categorie->id_mere = $mere->dolicatid;
- if (! $categorie->id_mere)
+ if (! $categorie->id_mere)
{
$categorie->error = $langs->trans("ErrorNoParentCategory",$langs->transnoentities("Catmere"));
$_GET["action"] = 'create';
$mesg = "* catmerem ".$categorie->id_mere."* ".$_POST["nom"]. " * ".$_POST["description"]." * ".$_POST["visible"]." * ".$_POST["type"]." * ".$_POST['catMere'];
}
}
- else
+ else
{
$categorie->error = $langs->trans("ErrorParent",$langs->transnoentities("Catmere"));
$_GET["action"] = 'create';
$mesg = "* catmerem ".$categorie->id_mere."* ".$_POST["nom"]. " * ".$_POST["description"]." * ".$_POST["visible"]." * ".$_POST["type"]." * ".$_POST['catMere'];
}
-
+
}
else $categorie->id_mere = -1;
@@ -148,7 +148,7 @@ else if ($_REQUEST["action"] == 'create')
$_GET["action"] = 'create';
$mesg = "* ".$_POST["nom"]. " * ".$_POST["description"]." * ".$_POST["visible"]." * ".$_POST["type"]." * ".$_POST['catMere'];
}
-
+
if ($categorie->error =="")
{
if ($cat_id = $categorie->create() > 0)
@@ -159,7 +159,7 @@ else if ($_REQUEST["action"] == 'create')
$myobject->dolicatid=$categorie->id;
$mesg="cat_id recu ".$cat_id." categorie ".$categorie->id." ";
$myobject->osccatid=$_POST["osccat"];
-
+
$result=$myobject->create($user);
if ($result > 0)
{
@@ -174,12 +174,12 @@ else if ($_REQUEST["action"] == 'create')
}
}
$mesg .= ' sortie
'.$categorie->error;
-}
-
+}
+
if ($_REQUEST["action"] == 'import')
{
$osccat = $_GET['catid'];
-
+
}
@@ -191,7 +191,7 @@ if ($_REQUEST["action"] == 'import')
llxHeader();
$html=new Form($db);
-
+
if ($_REQUEST["action"] == 'import')
{
//titre
@@ -200,16 +200,16 @@ if ($_REQUEST["action"] == 'import')
print 'Id | Label | Osc_id | Action | ';
print ''."\n";
print '';
- print '\n";
print '';
+ print '';
print '
';
print "\n";
}
@@ -280,25 +280,29 @@ else
{
dol_print_error();
}
-}
+}
//WebService Client.
require_once(NUSOAP_PATH."/nusoap.php");
require_once("../includes/configure.php");
// Set the parameters to send to the WebService
if ($_GET["catid"]) $catid = $_GET["catid"];
-else $catid= 0;
+else $catid= 0;
$parameters = array("catid"=>$catid);
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."ws_articles.php");
+if ($client)
+{
+ $client->soap_defencoding='UTF-8';
+}
$result = $client->call("get_categorylist",$parameters );
if ($client->fault) {
if ($client->faultcode == 'Server') print 'Il n\'y a pas de cat�gorie fille pour la cat�gorie '.$catid.'
';
else dol_print_error('',"erreur de connexion ".$client->getError());
-
+
}
elseif ( !($err = $client->getError()) )
{
@@ -318,9 +322,9 @@ elseif ( !($err = $client->getError()) )
print "id dolibarr | ";
print "Importer | ";
print "";
-
+
$dolicat = new Osc_Categorie($db);
-
+
while ($i < $num) {
$var=!$var;
print "";
@@ -330,7 +334,7 @@ elseif ( !($err = $client->getError()) )
$dolicatid = $dolicat->fetch_osccat($result[$i]['categories_id']);
if ($dolicat->dolicatid) print '| '.$dolicat->dolicatid.' | ';
else print ' | ';
-
+
//print 'Importer | ';
print ' ';
print "
";
$i++;
diff --git a/htdocs/oscommerce_ws/produits/index.php b/htdocs/oscommerce_ws/produits/index.php
index b2cbc915d44..5dc40bcebf3 100644
--- a/htdocs/oscommerce_ws/produits/index.php
+++ b/htdocs/oscommerce_ws/produits/index.php
@@ -43,6 +43,10 @@ $parameters = array();
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."ws_articles.php");
+if ($client)
+{
+ $client->soap_defencoding='UTF-8';
+}
$result = $client->call("get_listearticles",$parameters );
if ($client->fault) {
@@ -96,7 +100,7 @@ elseif (!($err = $client->getError()) )
}
}
else {
- dol_print_error('',"Erreur service web ".$client->faultstring);
+ print $client->getHTTPBody($client->response);
}
print "";
diff --git a/htdocs/oscommerce_ws/produits/osc_product.class.php b/htdocs/oscommerce_ws/produits/osc_product.class.php
index f6eba1d1136..4d6ad1f8733 100644
--- a/htdocs/oscommerce_ws/produits/osc_product.class.php
+++ b/htdocs/oscommerce_ws/produits/osc_product.class.php
@@ -34,7 +34,7 @@
class Osc_product
{
var $db;
-
+
var $osc_id;
var $osc_ref;
var $osc_name;
@@ -46,18 +46,18 @@ class Osc_product
var $osc_four;
var $osc_image;
var $osc_catid;
-
+
var $error;
-
+
/**
* \brief Constructeur de la classe
* \param id Id produit (0 par defaut)
- */
+ */
function Osc_product($DB, $id=0) {
global $langs;
-
+
$this->osc_id = $id ;
/* les initialisations n�cessaires */
@@ -66,7 +66,7 @@ class Osc_product
/**
* \brief Charge le produit OsC en m�moire
- * \param id Id du produit dans OsC
+ * \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
*/
@@ -74,7 +74,7 @@ class Osc_product
{
global $langs;
global $conf;
-
+
$this->error = '';
dol_syslog("Osc_product::fetch $id=$id ref=$ref");
// Verification parametres
@@ -95,6 +95,10 @@ class Osc_product
// Set the WebService URL
$client = new nusoap_client(OSCWS_DIR."/ws_articles.php");
+ if ($client)
+ {
+ $client->soap_defencoding='UTF-8';
+ }
// Call the WebSeclient->fault)rvice and store its result in $obj
$obj = $client->call("get_article",$parameters );
@@ -116,7 +120,7 @@ class Osc_product
else {
$this->error = 'Erreur '.$client->getError();
return -1;
- }
+ }
return 0;
}
@@ -145,14 +149,14 @@ class Osc_product
/* on force */
$product->status = 1; /* en vente */
- return $product;
+ return $product;
}
}
/**
* \brief Mise � jour de la table de transition
-* \param oscid Id du produit dans OsC
-* \param prodid champ r�f�rence
+* \param oscid Id du produit dans OsC
+* \param prodid champ r�f�rence
* \return int <0 si ko, >0 si ok
*/
function transcode($oscid, $prodid)
@@ -182,7 +186,7 @@ class Osc_product
// $this->db->rollback();
// return -1;
}
- return 0;
+ return 0;
}
// converti le produit osc en produit dolibarr
@@ -195,22 +199,22 @@ class Osc_product
$resql=$this->db->query($sql);
$obj = $this->db->fetch_object($resql);
// test d'erreurs
- if ($obj) return $obj->fk_product;
- else return '';
+ if ($obj) return $obj->fk_product;
+ else return '';
}
-
+
function get_catid($osccatid)
{
require_once(DOL_DOCUMENT_ROOT."/oscommerce_ws/produits/osc_categories.class.php");
- $mycat=new Osc_categorie($this->db);
+ $mycat=new Osc_categorie($this->db);
- if ($mycat->fetch_osccat($osccatid) > 0)
+ if ($mycat->fetch_osccat($osccatid) > 0)
{
return $mycat->dolicatid;
}
else return 0;
}
-
+
function get_osc_productid($productidp)
{
$sql = "SELECT rowid";
@@ -219,24 +223,24 @@ class Osc_product
$result=$this->db->query($sql);
$row = $this->db->fetch_row($result);
// test d'erreurs
- if ($row) return $row[0];
- else return -1;
+ if ($row) return $row[0];
+ else return -1;
}
-
-
+
+
/**
* \brief cr�ation d'un article dans base OSC
* \param $user utilisateur
- */
+ */
function create($user)
{
/* non impl�ment�e */
- }
+ }
/**
* \brief modification d'un article dans base OSC
* \param $user utilisateur
- */
+ */
function update($id, $user)
{
/* non impl�ment�e */
diff --git a/htdocs/oscommerce_ws/ws_server/ws_articles.php b/htdocs/oscommerce_ws/ws_server/ws_articles.php
index cd2984e6d33..252c6c4cfa5 100644
--- a/htdocs/oscommerce_ws/ws_server/ws_articles.php
+++ b/htdocs/oscommerce_ws/ws_server/ws_articles.php
@@ -29,10 +29,9 @@ require_once('./lib/nusoap.php');
// Create the soap Object
$s = new soap_server;
-/* $ns='oscommerce';
- $s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns);
- $s->wsdl->schemaTargetNamespace=$ns;
- */
+$ns='oscommerce';
+$s->configureWSDL('WebServicesOSCommerceForDolibarrProducts',$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 939f9520de1..cda1cd4427f 100644
--- a/htdocs/oscommerce_ws/ws_server/ws_customers.php
+++ b/htdocs/oscommerce_ws/ws_server/ws_customers.php
@@ -28,32 +28,31 @@ require_once('./includes/configure.php');
// Create the soap Object
$s = new soap_server;
-/* $ns='oscommerce';
-$s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns);
+$ns='oscommerce';
+$s->configureWSDL('WebServicesOSCommerceForDolibarrCustomers',$ns);
$s->wsdl->schemaTargetNamespace=$ns;
-*/
// Register the methods available for clients
$s->register('get_Client');
-// méthodes
+// m�thodes
function get_Client($custid='') {
-//on se connecte
+ //on se connecte
if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connexion impossible");
if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error());
-//la requête
+ //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;
+ 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 :
+
+ // $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 :
@@ -63,10 +62,10 @@ if ($custid > 0) $sql .= "WHERE c.customers_id = ".$custid;
$i++;
}
break;
- }
+ }
mysql_close($connexion);
- /* Sends the results to the client */
-return $result;
+ /* Sends the results to the client */
+ return $result;
}
// Return the results.
diff --git a/htdocs/oscommerce_ws/ws_server/ws_index.html b/htdocs/oscommerce_ws/ws_server/ws_index.html
index 4be629c6f6e..2580ea2fea9 100644
--- a/htdocs/oscommerce_ws/ws_server/ws_index.html
+++ b/htdocs/oscommerce_ws/ws_server/ws_index.html
@@ -7,10 +7,10 @@ This page show list of public webservices, now available on
your server OSCommerce.
-* ws_articles
-* ws_customers
-* ws_orders
-* ws_test
+* ws_articles
+* ws_customers
+* ws_orders
+* ws_test
Those pages will be called by Dolibarr using its own SOAP web service client.
diff --git a/htdocs/oscommerce_ws/ws_server/ws_orders.php b/htdocs/oscommerce_ws/ws_server/ws_orders.php
index e8f90b8ee9f..3c76b008f1a 100644
--- a/htdocs/oscommerce_ws/ws_server/ws_orders.php
+++ b/htdocs/oscommerce_ws/ws_server/ws_orders.php
@@ -19,6 +19,7 @@
* $Id$
*/
set_magic_quotes_runtime(0);
+//if (function_exists('xdebug_disable')) xdebug_disable();
// Soap Server.
require_once('./lib/nusoap.php');
@@ -27,6 +28,9 @@ require_once('./includes/configure.php');
// Create the soap Object
$s = new soap_server;
+$ns='oscommerce';
+$s->configureWSDL('WebServicesOSCommerceForDolibarOrders',$ns);
+$s->wsdl->schemaTargetNamespace=$ns;
// Register the methods available for clients
$s->register('get_CAmensuel');
@@ -35,7 +39,7 @@ $s->register('get_lastOrderClients');
$s->register('get_Order');
/*----------------------------------------------
-* renvoie un tableau avec le CA mensuel réalisé
+* renvoie un tableau avec le CA mensuel realise
-----------------------------------------------*/
function get_CAmensuel() {
@@ -43,18 +47,18 @@ function get_CAmensuel() {
if (!($connexion = mysql_connect(DB_SERVER, DB_SERVER_USERNAME, DB_SERVER_PASSWORD))) return new soap_fault("Server", "MySQL 1", "connexion impossible");
if (!($db = mysql_select_db(DB_DATABASE, $connexion))) return new soap_fault("Server", "MySQL 2", mysql_error());
-//la requête
+//la requ�te
$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 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 :
+ case 0 :
return new soap_fault("Server", "MySQL 4", $sql);
break;
default :
@@ -64,7 +68,7 @@ function get_CAmensuel() {
$i++;
}
break;
- }
+ }
mysql_close($connexion);
/* Sends the results to the client */
return $result;
@@ -83,12 +87,12 @@ $sql .= " WHERE t.class = 'ot_subtotal'";
if ($status > 0) $sql .= " and o.orders_status = ".$status;
$sql .= " 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 :
+ case 0 :
//return new soap_fault("Server", "MySQL 4", "produit inexistant");
break;
default :
@@ -98,7 +102,7 @@ if ($limit > 0) $sql .= " LIMIT ".$limit;
$i++;
}
break;
- }
+ }
mysql_close($connexion);
/* Sends the results to the client */
return $result;
@@ -117,12 +121,12 @@ function get_lastOrderClients($id='',$name='',$limit='') {
$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' 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 :
+ case 0 :
return new soap_fault("Server", "MySQL 4", "produit inexistant");
break;
default :
@@ -132,7 +136,7 @@ function get_lastOrderClients($id='',$name='',$limit='') {
$i++;
}
break;
- }
+ }
mysql_close($connexion);
/* Sends the results to the client */
return $result;
@@ -155,18 +159,18 @@ $sql .= " WHERE t.class = 'ot_subtotal'";
$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_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
+$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 :
+ case 0 :
return new soap_fault("Server", "MySQL 4", "commande inexistante ".$sql);
break;
default :
@@ -179,18 +183,18 @@ $sql .= " ORDER BY o.date_purchased desc";
}
$j = $i--;
-if ($orderid > 0)
-{
+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 :
+ case 0 :
return new soap_fault("Server", "MySQL 5", "commande sans articles");
break;
default :
diff --git a/htdocs/oscommerce_ws/ws_server/ws_test.php b/htdocs/oscommerce_ws/ws_server/ws_test.php
index b24f29c115c..113e9a74f83 100644
--- a/htdocs/oscommerce_ws/ws_server/ws_test.php
+++ b/htdocs/oscommerce_ws/ws_server/ws_test.php
@@ -7,9 +7,8 @@ require_once('./lib/nusoap.php');
// Create the soap Object
$s = new soap_server;
$ns='oscommerce';
-
-#$s->configureWSDL('WebServicesOSCommerceForDolibarr',$ns);
-#$s->wsdl->schemaTargetNamespace=$ns;
+$s->configureWSDL('WebServicesOSCommerceForDolibarrTest',$ns);
+$s->wsdl->schemaTargetNamespace=$ns;
// Register a method available for clients
$s->register('hello');