[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dolibarr-dev] Dolibarr et Oscommerce
From: |
Tahiti Rimai (Jean) |
Subject: |
[Dolibarr-dev] Dolibarr et Oscommerce |
Date: |
Mon, 07 Aug 2006 22:19:11 -1000 |
User-agent: |
Mozilla Thunderbird 1.0.6 (Windows/20050716) |
Le fichier diff obtenu, j'espère qu'il est juste cette fois
Jean
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/fiche.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/fiche.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/fiche.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/fiche.php
2006-08-05 18:03:24.000000000 -1000
@@ -0,0 +1,148 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/clients/fiche.php,v $
+ *
+ */
+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 '<div class="titre">Fiche client OSC :
'.$osc_cust->osc_custfirstname.' '.$osc_cust->osc_custlastname.'</div><br>';
+
+ print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
+ print '<tr></tr><td width="20%">Ville</td><td
width="80%">'.$osc_cust->osc_custcity.'</td></tr>';
+ print '<tr></tr><td width="20%">Pays</td><td
width="80%">'.$osc_cust->osc_custcountry.'</td></tr>';
+ print '<tr></tr><td width="20%">Id OSC</td><td
width="80%">'.$osc_cust->osc_custid.'</td></tr>';
+ print '<tr></tr><td width="20%">Téléphone</td><td
width="80%">'.$osc_cust->osc_custtel.'</td></tr>';
+ print '<tr></tr><td width="20%">E-mail</td><td
width="80%">'.$osc_cust->osc_custmail.'</td></tr>';
+ print "</table>";
+
+ /*
************************************************************************** */
+ /*
*/
+ /* Barre d'action
*/
+ /*
*/
+ /*
************************************************************************** */
+ print "\n<div class=\"tabsAction\">\n";
+
+ if ( $user->rights->societe->creer) {
+ print '<a class="tabAction"
href="fiche.php?action=import&custid='.$osc_cust->osc_custid.'">'.$langs->trans("Import").'</a>';
+ }
+ print "\n</div><br>\n";
+// seule action importer
+
+ }
+ else
+ {
+ print "<p>ERROR 1c</p>\n";
+ dolibarr_print_error("erreur webservice ".$osc_cust->error);
+ }
+ }
+ else
+ {
+ print "<p>ERROR 1b</p>\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 '<br>erreur 1</br>';
+ 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 '<br>création réussie nouveau client/prospect
'.$id.' nom : '.$societe->nom.'</br>';
+ }
+ 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 '<br>erreur 1</br>';
+ exit;
+ }
+ $idp = $societe_control->fetch($socid =
$osc_cust->osc_ref);
+
+ if ($idp > 0)
+ {
+ $res = $societe->update($idp,
$user);
+ if ($res < 0) print '<br>Erreur
update '.$idp.'</br>';
+ $res =
$osc_cust->transcode($osc_cust->custid,$idp);
+ if ($res < 0) print '<br>Erreur
update '.$idp.'</br>';
+
+ }
+ else print '<br>update impossible $id :
'.$idp.' </br>';
+ }
+ }
+
+ }
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/fiche.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/fiche.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/fiche.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/fiche.php~
2006-08-05 17:31:38.000000000 -1000
@@ -0,0 +1,145 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/clients/fiche.php,v $
+ *
+ */
+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 '<div class="titre">Fiche client OSC :
'.$osc_cust->osc_custfirstname.' '.$osc_cust->osc_custlastname.'</div><br>';
+
+ print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
+ print '<tr></tr><td width="20%">Ville</td><td
width="80%">'.$osc_cust->osc_custcity.'</td></tr>';
+ print '<tr></tr><td width="20%">Pays</td><td
width="80%">'.$osc_cust->osc_custcountry.'</td></tr>';
+ print '<tr></tr><td width="20%">Id OSC</td><td
width="80%">'.$osc_cust->osc_custid.'</td></tr>';
+ print '<tr></tr><td width="20%">Téléphone</td><td
width="80%">'.$osc_cust->osc_custtel.'</td></tr>';
+ print '<tr></tr><td width="20%">E-mail</td><td
width="80%">'.$osc_cust->osc_custmail.'</td></tr>';
+ print "</table>";
+
+ /*
************************************************************************** */
+ /*
*/
+ /* Barre d'action
*/
+ /*
*/
+ /*
************************************************************************** */
+ print "\n<div class=\"tabsAction\">\n";
+
+ if ( $user->rights->societe->creer) {
+ print '<a class="tabAction"
href="fiche.php?action=import&custid='.$osc_cust->osc_custid.'">'.$langs->trans("Import").'</a>';
+ }
+ print "\n</div><br>\n";
+// seule action importer
+
+ }
+ else
+ {
+ print "<p>ERROR 1c</p>\n";
+ dolibarr_print_error("erreur webservice ".$osc_cust->error);
+ }
+ }
+ else
+ {
+ print "<p>ERROR 1b</p>\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 '<br>erreur 1</br>';
+ 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 '<br>création réussie nouveau client/prospect
'.$id.' nom : '.$societe->nom.'</br>';
+ }
+ 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 '<br>erreur 1</br>';
+ exit;
+ }
+ $id = $societe_control->fetch($soc =
$osc_cust->osc_ref);
+
+ if ($id > 0)
+ {
+ $id = $societe->update($id,
$user);
+ if ($id < 0) print '<br>Erreur
update '.$id.'</br>';
+ }
+ else print '<br>update impossible $id :
'.$id.' </br>';
+ }
+ }
+
+ }
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/index.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/index.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/index.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/index.php
2006-07-29 11:34:13.000000000 -1000
@@ -0,0 +1,98 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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 '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
+
+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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"4\">";
+ print '<TR class="liste_titre">';
+ print "<td>id</td>";
+ print '<TD align="center">Société</TD>';
+ print "<td>Nom</td>";
+ print "<td>Ville</td>";
+ print "<td>Pays</td>";
+ print '<td align="center">Téléphone</td>';
+ print "</TR>\n";
+
+ while ($i < $num) {
+ $var=!$var;
+
+ print "<TR $bc[$var]>";
+ print '<TD><a
href="fiche.php?custid='.$result[$i][customers_id].'">'.$result[$i][customers_id]."</TD>\n";
+ print "<TD>".$result[$i][entry_company]."</TD>\n";
+ print "<TD>".$result[$i][entry_lastname]."</TD>\n";
+ print "<TD>".$result[$i][entry_city]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][countries_name]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][customers_telephone]."</TD>\n";
+ print "</TR>\n";
+ $i++;
+ }
+ print "</table></p>";
+ }
+ else {
+ dolibarr_print_error("Aucun client trouvé");
+ }
+}
+else {
+ dolibarr_print_error("Erreur service web ".$err);
+}
+
+print "</TABLE>";
+
+
+llxFooter("<em>Dernière modification $Date: 2006/07/30 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/index.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/index.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/index.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/index.php~
2006-07-29 09:47:59.000000000 -1000
@@ -0,0 +1,98 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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 '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
+
+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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"4\">";
+ print '<TR class="liste_titre">';
+ print "<td>id</td>";
+ print '<TD align="center">Société</TD>';
+ print "<td>Nom</td>";
+ print "<td>Ville</td>";
+ print "<td>Pays</td>";
+ print '<td align="center">Téléphone</td>';
+ print "</TR>\n";
+
+ while ($i < $num) {
+ $var=!$var;
+
+ print "<TR $bc[$var]>";
+ print '<TD><a
href="fiche.php?custid='.$result[$i][customers_id].'">'.$result[$i][customers_id]."</TD>\n";
+ print "<TD>".$result[$i][entry_company]."</TD>\n";
+ print "<TD>".$result[$i][entry_lastname]."</TD>\n";
+ print "<TD>".$result[$i][entry_lastname]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][countries_name]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][customers_telephone]."</TD>\n";
+ print "</TR>\n";
+ $i++;
+ }
+ print "</table></p>";
+ }
+ else {
+ dolibarr_print_error("Aucun client trouvé");
+ }
+}
+else {
+ dolibarr_print_error("Erreur service web ".$err);
+}
+
+print "</TABLE>";
+
+
+llxFooter("<em>Dernière modification $Date: 2006/07/30 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php
2006-08-05 18:08:40.000000000 -1000
@@ -0,0 +1,174 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_customer.class.php,v 1.0 2006/07/29 12:59:00 jean Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/clients/osc_clustomer.class.php,v
$
+ */
+
+/**
+ \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: 1.1 $
+*/
+
+
+/**
+ \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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php~
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php~
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/osc_customer.class.php~
2006-08-05 18:08:21.000000000 -1000
@@ -0,0 +1,176 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_customer.class.php,v 1.0 2006/07/29 12:59:00 jean Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/clients/osc_clustomer.class.php,v
$
+ */
+
+/**
+ \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: 1.1 $
+*/
+
+
+/**
+ \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 -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php
2006-07-29 11:38:59.000000000 -1000
@@ -0,0 +1,50 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source: /sources/dolibarr/dolibarr/htdocs/oscommerce_ws/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/clients/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/clients/pre.inc.php~
2006-07-29 10:17:58.000000000 -1000
@@ -0,0 +1,49 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source: /sources/dolibarr/dolibarr/htdocs/oscommerce_ws/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/clients/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+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"));
+
+ left_menu($menu->liste);
+}
+
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php
2006-08-05 16:21:51.000000000 -1000
@@ -0,0 +1,146 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php,v $
+ *
+ */
+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 '<div class="titre">Fiche commande OSC :
'.$osc_order->osc_orderid.'</div><br>';
+
+ print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
+ print '<tr></tr><td width="20%">client OSC</td><td
width="80%">'.$osc_order->osc_custid.'</td></tr>';
+ print '<tr></tr><td width="20%">Nom client</td><td
width="80%">'.$osc_order->osc_custname.'</td></tr>';
+ print '<tr></tr><td width="20%">Montant</td><td
width="80%">'.$osc_order->osc_ordertotal.'</td></tr>';
+ print '<tr></tr><td width="20%">Date commande</td><td
width="80%">'.$osc_order->osc_orderdate.'</td></tr>';
+ print '<tr></tr><td width="20%">Méthode de paiement</td><td
width="80%">'.$osc_order->osc_orderpaymet.'</td></tr>';
+ print "</table>";
+
+ /*
************************************************************************** */
+ /*
*/
+ /* Barre d'action
*/
+ /*
*/
+ /*
************************************************************************** */
+ print "\n<div class=\"tabsAction\">\n";
+
+ if ( $user->rights->commande->creer) {
+ print '<a class="tabAction"
href="fiche.php?action=import&orderid='.$osc_order->osc_orderid.'">'.$langs->trans("Import").'</a>';
+ }
+ print "\n</div><br>\n";
+// seule action importer
+
+ }
+ else
+ {
+ print "<p>ERROR 1c</p>\n";
+ dolibarr_print_error("erreur webservice ".$osc_order->error);
+ }
+ }
+ else
+ {
+ print "<p>ERROR 1b</p>\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 '<br>on passe 1</br>';
+ if ( !$result )
+ {
+ $commande = new Commande($db);
+ if ($_error == 1)
+ {
+ print '<br>erreur 1</br>';
+ exit;
+ }
+ print '<br>on passe 2</br>';
+ /* 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 '<br>on passe 3</br>';
+ $id = $societe->create($user);
+
+ if ($id > 0)
+ {
+ print '<br>création réussie nouveau client/prospect
'.$id.' nom : '.$societe->nom.'</br>';
+ 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 '<br>erreur 1</br>';
+ exit;
+ }
+ $id = $societe_control->fetch($ref =
$osc_order->osc_ref);
+
+ if ($id > 0)
+ {
+ $id = $societe->update($id,
$user);
+ if ($id < 0) print '<br>Erreur
update '.$id.'</br>';
+ }
+ else print '<br>update impossible $id :
'.$id.' </br>';
+ }
+ }
+
+ }
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php~
2006-08-05 15:59:28.000000000 -1000
@@ -0,0 +1,146 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/commandes/fiche.php,v $
+ *
+ */
+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 '<div class="titre">Fiche commande OSC :
'.$osc_order->osc_orderid.'</div><br>';
+
+ print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
+ print '<tr></tr><td width="20%">client OSC</td><td
width="80%">'.$osc_order->osc_custid.'</td></tr>';
+ print '<tr></tr><td width="20%">Nom client</td><td
width="80%">'.$osc_order->osc_custname.'</td></tr>';
+ print '<tr></tr><td width="20%">Montant</td><td
width="80%">'.$osc_order->osc_ordertotal.'</td></tr>';
+ print '<tr></tr><td width="20%">Date commande</td><td
width="80%">'.$osc_order->osc_orderdate.'</td></tr>';
+ print '<tr></tr><td width="20%">Méthode de paiement</td><td
width="80%">'.$osc_order->osc_orderpaymet.'</td></tr>';
+ print "</table>";
+
+ /*
************************************************************************** */
+ /*
*/
+ /* Barre d'action
*/
+ /*
*/
+ /*
************************************************************************** */
+ print "\n<div class=\"tabsAction\">\n";
+
+ if ( $user->rights->commande->creer) {
+ print '<a class="tabAction"
href="fiche.php?action=import&orderid='.$osc_order->osc_orderid.'">'.$langs->trans("Import").'</a>';
+ }
+ print "\n</div><br>\n";
+// seule action importer
+
+ }
+ else
+ {
+ print "<p>ERROR 1c</p>\n";
+ dolibarr_print_error("erreur webservice ".$osc_order->error);
+ }
+ }
+ else
+ {
+ print "<p>ERROR 1b</p>\n";
+ print "Error";
+ }
+}
+/* action Import création de l'objet product de dolibarr
+*
+*/
+ if (($_GET["action"] == 'import' ) && ( $_GET["orderid"] != '' ) &&
$user->rights->produit->creer)
+ {
+ $osc_order = new osc_order();
+ $result = $osc_order->fetch($_GET["orderid"]);
+ print '<br>on passe 1</br>';
+ if ( !$result )
+ {
+ $societe = new Societe($db);
+ if ($_error == 1)
+ {
+ print '<br>erreur 1</br>';
+ exit;
+ }
+ print '<br>on passe 2</br>';
+ /* 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 '<br>on passe 3</br>';
+ $id = $societe->create($user);
+
+ if ($id > 0)
+ {
+ print '<br>création réussie nouveau client/prospect
'.$id.' nom : '.$societe->nom.'</br>';
+ 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 '<br>erreur 1</br>';
+ exit;
+ }
+ $id = $societe_control->fetch($ref =
$osc_order->osc_ref);
+
+ if ($id > 0)
+ {
+ $id = $societe->update($id,
$user);
+ if ($id < 0) print '<br>Erreur
update '.$id.'</br>';
+ }
+ else print '<br>update impossible $id :
'.$id.' </br>';
+ }
+ }
+
+ }
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/index.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/index.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/index.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/index.php
2006-07-29 12:12:17.000000000 -1000
@@ -0,0 +1,98 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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 '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
+
+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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"4\">";
+ print '<TR class="liste_titre">';
+ print "<td>id</td>";
+ print '<TD align="center">Commande</TD>';
+ print "<td>Client</td>";
+ print "<td>Date</td>";
+ print "<td>Montant</td>";
+ print '<td align="center">Paiement</td>';
+ print "</TR>\n";
+
+ while ($i < $num) {
+ $var=!$var;
+
+ print "<TR $bc[$var]>";
+ print '<TD><a
href="fiche.php?orderid='.$result[$i][orders_id].'">'.$result[$i][orders_id]."</TD>\n";
+ print "<TD>".$result[$i][customers_name]."</TD>\n";
+ print "<TD>".$result[$i][date_purchased]."</TD>\n";
+ print "<TD>".$result[$i][value]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][payment_method]."</TD>\n";
+// print '<TD
align="center">'/*.$result[$i][customers_telephone]*/."</TD>\n";
+ print "</TR>\n";
+ $i++;
+ }
+ print "</table></p>";
+ }
+ else {
+ dolibarr_print_error("Aucune commande trouvée");
+ }
+}
+else {
+ dolibarr_print_error("Erreur service web ".$err);
+}
+
+print "</TABLE>";
+
+
+llxFooter("<em>Dernière modification $Date: 2006/07/30 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/index.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/index.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/index.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/index.php~
2006-07-29 12:04:38.000000000 -1000
@@ -0,0 +1,98 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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 '<h2>Result</h2><pre>'; print_r($result); echo '</pre>';
+
+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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"4\">";
+ print '<TR class="liste_titre">';
+ print "<td>id</td>";
+ print '<TD align="center">Commande</TD>';
+ print "<td>Client</td>";
+ print "<td>Date</td>";
+ print "<td>Montant</td>";
+ print '<td align="center">Paiement</td>';
+ print "</TR>\n";
+
+ while ($i < $num) {
+ $var=!$var;
+
+ print "<TR $bc[$var]>";
+ print '<TD><a
href="fiche.php?custid='.$result[$i][orders_id].'">'.$result[$i][orders_id]."</TD>\n";
+ print "<TD>".$result[$i][customers_name]."</TD>\n";
+ print "<TD>".$result[$i][date_purchased]."</TD>\n";
+ print "<TD>".$result[$i][value]."</TD>\n";
+ print '<TD
align="center">'.$result[$i][payment_method]."</TD>\n";
+// print '<TD
align="center">'/*.$result[$i][customers_telephone]*/."</TD>\n";
+ print "</TR>\n";
+ $i++;
+ }
+ print "</table></p>";
+ }
+ else {
+ dolibarr_print_error("Aucune commande trouvée");
+ }
+}
+else {
+ dolibarr_print_error("Erreur service web ".$err);
+}
+
+print "</TABLE>";
+
+
+llxFooter("<em>Dernière modification $Date: 2006/07/30 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_customer.class.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_customer.class.php~
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_customer.class.php~
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_customer.class.php~
2006-07-29 10:53:33.000000000 -1000
@@ -0,0 +1,134 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_customer.class.php,v 1.0 2006/07/29 12:59:00 jean Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/clients/osc_clustomer.class.php,v
$
+ */
+
+/**
+ \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: 1.1 $
+*/
+
+
+/**
+ \class Osc_customer
+ \brief Classe permettant la gestion des clients/prospects issus
d'une base OSC
+*/
+
+class Osc_customer
+{
+ 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;
+ }
+echo '<h2>Request</h2><pre>' . htmlspecialchars($client->request, ENT_QUOTES)
. '</pre>';
+echo '<h2>Response</h2><pre>' . htmlspecialchars($client->response,
ENT_QUOTES) . '</pre>';
+echo '<h2>Debug</h2><pre>' . htmlspecialchars($client->debug_str, ENT_QUOTES)
. '</pre>';
+
+ return 0;
+ }
+
+ }
+
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php
2006-08-05 15:54:18.000000000 -1000
@@ -0,0 +1,115 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_customer.class.php,v 1.0 2006/07/29 12:59:00 jean Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php,v
$
+ */
+
+/**
+ \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: 1.1 $
+*/
+
+
+/**
+ \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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php~
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php~
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php~
2006-08-05 15:36:05.000000000 -1000
@@ -0,0 +1,109 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_customer.class.php,v 1.0 2006/07/29 12:59:00 jean Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/commandes/osc_order.class.php,v
$
+ */
+
+/**
+ \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: 1.1 $
+*/
+
+
+/**
+ \class Osc_order
+ \brief Classe permettant la gestion des clients/prospects issus
d'une base OSC
+*/
+
+class Osc_order
+{
+ var $osc_orderid;
+ var $osc_ordercity;
+ var $osc_ordercountry;
+ var $osc_ordertel;
+ var $osc_ordermail;
+
+ 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];
+ }
+ else {
+ $this->error = 'Erreur '.$err ;
+ return -1;
+ }
+ return 0;
+ }
+
+ }
+
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php
2006-07-29 12:00:09.000000000 -1000
@@ -0,0 +1,50 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source: /sources/dolibarr/dolibarr/htdocs/oscommerce_ws/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/clients/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/commandes/pre.inc.php~
2006-07-29 11:38:34.000000000 -1000
@@ -0,0 +1,50 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source: /sources/dolibarr/dolibarr/htdocs/oscommerce_ws/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/clients/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/includes/configure.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/includes/configure.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/includes/configure.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/includes/configure.php
2006-07-29 09:36:18.000000000 -1000
@@ -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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/includes/configure.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/includes/configure.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/includes/configure.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/includes/configure.php~
2006-07-13 02:59:00.000000000 -1000
@@ -0,0 +1,18 @@
+<?php
+/*---------------------------------------------
+/ Webservices OSC pour dolibarr
+/ configuration des clients
+/
+/ Jean Heimburger juin 2006
+----------------------------------------------*/
+
+//base url des webservices
+//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
+define(OSC_ORDPROCESS,'1'); // code du statut de commande en traitement
+//
+define(OSC_ENTREPOT, 1); //l'entrepot lié au stock du site web
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/pre.inc.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/pre.inc.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/pre.inc.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/pre.inc.php
2006-07-29 11:36:56.000000000 -1000
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
* Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
*
* 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
@@ -39,6 +40,8 @@
$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 -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/pre.inc.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/pre.inc.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/pre.inc.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/pre.inc.php~
2006-07-29 09:09:42.000000000 -1000
@@ -0,0 +1,48 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source: /sources/dolibarr/dolibarr/htdocs/oscommerce_ws/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+require("../main.inc.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"));
+
+ left_menu($menu->liste);
+}
+
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/CVS/Entries
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/CVS/Entries
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/CVS/Entries
2006-08-04 14:40:44.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/CVS/Entries
2006-07-29 09:21:47.000000000 -1000
@@ -1,5 +1,5 @@
/fiche.php/1.1/Thu Jul 13 12:59:00 2006//
-/index.php/1.1/Thu Jul 13 12:59:00 2006//
/osc_product.class.php/1.1/Thu Jul 13 12:59:00 2006//
/pre.inc.php/1.1/Thu Jul 13 12:59:00 2006//
+/index.php/1.1/Sat Jul 29 19:21:47 2006//
D
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/fiche.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/fiche.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/fiche.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/fiche.php
2006-07-29 12:28:55.000000000 -1000
@@ -1,6 +1,5 @@
<?php
-/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
- * Copyright (C) 2003-2005 Éric Seigne <address@hidden>
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
*
* 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
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/fiche.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/fiche.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/fiche.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/fiche.php~
2006-07-13 02:59:00.000000000 -1000
@@ -0,0 +1,147 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2003-2005 Éric Seigne <address@hidden>
+ *
+ * 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: fiche.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/produits/fiche.php,v $
+ *
+ */
+require("./pre.inc.php");
+require_once(DOL_DOCUMENT_ROOT."/product.class.php");
+require_once("../includes/configure.php");
+
+llxHeader();
+
+if ($action == '' && !$cancel) {
+
+ if ($_GET['id'])
+ {
+ $osc_prod = new Osc_product();
+ $result = $osc_prod->fetch($_GET['id']);
+
+ if ( !$result)
+ {
+ print '<div class="titre">Fiche article OSC :
'.$osc_prod->osc_name.'</div><br>';
+
+ print '<table border="1" width="100%" cellspacing="0" cellpadding="4">';
+ print '<tr></tr><td width="20%">Descrption</td><td
width="80%">'.$osc_prod->osc_desc.'</td></tr>';
+ print '<tr></tr><td width="20%">ref</td><td
width="80%">'.$osc_prod->osc_ref.'</td></tr>';
+ print '<tr></tr><td width="20%">Id</td><td
width="80%">'.$osc_prod->osc_id.'</td></tr>';
+ print '<tr></tr><td width="20%">Prix</td><td
width="80%">'.$osc_prod->osc_price.'</td></tr>';
+ print '<tr></tr><td width="20%">Four_id</td><td
width="80%">'.$osc_prod->osc_four.'</td></tr>';
+ print "</table>";
+
+ /*
************************************************************************** */
+ /*
*/
+ /* Barre d'action
*/
+ /*
*/
+ /*
************************************************************************** */
+ print "\n<div class=\"tabsAction\">\n";
+
+ if ( $user->rights->produit->creer) {
+ print '<a class="tabAction"
href="fiche.php?action=import&id='.$osc_prod->osc_id.'">'.$langs->trans("Import").'</a>';
+ }
+ print "\n</div><br>\n";
+// seule action importer
+
+ }
+ else
+ {
+ print "<p>ERROR 1</p>\n";
+ dolibarr_print_error("erreur webservice ".$osc_prod->error);
+ }
+ }
+ else
+ {
+ print "<p>ERROR 1</p>\n";
+ print "Error";
+ }
+}
+/* action Import création de l'objet product de dolibarr
+*
+*/
+ if (($_GET["action"] == 'import' ) && ( $_GET["id"] != '' ) &&
$user->rights->produit->creer)
+ {
+ $osc_prod = new Osc_product();
+ $result = $osc_prod->fetch($_GET['id']);
+
+ if ( !$result )
+ {
+ $product = new Product($db);
+ if ($_error == 1)
+ {
+ print '<br>erreur 1</br>';
+ 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 */
+ }
+
+ $id = $product->create($user);
+
+ if ($id > 0)
+ {
+ print '<br>création réussie produit '.$id.' référence :
'.$product->ref.'</br>';
+ $id_entrepot = OSC_ENTREPOT;
+ $id =
$product->create_stock($id_entrepot,$osc_prod->osc_stock);
+ 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 */
+ $product_control = new Product($db);
+ if ($_error == 1)
+ {
+ print '<br>erreur 1</br>';
+ 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);
+ }
+ else print '<br>Erreur update
'.$id.'</br>';
+ }
+ else print '<br>update impossible $id :
'.$id.' </br>';
+ }
+ }
+
+ }
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/index.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/index.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/index.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/index.php
2006-07-29 09:22:48.000000000 -1000
@@ -1,6 +1,6 @@
<?php
-/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
- * Copyright (C) 2004 Laurent Destailleur <address@hidden>
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
*
* 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
diff -Naur /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/index.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/index.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/index.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/index.php~
2006-07-29 09:21:47.000000000 -1000
@@ -0,0 +1,98 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2004 Laurent Destailleur <address@hidden>
+ *
+ * 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: index.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/produits/index.php,v $
+ *
+ */
+
+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 articles 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();
+
+// Set the WebService URL
+$client = new soapclient(OSCWS_DIR."ws_articles.php");
+
+$result = $client->call("get_listearticles",$parameters );
+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 "<p><TABLE border=\"0\" width=\"100%\" cellspacing=\"0\"
cellpadding=\"4\">";
+ print '<TR class="liste_titre">';
+ print "<td>id</td>";
+ print "<td>Ref</td>";
+ print "<td>Titre</td>";
+ print "<td>Groupe</td>";
+ print '<td align="center">Stock</td>';
+ print '<TD align="center">Status</TD>';
+ print "</TR>\n";
+
+ while ($i < $num) {
+ $var=!$var;
+
+ print "<TR $bc[$var]>";
+ print '<TD><a
href="fiche.php?id='.$result[$i][OSC_id].'">'.$result[$i][OSC_id]."</TD>\n";
+ print "<TD>".$result[$i][model]."</TD>\n";
+ print "<TD>".$result[$i][name]."</TD>\n";
+ print "<TD>".$result[$i][manufacturer]."</TD>\n";
+ print '<TD align="center">'.$result[$i][quantity]."</TD>\n";
+ print '<TD align="center">'.$result[$i][status]."</TD>\n";
+ print "</TR>\n";
+ $i++;
+ }
+ print "</table></p>";
+ }
+ else {
+ dolibarr_print_error("Aucun article trouvé");
+ }
+}
+else {
+ dolibarr_print_error("Erreur service web ".$err);
+}
+
+print "</TABLE>";
+
+
+llxFooter("<em>Dernière modification $Date: 2006/07/13 12:59:00 $
révision $Revision: 1.1 $</em>");
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php
2006-07-13 02:59:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php
2006-07-29 08:30:55.000000000 -1000
@@ -1,9 +1,5 @@
<?php
-/* Copyright (C) 2001-2005 Rodolphe Quiedeville <address@hidden>
- * Copyright (C) 2004-2006 Laurent Destailleur <address@hidden>
- * Copyright (C) 2005-2006 Regis Houssin <address@hidden>
- * Copyright (C) 2006 Andre Cianfarani <address@hidden>
- * Copyright (C) 2006 Jean Heimburger <address@hidden>
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
*
* 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: 1.1 $
*/
@@ -64,9 +60,9 @@
}
/**
- * \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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php~
---
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php~
1969-12-31 14:00:00.000000000 -1000
+++
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php~
2006-07-29 08:25:55.000000000 -1000
@@ -0,0 +1,145 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: osc_product.class.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php,v
$
+ */
+
+/**
+ \file htdocs/product.class.php
+ \ingroup produit
+ \brief Fichier de la classe des produits prédéfinis
+ \version $Revision: 1.1 $
+*/
+
+
+/**
+ \class Osc_product
+ \brief Classe permettant la gestion des produits issus d'une base
OSC
+*/
+
+class Osc_product
+{
+ var $osc_id;
+ var $osc_ref;
+ var $osc_name;
+ var $osc_desc;
+ var $osc_price;
+ var $osc_tva;
+ var $osc_stockmini;
+ var $osc_stock;
+ var $osc_four;
+
+ var $error;
+
+ /**
+ * \brief Constructeur de la classe
+ * \param id Id produit (0 par defaut)
+ */
+ function Osc_product($id=0) {
+
+ global $langs;
+
+ $this->osc_id = $id ;
+
+ /* les initialisations nécessaires */
+ }
+
+/**
+ * \brief Charge le produit/service en mémoire
+ * \param id Id du produit/service à charger
+ * \param ref Ref du produit/service à charger
+ * \return int <0 si ko, >0 si ok
+ */
+ function fetch($id='',$ref='')
+ {
+ global $langs;
+ global $conf;
+
+ $this->error = '';
+ dolibarr_syslog("Osc_product::fetch $id=$id ref=$ref");
+ // Verification parametres
+ if (! $id && ! $ref)
+ {
+ $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("id"=>$id,"ref"=>$ref);
+
+ // Set the WebService URL
+ $client = new soapclient(OSCWS_DIR."/ws_articles.php");
+
+ // Call the WebSeclient->fault)rvice and store its result in
$obj
+ $obj = $client->call("get_article",$parameters );
+ if ($client->fault) {
+ $this->error="Fault detected";
+ return -1;
+ }
+ elseif (!($err=$client->getError()) ) {
+ $this->osc_id = $obj[products_id];
+ $this->osc_ref = $obj[products_model];
+ $this->osc_name = $obj[products_name];
+ $this->osc_desc = $obj[products_description];
+ $this->osc_stock = $obj[products_quantity];
+ $this->osc_four = $obj[manufacturers_id];
+ $this->osc_price = $obj[products_price];
+ }
+ else {
+ $this->error = 'Erreur '.$err ;
+ return -1;
+ }
+ return 0;
+ }
+
+
+
+ /**
+ * \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 */
+ }
+
+ /**
+ * \brief Suppression du produit en base OSC
+ * \param id id du produit
+ */
+ function delete($id)
+ {
+ /* non implémentée */
+ }
+}
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php
2006-07-29 11:38:10.000000000 -1000
@@ -1,6 +1,7 @@
<?php
/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
* Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
*
* 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 @@
$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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php~
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php~
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php~
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php~
2006-07-29 10:20:32.000000000 -1000
@@ -0,0 +1,48 @@
+<?php
+/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
+ * Copyright (C) 2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ * 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: pre.inc.php,v 1.1 2006/07/13 12:59:00 eldy Exp $
+ * $Source:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/produits/pre.inc.php,v $
+ */
+
+/**
+ \file htdocs/oscommerce_ws/pre.inc.php
+ \brief Fichier gestionnaire du menu de gauche
+ \version $Revision: 1.1 $
+*/
+
+require("../../main.inc.php");
+require("./osc_product.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"));
+ left_menu($menu->liste);
+}
+
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_articles.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_articles.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_articles.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_articles.php
2006-07-29 12:26:44.000000000 -1000
@@ -1,24 +1,45 @@
<?php
-set_magic_quotes_runtime(0);
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/ws_server/ws_articles.php,v $
+ *
+ */
+
+set_magic_quotes_runtime(0);
require_once("./includes/configure.php");
-
-// Soap Server.
-require_once('./lib/nusoap.php');
-
-// Create the soap Object
-$s = new soap_server;
-
-// Register a method available for clients
+
+// Soap Server.
+require_once('./lib/nusoap.php');
+
+// Create the soap Object
+$s = new soap_server;
+
+// Register a method available for clients
$s->register('get_article');
-$s->register('get_listearticles');
-
+$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";
@@ -30,10 +51,10 @@
if (!($resquer = mysql_query($sql,$connexion))) return new
soap_fault("Server", "MySQL 3 ".$sql, mysql_error());
- switch (mysql_numrows($resquer)) {
- case 0 :
- return new soap_fault("Server", "MySQL 4", "produit
inexistant");
- break;
+ switch (mysql_numrows($resquer)) {
+ case 0 :
+ return new soap_fault("Server", "MySQL 4", "produit
inexistant");
+ break;
case 1 :
$res_article = @mysql_fetch_array($resquer,
MYSQL_ASSOC);
$res_article["time"] = time();
@@ -49,21 +70,21 @@
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";
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", "produit
inexistant");
+ break;
default :
$i = 0;
while ( $i < $numrows) {
@@ -76,8 +97,8 @@
/* Sends the results to the client */
return $liste_articles;
}
-
-// Return the results.
+
+// Return the results.
$s->service($HTTP_RAW_POST_DATA);
-
-?>
+
+?>
diff -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_customers.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_customers.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_customers.php
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_customers.php
2006-07-30 16:48:01.000000000 -1000
@@ -0,0 +1,72 @@
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/ws_server/ws_customers.php,v $
+ *
+ */
+
+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 -Naur
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_orders.php
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_orders.php
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/ws_server/ws_orders.php
2006-07-13 02:59:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/ws_server/ws_orders.php
2006-07-30 18:18:32.000000000 -1000
@@ -1,24 +1,39 @@
-<?php
-/*---------------------------------------------
-/ Webservices OSC pour dolibarr
-/ gestion des commandes
-/
-/ Jean Heimburger juin 2006
-----------------------------------------------*/
-
-set_magic_quotes_runtime(0);
-
-// Soap Server.
-require_once('./lib/nusoap.php');
+<?php
+/* Copyright (C) 2006 Jean Heimburger <address@hidden>
+ *
+ *
+ * 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:
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/ws_server/ws_orders.php,v $
+ *
+ */
+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
+
+// 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');
/*----------------------------------------------
* renvoie un tableau avec le CA mensuel réalisé
@@ -26,8 +41,8 @@
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";
@@ -38,10 +53,10 @@
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", "produit
inexistant");
+ break;
default :
$i = 0;
while ( $i < $numrows) {
@@ -58,9 +73,9 @@
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
";
@@ -72,10 +87,44 @@
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;
+ 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;
+}
+
+
+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) {
@@ -89,7 +138,70 @@
return $result;
}
-// Return the results.
-$s->service($HTTP_RAW_POST_DATA);
+//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);
+
+?>
--- /home/jean/gestion/dolibarr/htdocs/conf/conf.class.php 2006-08-07
21:26:23.771202648 -1000
+++ /home/jean/projets/dolibarr/htdocs/conf/conf.class.php 2006-08-07
21:21:09.283012120 -1000
@@ -2,6 +2,7 @@
/* Copyright (C) 2003 Rodolphe Quiedeville <address@hidden>
* Copyright (C) 2003 Xavier Dutoit <address@hidden>
* Copyright (C) 2004-2006 Laurent Destailleur <address@hidden>
+ * Copyright (C) 2006 Jean Heimburger <address@hidden>
*
* 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,6 +63,7 @@
var $webcal;
var $propal;
var $categorie;
+ var $oscommerce2;
/**
No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.1.394 / Virus Database: 268.10.7/411 - Release Date: 07/08/2006
- [Dolibarr-dev] Dolibarr et Oscommerce,
Tahiti Rimai (Jean) <=