dolibarr-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Dolibarr-dev] Interface Dolibarr Osc


From: Jean
Subject: [Dolibarr-dev] Interface Dolibarr Osc
Date: Tue, 23 Jan 2007 11:43:28 -1000
User-agent: Debian Thunderbird 1.0.2 (X11/20060423)

Corrections et amélioration de l'interface Dolibarr OSC

import du catalogue OSC vers Dolibarr


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-12-13 09:23:49.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/CVS/Entries       
2006-12-14 08:07:39.000000000 -1000
@@ -1,5 +1,5 @@
-/pre.inc.php/1.2/Sat Aug 12 19:28:40 2006//
-/fiche.php/1.3/Wed Dec 13 19:23:49 2006//
-/index.php/1.3/Wed Dec 13 19:23:49 2006//
-/osc_product.class.php/1.3/Wed Dec 13 19:23:49 2006//
+/pre.inc.php/1.2/Fri Aug 11 23:20:32 2006//
+/fiche.php/1.3/Wed Dec 13 22:58:23 2006//
+/index.php/1.3/Wed Dec 13 22:58:23 2006//
+/osc_product.class.php/1.3/Wed Dec 13 22:58:23 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-12-13 09:23:49.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/fiche.php 
2007-01-22 17:27:20.000000000 -1000
@@ -79,14 +79,14 @@
     {
                  $osc_prod = new Osc_product($db, $_GET['id']);
                  $result = $osc_prod->fetch($_GET['id']);
-  
+ 
          if ( !$result )
          {
                        $product = new Product($db);
                if ($_error == 1)
                {
                        print '<br>erreur 1</br>';
-                               exit;
+                       //      exit;
                }
                /* initialisation */
                $product->ref = $osc_prod->osc_ref;
@@ -108,18 +108,18 @@
                }
                else {
                        $id = $product->create($user);
-              
+       
                    if ($id > 0)
                    {
                print "\n<div class=\"tabsAction\">\n";
-               print '<p>création réussie produit '.$id.' référence : 
'.$product->ref.'</p>';
+               print '<p>création réussie produit '.$id.' référence : 
'.$product->ref;
                                $res = 
$osc_prod->transcode($osc_prod->osc_id,$product->id);
-                               print '<p>transcode '.$res.' | '.$product->id.' 
osc : '.$osc_prod->osc_id.'</p>';
+                               print ' Id osc : '.$osc_prod->osc_id.'</p>';
                        print '<a class="tabAction" 
href="index.php">'.$langs->trans("Retour").'</a>';
                                print "\n</div><br>\n";
                                $id_entrepot = OSC_ENTREPOT;
                                $id = 
$product->create_stock($id_entrepot,$osc_prod->osc_stock);
-                               if ($id > 0)  exit;
+//                             if ($id > 0)  exit;
                    }
                    else
                    {
diff -Naur 
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#fiche.php.1.2 
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#fiche.php.1.2
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#fiche.php.1.2   
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#fiche.php.1.2   
2006-11-22 11:52:17.000000000 -1000
@@ -0,0 +1,160 @@
+<?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: fiche.php,v 1.2 2006/08/11 23:20:32 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($db, $_GET['id']);
+  $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&amp;id='.$osc_prod->osc_id.'">'.$langs->trans("Import").'</a>';
+       }
+
+               print '<a class="tabAction" 
href="index.php">'.$langs->trans("Retour").'</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($db, $_GET['id']);
+                 $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 */
+                } 
+
+/* utilisation de la table de transco*/
+               if ($osc_prod->get_productid($osc_prod->osc_id)>0)
+               {
+                       print '<p>Ce produit existe déjà</p>';
+               }
+               else {
+                       $id = $product->create($user);
+              
+                   if ($id > 0)
+                   {
+               print "\n<div class=\"tabsAction\">\n";
+               print '<p>création réussie produit '.$id.' référence : 
'.$product->ref.'</p>';
+                               $res = 
$osc_prod->transcode($osc_prod->osc_id,$product->id);
+                               print '<p>transcode '.$res.' | '.$product->id.' 
osc : '.$osc_prod->osc_id.'</p>';
+                       print '<a class="tabAction" 
href="index.php">'.$langs->trans("Retour").'</a>';
+                               print "\n</div><br>\n";
+                               $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('$Date: 2006/08/11 23:20:32 $ - $Revision: 1.2 $');
+?>
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-12-13 09:23:49.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/index.php 
2007-01-22 17:54:34.000000000 -1000
@@ -57,11 +57,15 @@
        $var=True;
        $i=0;
 
+// un produit osc
+       $OscProd = new Osc_Product($db);
+       
        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>ProductId</td>";
                print "<td>Titre</td>";
                print "<td>Groupe</td>";
                print '<td align="center">Stock</td>';
@@ -71,15 +75,19 @@
           
                while ($i < $num) {
                $var=!$var;
+               $prodid = $OscProd->get_productid($result[$i][OSC_id]);
 
                    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][model]."</TD>\n";
+               print '<td><a 
href="../../product/fiche.php?id='.$prodid.'">'.$prodid.'</a></td>';
                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 '<TD align="center"><a 
href="fiche.php?action=import&id='.$result[$i][OSC_id].'"'."><b>importer</b></a></TD>\n";
+               if ($prodid) $lib = "modifier";
+               else $lib = "<u>importer</u>";
+               print '<TD align="center"><a 
href="fiche.php?action=import&id='.$result[$i][OSC_id].'"'.">".$lib."</a></TD>\n";
                print "</TR>\n";
                $i++;
                }
diff -Naur 
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#index.php.1.2 
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#index.php.1.2
--- /home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#index.php.1.2   
1969-12-31 14:00:00.000000000 -1000
+++ /home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#index.php.1.2   
2006-11-09 10:45:45.000000000 -1000
@@ -0,0 +1,100 @@
+<?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: index.php,v 1.2 2006/08/11 23:20:32 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 '<TD align="center">Importer</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 '<TD align="center"><a 
href="fiche.php?action=import&id='.$result[$i][OSC_id].'"'."><b>importer</b></a></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('$Date: 2006/08/11 23:20:32 $ - $Revision: 1.2 $');
+?>
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-12-13 09:23:49.000000000 -1000
+++ 
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php 
    2007-01-22 17:09:55.000000000 -1000
@@ -125,18 +125,18 @@
        function transcode($oscid, $prodid)
        {
 
-               print "entree transcode <br>";
+//             print "entree transcode <br>";
 
                /* suppression et insertion */
                $sql = "DELETE FROM ".MAIN_DB_PREFIX."osc_product WHERE 
osc_prodid = ".$oscid.";";
                $result=$this->db->query($sql);
         if ($result)
         {
-                       print "suppression ok ".$sql."  * ".$result;
+//                     print "suppression ok ".$sql."  * ".$result;
                }
         else
         {
-                       print "suppression rate ".$sql."  * ".$result;
+//                     print "suppression rate ".$sql."  * ".$result;
             dolibarr_syslog("osc_product::transcode echec suppression");
 //            $this->db->rollback();
 //            return -1;
@@ -146,11 +146,11 @@
                $result=$this->db->query($sql);
         if ($result)
         {
-                       print "insertion ok ". $sql."  ". $result;
+//                     print "insertion ok ". $sql."  ". $result;
                }
         else
         {
-                       print "insertion rate ".$sql." , ".$result;
+//                     print "insertion rate ".$sql." , ".$result;
             dolibarr_syslog("osc_product::transcode echec insert");
 //            $this->db->rollback();
 //            return -1;
@@ -167,7 +167,8 @@
                $result=$this->db->query($sql);
                $row = $this->db->fetch_row($resql);
 // test d'erreurs
-               return $row[0]; 
+               if ($row) return $row[0];       
+               else return ''; 
        }
 
        
diff -Naur 
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#osc_product.class.php.1.2
 
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#osc_product.class.php.1.2
--- 
/home/jean/gestion/dolibarr/htdocs/oscommerce_ws/produits/.#osc_product.class.php.1.2
       1969-12-31 14:00:00.000000000 -1000
+++ 
/home/jean/projets/dolibarr/htdocs/oscommerce_ws/produits/.#osc_product.class.php.1.2
       2006-11-22 11:44:58.000000000 -1000
@@ -0,0 +1,202 @@
+<?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.2 2006/08/11 23:20:32 eldy Exp $
+ * $Source: 
/sources/dolibarr/dolibarr/htdocs/oscommerce_ws/produits/osc_product.class.php,v
 $
+ */
+
+/**
+        \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.2 $
+*/
+
+
+/**
+        \class      Osc_product
+        \brief      Classe permettant la gestion des produits issus d'une base 
OSC
+*/
+
+class Osc_product
+{
+       var $db;
+       
+       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($DB, $id=0) {
+
+        global $langs;
+      
+        $this->osc_id = $id ;
+
+        /* les initialisations nécessaires */
+        $this->db = $DB;
+       }
+
+/**
+     *      \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='')
+    {
+        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      Mise à jour de la table de transition
+*      \param      oscid      Id du produit dans OsC 
+*         \param          prodid         champ référence       
+*      \return     int     <0 si ko, >0 si ok
+*/
+       function transcode($oscid, $prodid)
+       {
+
+               print "entree transcode <br>";
+
+               /* suppression et insertion */
+               $sql = "DELETE FROM ".MAIN_DB_PREFIX."osc_product WHERE 
osc_prodid = ".$oscid.";";
+               $result=$this->db->query($sql);
+        if ($result)
+        {
+                       print "suppression ok ".$sql."  * ".$result;
+               }
+        else
+        {
+                       print "suppression rate ".$sql."  * ".$result;
+            dolibarr_syslog("osc_product::transcode echec suppression");
+//            $this->db->rollback();
+//            return -1;
+               }
+               $sql = "INSERT INTO ".MAIN_DB_PREFIX."osc_product VALUES 
(".$oscid." ,  now() , ".$prodid.") ;";
+
+               $result=$this->db->query($sql);
+        if ($result)
+        {
+                       print "insertion ok ". $sql."  ". $result;
+               }
+        else
+        {
+                       print "insertion rate ".$sql." , ".$result;
+            dolibarr_syslog("osc_product::transcode echec insert");
+//            $this->db->rollback();
+//            return -1;
+               }
+       return 0;       
+     }
+// converti le client osc en client dolibarr
+
+       function get_productid($osc_product)
+       {
+               $sql = "SELECT doli_prodidp";
+               $sql.= " FROM ".MAIN_DB_PREFIX."osc_product";
+               $sql.= " WHERE osc_prodid = ".$osc_product;
+               $result=$this->db->query($sql);
+               $row = $this->db->fetch_row($resql);
+// test d'erreurs
+               return $row[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 */
+    }
+}
+?>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]