diff --git a/htdocs/actioncomm.class.php b/htdocs/actioncomm.class.php
index b6883996dba..9fe48176e7b 100644
--- a/htdocs/actioncomm.class.php
+++ b/htdocs/actioncomm.class.php
@@ -391,10 +391,16 @@ class ActionComm
$lien = '';
$lienfin='';
- $transcode=$langs->trans("Action".$this->code);
- $libelle=($transcode!="Action".$this->code ? $transcode : $this->libelle);
- $libelleshort=$libelle;
- if ($option) $libelleshort=dolibarr_trunc($libelle,$option);
+ if ($langs->trans("Action".$this->code) != "Action".$this->code)
+ {
+ $libelle=$langs->trans("Action".$this->code);
+ $libelleshort=$langs->trans("Action".$this->code,'','','','',$option);
+ }
+ else
+ {
+ $libelle=$this->libelle;
+ $libelleshort=dolibarr_trunc($this->libelle,$option);
+ }
if ($withpicto) $result.=($lien.img_object($langs->trans("ShowTask").': '.$libelle,'task').$lienfin.' ');
$result.=$lien.$libelleshort.$lienfin;
diff --git a/htdocs/langs/en_US/ldap.lang b/htdocs/langs/en_US/ldap.lang
index 55898d1974a..ca66d04511d 100644
--- a/htdocs/langs/en_US/ldap.lang
+++ b/htdocs/langs/en_US/ldap.lang
@@ -16,4 +16,5 @@ LDAPUsers=Users in LDAP database
LDAPGroups=Groups in LDAP database
SynchronizeDolibarr2Ldap=Synchronize user (Dolibarr -> LDAP)
UserSynchronized=User synchronized
-ForceSynchronize=Force synchronizing Dolibarr -> LDAP
\ No newline at end of file
+ForceSynchronize=Force synchronizing Dolibarr -> LDAP
+ErrorFailedToReadLDAP=Failed to read LDAP database.Check LDAP module setup and database accessibility.
\ No newline at end of file
diff --git a/htdocs/langs/fr_FR/ldap.lang b/htdocs/langs/fr_FR/ldap.lang
index aa7c4377ddf..9a7d72a763b 100644
--- a/htdocs/langs/fr_FR/ldap.lang
+++ b/htdocs/langs/fr_FR/ldap.lang
@@ -17,3 +17,4 @@ LDAPGroups=Groupes en base LDAP
SynchronizeDolibarr2Ldap=Synchroniser utilisateur (Dolibarr -> LDAP)
UserSynchronized=Utilisateur synchronisé
ForceSynchronize=Forcer synchro Dolibarr -> LDAP
+ErrorFailedToReadLDAP=Echec de la lecture de l'annuaire LDAP. Vérifier la configuration du module LDAP et l'accessibilité de l'annuaire.
diff --git a/htdocs/oscommerce_ws/clients/fiche.php b/htdocs/oscommerce_ws/clients/fiche.php
index 2bbfe8be286..7fb6b937473 100644
--- a/htdocs/oscommerce_ws/clients/fiche.php
+++ b/htdocs/oscommerce_ws/clients/fiche.php
@@ -54,20 +54,27 @@ if ($action == '' && !$cancel) {
if ( $user->rights->societe->creer) {
print ''.$langs->trans("Import").'';
}
+ print ''.$langs->trans("Retour").'';
print "\n
\n";
// seule action importer
}
else
{
- print "
ERROR 1c
\n";
- dolibarr_print_error('',"erreur webservice ".$osc_cust->error);
+ print "\n\n";
+ print "
ERROR 1c
\n";
+ dolibarr_print_error('',"erreur webservice ".$osc_cust->error);
+ print '
'.$langs->trans("Retour").'';
+ print "\n
\n";
}
}
else
{
- print "ERROR 1b
\n";
- print "Error";
+ print "\n
\n";
}
}
/* action Import création de l'objet product de dolibarr
@@ -83,8 +90,11 @@ if ($action == '' && !$cancel) {
$societe = new Societe($db);
if ($_error == 1)
{
- print '
erreur 1';
- exit;
+
+ print "\n
\n";
}
/* initialisation */
@@ -105,14 +115,22 @@ if ($action == '' && !$cancel) {
$societe->client = 1; // mettre 0 si prospect
}
+/* utilisation de la table de transco*/
+ if ($osc_cust->get_clientid($osc_cust->osc_custid)>0)
+ {
+ print 'Ce client existe déjà
';
+ }
+ else {
$id = $societe->create($user);
if ($id == 0)
{
- print '
création réussie nouveau client/prospect '.$societe->id.' nom : '.$societe->nom.'';
- $res = $osc_cust->transcode($osc_cust->osc_custid,$societe->id);
-print '
transcode '.$res.' | '.$societe->id.' osc : '.$osc_cust->osc_custid.'';
-
+ print "\n\n";
+ print '
création réussie nouveau client/prospect '.$societe->id.' nom : '.$societe->nom.'
';
+ $res = $osc_cust->transcode($osc_cust->osc_custid,$societe->id);
+ print '
transcode '.$res.' | '.$societe->id.' osc : '.$osc_cust->osc_custid.'
';
+ print '
'.$langs->trans("Retour").'';
+ print "\n
\n";
}
else
{
@@ -128,8 +146,10 @@ print '
transcode '.$res.' | '.$societe->id.' osc : '.$osc_cust->osc_custid.'
$societe_control = new Societe($db);
if ($_error == 1)
{
+ print "\n
\n";
}
$idp = $societe_control->fetch($socid = $osc_cust->osc_ref);
@@ -143,6 +163,7 @@ print '
transcode '.$res.' | '.$societe->id.' osc : '.$osc_cust->osc_custid.'
else print '
update impossible $id : '.$idp.' ';
}
}
+ }
}
diff --git a/htdocs/oscommerce_ws/clients/index.php b/htdocs/oscommerce_ws/clients/index.php
index 07295d60d0b..9ac39127389 100644
--- a/htdocs/oscommerce_ws/clients/index.php
+++ b/htdocs/oscommerce_ws/clients/index.php
@@ -66,6 +66,7 @@ elseif (!($err = $client->getError()) )
print "Ville | ";
print "Pays | ";
print 'Téléphone | ';
+ print 'Importer | ';
print "\n";
while ($i < $num) {
@@ -78,6 +79,7 @@ elseif (!($err = $client->getError()) )
print "".$result[$i][entry_city]." | \n";
print ''.$result[$i][countries_name]." | \n";
print ''.$result[$i][customers_telephone]." | \n";
+ print 'importer | \n";
print "\n";
$i++;
}
diff --git a/htdocs/oscommerce_ws/commandes/fiche.php b/htdocs/oscommerce_ws/commandes/fiche.php
index 0589d3ef63a..be2f8b6609b 100644
--- a/htdocs/oscommerce_ws/commandes/fiche.php
+++ b/htdocs/oscommerce_ws/commandes/fiche.php
@@ -55,20 +55,26 @@ if ($action == '' && !$cancel) {
if ( $user->rights->commande->creer) {
print ''.$langs->trans("Import").'';
}
+ print ''.$langs->trans("Retour").'';
print "\n
\n";
// seule action importer
}
else
{
- print "ERROR 1c
\n";
- dolibarr_print_error('',"erreur webservice ".$osc_order->error);
+ print "\n\n";
+ print "
ERROR 1c
\n";
+ dolibarr_print_error('',"erreur webservice ".$osc_order->error);
+ print '
'.$langs->trans("Retour").'';
+ print "\n
\n";
}
}
else
{
- print "ERROR 1b
\n";
- print "Error";
+ print "\n
\n";
}
}
/* action Import création de l'objet commande de dolibarr
@@ -81,13 +87,25 @@ if ($action == '' && !$cancel) {
if ( !$result )
{
$commande = $osc_order->osc2dolibarr($_GET["orderid"]);
- print_r($commande);
+ // print_r($commande);
}
+/* utilisation de la table de transco*/
+ if ($osc_order->get_orderid($osc_order->osc_orderid)>0)
+ {
+ print 'Cette commande existe déjà
';
+ }
+ else {
$id = $commande->create($user);
if ($id > 0)
{
- print '
création réussie nouvelle commande '.$id;
+ print "\n\n";
+ print '
création réussie nouvelle commande '.$id;
+ $res = $osc_order->transcode($osc_order->osc_orderid,$id);
+ print '
transcode '.$res.' | '.$id.' osc : '.$osc_order->osc_orderid.'
';
+ print '
'.$langs->trans("Retour").'';
+ print "\n
\n";
+
if ($id > 0) exit;
}
else
@@ -117,6 +135,7 @@ if ($action == '' && !$cancel) {
else print '
update impossible $id : '.$id.' ';
}
}
+ }
}
diff --git a/htdocs/oscommerce_ws/commandes/index.php b/htdocs/oscommerce_ws/commandes/index.php
index d99ec7d638d..bd0dc9e8487 100644
--- a/htdocs/oscommerce_ws/commandes/index.php
+++ b/htdocs/oscommerce_ws/commandes/index.php
@@ -66,6 +66,7 @@ elseif (!($err = $client->getError()) )
print "Date | ";
print "Montant | ";
print 'Paiement | ';
+ print 'Importer | ';
print "\n";
while ($i < $num) {
@@ -73,11 +74,13 @@ elseif (!($err = $client->getError()) )
print "";
print '| '.$result[$i][orders_id]." | \n";
+ print " | \n";
print "".$result[$i][customers_name]." | \n";
print "".$result[$i][date_purchased]." | \n";
print "".$result[$i][value]." | \n";
- print ''.$result[$i][payment_method]." | \n";
+ print ''.' '.$result[$i][payment_method]." | \n";
// print ''/*.$result[$i][customers_telephone]*/." | \n";
+ print ''."importer | \n";
print "
\n";
$i++;
}
diff --git a/htdocs/oscommerce_ws/commandes/osc_order.class.php b/htdocs/oscommerce_ws/commandes/osc_order.class.php
index 8b0eff504a5..ff70a900b93 100644
--- a/htdocs/oscommerce_ws/commandes/osc_order.class.php
+++ b/htdocs/oscommerce_ws/commandes/osc_order.class.php
@@ -169,7 +169,60 @@ class Osc_order
}
}
-
+ /**
+* \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($osc_orderid, $doli_orderid)
+ {
+
+ print "entree transcode
";
+
+ /* suppression et insertion */
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."osc_orders WHERE osc_prodid = ".$osc_orderid.";";
+ $result=$this->db->query($sql);
+ if ($result)
+ {
+ print "suppression ok ".$sql." * ".$result;
+ }
+ else
+ {
+ print "suppression rate ".$sql." * ".$result;
+ dolibarr_syslog("osc_order::transcode echec suppression");
+// $this->db->rollback();
+// return -1;
+ }
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."osc_order VALUES (".$osc_orderid." , now() , ".$doli_orderid.") ;";
+
+ $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_orderid($osc_orderid)
+ {
+ $sql = "SELECT doli_orderidp";
+ $sql.= " FROM ".MAIN_DB_PREFIX."osc_order";
+ $sql.= " WHERE osc_orderid = ".$osc_orderid;
+ $result=$this->db->query($sql);
+ $row = $this->db->fetch_row($resql);
+// test d'erreurs
+ return $row[0];
+ }
+
}
?>
diff --git a/htdocs/oscommerce_ws/includes/configure.php b/htdocs/oscommerce_ws/includes/configure.php
index 7d19b7c8c8e..1e957d53185 100644
--- a/htdocs/oscommerce_ws/includes/configure.php
+++ b/htdocs/oscommerce_ws/includes/configure.php
@@ -7,8 +7,8 @@
----------------------------------------------*/
//base url des webservices
-//define(OSCWS_DIR,'http://osc-tiaris/ws_OSC/');
-define(OSCWS_DIR,'http://osc.tiaris.info/ws_OSC/');
+define(OSCWS_DIR,'http://osc-tiaris/ws_OSC/');
+//define(OSCWS_DIR,'http://osc.tiaris.info/ws_OSC/');
//affichages dans la page d'accueil
define(OSC_MAXNBCOM, 5);
define(OSC_ORDWAIT,'4'); // code du statut de commande en attente
diff --git a/htdocs/oscommerce_ws/produits/fiche.php b/htdocs/oscommerce_ws/produits/fiche.php
index 798c3d6146b..5af49b2a0e1 100644
--- a/htdocs/oscommerce_ws/produits/fiche.php
+++ b/htdocs/oscommerce_ws/produits/fiche.php
@@ -29,7 +29,7 @@ if ($action == '' && !$cancel) {
if ($_GET['id'])
{
- $osc_prod = new Osc_product();
+ $osc_prod = new Osc_product($db, $_GET['id']);
$result = $osc_prod->fetch($_GET['id']);
if ( !$result)
@@ -54,6 +54,8 @@ if ($action == '' && !$cancel) {
if ( $user->rights->produit->creer) {
print ''.$langs->trans("Import").'';
}
+
+ print ''.$langs->trans("Retour").'';
print "\n
\n";
// seule action importer
@@ -75,7 +77,7 @@ if ($action == '' && !$cancel) {
*/
if (($_GET["action"] == 'import' ) && ( $_GET["id"] != '' ) && $user->rights->produit->creer)
{
- $osc_prod = new Osc_product();
+ $osc_prod = new Osc_product($db, $_GET['id']);
$result = $osc_prod->fetch($_GET['id']);
if ( !$result )
@@ -99,11 +101,22 @@ if ($action == '' && !$cancel) {
$product->status = 1; /* en vente */
}
+/* utilisation de la table de transco*/
+ if ($osc_prod->get_productid($osc_prod->osc_id)>0)
+ {
+ print 'Ce produit existe déjà
';
+ }
+ else {
$id = $product->create($user);
if ($id > 0)
{
- print '
création réussie produit '.$id.' référence : '.$product->ref.'';
+ print "\n\n";
+ print '
création réussie produit '.$id.' référence : '.$product->ref.'
';
+ $res = $osc_prod->transcode($osc_prod->osc_id,$product->id);
+ print '
transcode '.$res.' | '.$product->id.' osc : '.$osc_prod->osc_id.'
';
+ print '
'.$langs->trans("Retour").'';
+ print "\n
\n";
$id_entrepot = OSC_ENTREPOT;
$id = $product->create_stock($id_entrepot,$osc_prod->osc_stock);
if ($id > 0) exit;
@@ -139,6 +152,7 @@ if ($action == '' && !$cancel) {
else print '
update impossible $id : '.$id.' ';
}
}
+ }
}
diff --git a/htdocs/oscommerce_ws/produits/index.php b/htdocs/oscommerce_ws/produits/index.php
index e77d408afb0..7b2d803bf3a 100644
--- a/htdocs/oscommerce_ws/produits/index.php
+++ b/htdocs/oscommerce_ws/produits/index.php
@@ -66,6 +66,7 @@ elseif (!($err = $client->getError()) )
print "Groupe | ";
print 'Stock | ';
print 'Status | ';
+ print 'Importer | ';
print "\n";
while ($i < $num) {
@@ -78,6 +79,7 @@ elseif (!($err = $client->getError()) )
print "".$result[$i][manufacturer]." | \n";
print ''.$result[$i][quantity]." | \n";
print ''.$result[$i][status]." | \n";
+ print 'importer | \n";
print "\n";
$i++;
}
diff --git a/htdocs/oscommerce_ws/produits/osc_product.class.php b/htdocs/oscommerce_ws/produits/osc_product.class.php
index 5fd84476c21..e062feb8607 100644
--- a/htdocs/oscommerce_ws/produits/osc_product.class.php
+++ b/htdocs/oscommerce_ws/produits/osc_product.class.php
@@ -34,6 +34,8 @@
class Osc_product
{
+ var $db;
+
var $osc_id;
var $osc_ref;
var $osc_name;
@@ -50,13 +52,14 @@ class Osc_product
* \brief Constructeur de la classe
* \param id Id produit (0 par defaut)
*/
- function Osc_product($id=0) {
+ function Osc_product($DB, $id=0) {
global $langs;
$this->osc_id = $id ;
/* les initialisations nécessaires */
+ $this->db = $DB;
}
/**
@@ -113,6 +116,60 @@ class Osc_product
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
";
+
+ /* 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];
+ }
+
/**
diff --git a/htdocs/translate.class.php b/htdocs/translate.class.php
index ac8b625f95d..d56d6042e7f 100644
--- a/htdocs/translate.class.php
+++ b/htdocs/translate.class.php
@@ -210,19 +210,27 @@ class Translate {
/**
- * \brief Retourne la version traduite du texte passé en paramètre
- * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
- * et si toujours pas trouvé, il est retourné tel quel
- * Les paramètres de cette méthode peuvent contenir de balises HTML.
- * \param str chaine a traduire
- * \param param1 chaine de param1
- * \param param2 chaine de param1
- * \param param3 chaine de param1
- * \return string chaine traduite
+ * \brief Retourne la version traduite du texte passé en paramètre
+ * Si il n'y a pas de correspondance pour ce texte, on cherche dans fichier alternatif
+ * et si toujours pas trouvé, il est retourné tel quel
+ * Les paramètres de cette méthode peuvent contenir de balises HTML.
+ * \param key clé de chaine a traduire
+ * \param param1 chaine de param1
+ * \param param2 chaine de param1
+ * \param param3 chaine de param1
+ * \param maxsize taille max
+ * \return string chaine traduite
*/
- function trans($str, $param1='', $param2='', $param3='', $param4='')
+ function trans($key, $param1='', $param2='', $param3='', $param4='', $maxsize=0)
{
- return $this->transnoentities($str,htmlentities($param1),htmlentities($param2),htmlentities($param3),htmlentities($param4));
+ if ($this->getTransFromTab($key))
+ {
+ // Si la traduction est disponible
+ $str=sprintf($this->tab_translate[$key],$param1,$param2,$param3,$param4);
+ if ($maxsize) $str=dolibarr_trunc($str,$maxsize);
+ return htmlentities($str);
+ }
+ return $key;
}