diff --git a/htdocs/admin/commande.php b/htdocs/admin/commande.php
index f6a8921793d..dd6451537db 100644
--- a/htdocs/admin/commande.php
+++ b/htdocs/admin/commande.php
@@ -23,11 +23,11 @@
*/
/**
- \file htdocs/admin/commande.php
- \ingroup commande
- \brief Page d'administration-configuration du module Commande
- \version $Id$
-*/
+ \file htdocs/admin/commande.php
+ \ingroup commande
+ \brief Page d'administration-configuration du module Commande
+ \version $Id$
+ */
require("./pre.inc.php");
require_once(DOL_DOCUMENT_ROOT."/lib/admin.lib.php");
@@ -39,12 +39,12 @@ $langs->load("other");
$langs->load("orders");
if (!$user->admin)
- accessforbidden();
+accessforbidden();
/*
* Actions
*/
-
+
if ($_POST["action"] == 'updateMask')
{
$maskconstorder=$_POST['maskconstorder'];
@@ -54,92 +54,92 @@ if ($_POST["action"] == 'updateMask')
if ($_GET["action"] == 'specimen')
{
- $modele=$_GET["module"];
-
- $commande = new Commande($db);
- $commande->initAsSpecimen();
-
- // Charge le modele
- $dir = DOL_DOCUMENT_ROOT . "/includes/modules/commande/";
- $file = "pdf_".$modele.".modules.php";
- if (file_exists($dir.$file))
- {
- $classname = "pdf_".$modele;
- require_once($dir.$file);
-
- $obj = new $classname($db);
-
- if ($obj->write_file($commande) > 0)
+ $modele=$_GET["module"];
+
+ $commande = new Commande($db);
+ $commande->initAsSpecimen();
+
+ // Charge le modele
+ $dir = DOL_DOCUMENT_ROOT . "/includes/modules/commande/";
+ $file = "pdf_".$modele.".modules.php";
+ if (file_exists($dir.$file))
{
- header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
- return;
+ $classname = "pdf_".$modele;
+ require_once($dir.$file);
+
+ $obj = new $classname($db);
+
+ if ($obj->write_file($commande) > 0)
+ {
+ header("Location: ".DOL_URL_ROOT."/document.php?modulepart=commande&file=SPECIMEN.pdf");
+ return;
+ }
}
- }
}
if ($_GET["action"] == 'set')
{
- $type='order';
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
- if ($db->query($sql))
- {
-
- }
+ $type='order';
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom, type) VALUES ('".$_GET["value"]."','".$type."')";
+ if ($db->query($sql))
+ {
+
+ }
}
if ($_GET["action"] == 'del')
{
- $type='order';
- $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
- $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
- if ($db->query($sql))
- {
-
- }
+ $type='order';
+ $sql = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
+ $sql .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
+ if ($db->query($sql))
+ {
+
+ }
}
if ($_GET["action"] == 'setdoc')
{
- $db->begin();
-
- if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"]))
- {
- $conf->global->COMMANDE_ADDON_PDF = $_GET["value"];
- }
-
- // On active le modele
- $type='order';
- $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
- $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
- $result1=$db->query($sql_del);
- $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
- $result2=$db->query($sql);
- if ($result1 && $result2)
- {
- $db->commit();
- }
- else
- {
- $db->rollback();
- }
+ $db->begin();
+
+ if (dolibarr_set_const($db, "COMMANDE_ADDON_PDF",$_GET["value"]))
+ {
+ $conf->global->COMMANDE_ADDON_PDF = $_GET["value"];
+ }
+
+ // On active le modele
+ $type='order';
+ $sql_del = "DELETE FROM ".MAIN_DB_PREFIX."document_model";
+ $sql_del .= " WHERE nom = '".$_GET["value"]."' AND type = '".$type."'";
+ $result1=$db->query($sql_del);
+ $sql = "INSERT INTO ".MAIN_DB_PREFIX."document_model (nom,type) VALUES ('".$_GET["value"]."','".$type."')";
+ $result2=$db->query($sql);
+ if ($result1 && $result2)
+ {
+ $db->commit();
+ }
+ else
+ {
+ $db->rollback();
+ }
}
if ($_GET["action"] == 'setmod')
{
- // \todo Verifier si module numerotation choisi peut etre active
- // par appel methode canBeActivated
-
- dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]);
+ // \todo Verifier si module numerotation choisi peut etre active
+ // par appel methode canBeActivated
+
+ dolibarr_set_const($db, "COMMANDE_ADDON",$_GET["value"]);
}
if ($_POST["action"] == 'set_COMMANDE_DRAFT_WATERMARK')
{
- dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"]));
+ dolibarr_set_const($db, "COMMANDE_DRAFT_WATERMARK",trim($_POST["COMMANDE_DRAFT_WATERMARK"]));
}
if ($_POST["action"] == 'set_COMMANDE_FREE_TEXT')
{
- dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"]));
+ dolibarr_set_const($db, "COMMANDE_FREE_TEXT",trim($_POST["COMMANDE_FREE_TEXT"]));
}
if ($_POST["action"] == 'setvalidorder')
@@ -172,6 +172,12 @@ print_fiche_titre($langs->trans("OrdersSetup"),$linkback,'setup');
print "
";
+
+
+/*
+ * Numbering module
+ */
+
print_titre($langs->trans("OrdersNumberingModules"));
print '
';
@@ -189,55 +195,55 @@ $dir = "../includes/modules/commande/";
$handle = opendir($dir);
if ($handle)
{
- $var=true;
-
- while (($file = readdir($handle))!==false)
- {
- if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
- {
- $file = substr($file, 0, strlen($file)-4);
+ $var=true;
- require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
+ while (($file = readdir($handle))!==false)
+ {
+ if (substr($file, 0, 13) == 'mod_commande_' && substr($file, strlen($file)-3, 3) == 'php')
+ {
+ $file = substr($file, 0, strlen($file)-4);
- $module = new $file;
+ require_once(DOL_DOCUMENT_ROOT ."/includes/modules/commande/".$file.".php");
+
+ $module = new $file;
// Show modules according to features level
- if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
- if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
+ if ($module->version == 'development' && $conf->global->MAIN_FEATURES_LEVEL < 2) continue;
+ if ($module->version == 'experimental' && $conf->global->MAIN_FEATURES_LEVEL < 1) continue;
- if ($module->isEnabled())
- {
- $var=!$var;
- print '| '.$module->nom." | \n";
- print $module->info();
- print ' | ';
-
- // Examples
- print ''.$module->getExample()." | \n";
-
- print '';
- if ($conf->global->COMMANDE_ADDON == "$file")
- {
- print img_tick($langs->trans("Activated"));
- }
- else
- {
- print ''.$langs->trans("Activate").'';
- }
- print ' | ';
-
- $commande=new Commande($db);
+ if ($module->isEnabled())
+ {
+ $var=!$var;
+ print '
| '.$module->nom." | \n";
+ print $module->info();
+ print ' | ';
+
+ // Examples
+ print ''.$module->getExample()." | \n";
+
+ print '';
+ if ($conf->global->COMMANDE_ADDON == "$file")
+ {
+ print img_tick($langs->trans("Activated"));
+ }
+ else
+ {
+ print ''.$langs->trans("Activate").'';
+ }
+ print ' | ';
+
+ $commande=new Commande($db);
$commande->initAsSpecimen();
-
+
// Info
$htmltooltip='';
$htmltooltip.=''.$langs->trans("Version").': '.$module->getVersion().'
';
$facture->type=0;
- $nextval=$module->getNextValue($mysoc,$commande);
+ $nextval=$module->getNextValue($mysoc,$commande);
if ("$nextval" != $langs->trans("NotAvailable")) // Keep " on nextval
{
$htmltooltip.=''.$langs->trans("NextValue").': ';
- if ($nextval)
+ if ($nextval)
{
$htmltooltip.=$nextval.'
';
}
@@ -246,20 +252,21 @@ if ($handle)
$htmltooltip.=$langs->trans($module->error).'
';
}
}
-
- print '';
- print $html->textwithhelp('',$htmltooltip,1,0);
- print ' | ';
-
- print '
';
- }
- }
- }
- closedir($handle);
+
+ print '';
+ print $html->textwithhelp('',$htmltooltip,1,0);
+ print ' | ';
+
+ print '';
+ }
+ }
+ }
+ closedir($handle);
}
print '
';
+
/*
* Modeles de documents
*/
@@ -319,12 +326,12 @@ while (($file = readdir($handle))!==false)
$module = new $classname($db);
print $module->description;
print "\n";
-
- // Activ�
+
+ // Activated
if (in_array($name, $def))
{
print "\n";
- if ($conf->global->COMMANDE_ADDON_PDF != "$name")
+ if ($conf->global->COMMANDE_ADDON_PDF != "$name")
{
print '';
print img_tick($langs->trans("Disable"));
@@ -354,27 +361,27 @@ while (($file = readdir($handle))!==false)
print ''.$langs->trans("Default").'';
}
print ' | ';
-
+
// Info
- $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
- $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
- $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
- $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
- $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo);
- $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg);
- $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg);
- $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang);
- // \TODO : $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte);
+ $htmltooltip = ''.$langs->trans("Name").': '.$module->name;
+ $htmltooltip.='
'.$langs->trans("Type").': '.($module->type?$module->type:$langs->trans("Unknown"));
+ $htmltooltip.='
'.$langs->trans("Height").'/'.$langs->trans("Width").': '.$module->page_hauteur.'/'.$module->page_largeur;
+ $htmltooltip.='
'.$langs->trans("FeaturesSupported").':';
+ $htmltooltip.='
'.$langs->trans("Logo").': '.yn($module->option_logo);
+ $htmltooltip.='
'.$langs->trans("PaymentMode").': '.yn($module->option_modereg);
+ $htmltooltip.='
'.$langs->trans("PaymentConditions").': '.yn($module->option_condreg);
+ $htmltooltip.='
'.$langs->trans("MultiLanguage").': '.yn($module->option_multilang);
+ // \TODO : $htmltooltip.='
'.$langs->trans("Escompte").': '.yn($module->option_escompte);
$htmltooltip.='
'.$langs->trans("CreditNote").': '.yn($module->option_credit_note);
$htmltooltip.='
'.$langs->trans("FreeLegalTextOnOrders").': '.yn($module->option_freetext);
$htmltooltip.='
'.$langs->trans("WatermarkOnDraftOrders").': '.yn($module->option_draft_watermark);
- print '';
- print $html->textwithhelp('',$htmltooltip,1,0);
- print ' | ';
- print '';
- print ''.img_object($langs->trans("Preview"),'order').'';
- print ' | ';
+ print '';
+ print $html->textwithhelp('',$htmltooltip,1,0);
+ print ' | ';
+ print '';
+ print ''.img_object($langs->trans("Preview"),'order').'';
+ print ' | ';
print "\n";
}
diff --git a/htdocs/fourn/fournisseur.commande.class.php b/htdocs/fourn/fournisseur.commande.class.php
index 24cd43e1e1f..eb12184b2db 100644
--- a/htdocs/fourn/fournisseur.commande.class.php
+++ b/htdocs/fourn/fournisseur.commande.class.php
@@ -120,7 +120,7 @@ class CommandeFournisseur extends Commande
// Now load lines
$this->lignes = array();
-
+
$sql = "SELECT l.rowid, l.ref as ref_fourn, l.fk_product, l.label, l.description, l.qty,";
$sql.= " l.tva_tx, l.remise_percent, l.subprice,";
$sql.= " l.total_ht, l.total_tva, l.total_ttc,";
@@ -130,7 +130,7 @@ class CommandeFournisseur extends Commande
$sql.= " WHERE l.fk_commande = ".$this->id;
$sql.= " ORDER BY l.rowid";
//print $sql;
-
+
dolibarr_syslog("CommandeFournisseur::fetch sql=".$sql,LOG_DEBUG);
$result = $this->db->query($sql);
if ($result)
@@ -160,7 +160,7 @@ class CommandeFournisseur extends Commande
$ligne->ref = $objp->ref; // Reference
$ligne->ref_fourn = $objp->ref_fourn; // Reference supplier
-
+
$this->lignes[$i] = $ligne;
//dolibarr_syslog("1 ".$ligne->desc);
//dolibarr_syslog("2 ".$ligne->product_desc);
@@ -216,7 +216,7 @@ class CommandeFournisseur extends Commande
global $langs,$conf;
$error=0;
-
+
dolibarr_syslog("CommandeFournisseur::Valid");
$result = 0;
if ($user->rights->fournisseur->commande->valider)
@@ -248,23 +248,8 @@ class CommandeFournisseur extends Commande
$this->log($user, 1, time()); // Statut 1
$this->ref = $num;
- // If stock is incremented on validate order, we must increment it
- if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER == 1)
- {
- require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
-
- for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
- {
- $mouvP = new MouvementStock($this->db);
- // We decrement stock of product (and sub-products)
- $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
- $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
- if ($result < 0) { $error++; }
- }
- }
-
if ($error == 0)
- {
+ {
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
@@ -272,7 +257,7 @@ class CommandeFournisseur extends Commande
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
-
+
if ($error == 0)
{
$this->db->commit();
@@ -304,7 +289,7 @@ class CommandeFournisseur extends Commande
/**
* \brief Annule la commande
* \param user Utilisateur qui demande annulation
- * \remarks L'annulation se fait apr�s la validation
+ * \remarks L'annulation se fait apres la validation
*/
function Cancel($user)
{
@@ -316,28 +301,42 @@ class CommandeFournisseur extends Commande
{
$statut = 6;
+ $this->db->begin();
+
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = ".$statut;
- $sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1 ;";
+ $sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1";
- if ($this->db->query($sql) )
- {
- $result = 0;
- $this->log($user, $statut, time());
+ if ($this->db->query($sql))
+ {
+ $result = 0;
+ $this->log($user, $statut, time());
- // Appel des triggers
- include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
- $interface=new Interfaces($this->db);
- $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
- if ($result < 0) { $error++; $this->errors=$interface->errors; }
- // Fin appel triggers
+ // Appel des triggers
+ include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+ $interface=new Interfaces($this->db);
+ $result=$interface->run_triggers('ORDER_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
+ if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ // Fin appel triggers
- return 1;
- }
- else
- {
- dolibarr_syslog("CommandeFournisseur::Cancel Error -1");
- return -1;
- }
+ if ($error == 0)
+ {
+ $this->db->commit();
+ return 1;
+ }
+ else
+ {
+ $this->db->rollback();
+ $this->error=$this->db->lasterror();
+ return -1;
+ }
+ }
+ else
+ {
+ dolibarr_syslog("CommandeFournisseur::Cancel Error -1");
+ $this->db->rollback();
+ $this->error=$this->db->lasterror();
+ return -1;
+ }
}
else
{
@@ -461,32 +460,32 @@ class CommandeFournisseur extends Commande
$file = COMMANDE_SUPPLIER_ADDON.'.php';
if (is_readable($dir.'/'.$file))
- {
- // Definition du nom de module de numerotation de commande fournisseur
- $modName=$conf->global->COMMANDE_SUPPLIER_ADDON;
- require_once($dir.'/'.$file);
+ {
+ // Definition du nom de module de numerotation de commande fournisseur
+ $modName=$conf->global->COMMANDE_SUPPLIER_ADDON;
+ require_once($dir.'/'.$file);
- // Recuperation de la nouvelle reference
- $objMod = new $modName($this->db);
+ // Recuperation de la nouvelle reference
+ $objMod = new $modName($this->db);
- $numref = "";
- $numref = $objMod->commande_get_num($soc,$this);
+ $numref = "";
+ $numref = $objMod->commande_get_num($soc,$this);
- if ( $numref != "")
- {
- return $numref;
- }
- else
- {
- dolibarr_print_error($db,"CommandeFournisseur::getNextNumRef ".$obj->error);
- return -1;
- }
- }
- else
- {
- print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON);
- return -2;
- }
+ if ( $numref != "")
+ {
+ return $numref;
+ }
+ else
+ {
+ dolibarr_print_error($db,"CommandeFournisseur::getNextNumRef ".$obj->error);
+ return -1;
+ }
+ }
+ else
+ {
+ print $langs->trans("Error")." ".$langs->trans("Error_FailedToLoad_COMMANDE_SUPPLIER_ADDON_File",$conf->global->COMMANDE_SUPPLIER_ADDON);
+ return -2;
+ }
}
else
{
@@ -496,53 +495,88 @@ class CommandeFournisseur extends Commande
}
/**
- * \brief Approuve une commande
- *
+ * \brief Accept an order
+ * \param user Object user
*/
function approve($user)
{
global $langs,$conf;
+ $error=0;
+
dolibarr_syslog("CommandeFournisseur::Approve");
- $result = 0;
+
if ($user->rights->fournisseur->commande->approuver)
{
+ $this->db->begin();
+
$sql = "UPDATE ".MAIN_DB_PREFIX."commande_fournisseur SET fk_statut = 2";
$sql .= " WHERE rowid = ".$this->id." AND fk_statut = 1 ;";
- if ($this->db->query($sql) )
- {
- $result = 0;
- $this->log($user, 2, time()); // Statut 2
+ if ($this->db->query($sql))
+ {
+ $result = 0;
+ $this->log($user, 2, time()); // Statut 2
- // Appel des triggers
- include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
- $interface=new Interfaces($this->db);
- $result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf);
- if ($result < 0) { $error++; $this->errors=$interface->errors; }
- // Fin appel triggers
+ // If stock is incremented on validate order, we must increment it
+ if ($result >= 0 && $conf->stock->enabled && $conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER == 1)
+ {
+ require_once(DOL_DOCUMENT_ROOT."/product/stock/mouvementstock.class.php");
- $subject = "Votre commande ".$this->ref." a �t� approuv�e";
- $message = "Bonjour,\n\n";
- $message .= "Votre commande ".$this->ref." a �t� approuv�e, par $user->fullname";
- $message .= "\n\nCordialement,\n\n";
- $this->_NotifyCreator($user, $subject, $message);
+ for ($i = 0 ; $i < sizeof($this->lignes) ; $i++)
+ {
+ $mouvP = new MouvementStock($this->db);
+ // We decrement stock of product (and sub-products)
+ $entrepot_id = "1"; //Todo: ajouter possibilite de choisir l'entrepot
+ $result=$mouvP->reception($user, $this->lignes[$i]->fk_product, $entrepot_id, $this->lignes[$i]->qty);
+ if ($result < 0) { $error++; }
+ }
+ }
- dolibarr_syslog("CommandeFournisseur::valid Success");
- $this->db->commit();
- return 1;
- }
- else
- {
- dolibarr_syslog("CommandeFournisseur::Approve Error -1");
- $result = -1;
- }
+ if ($error == 0)
+ {
+ // Appel des triggers
+ include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
+ $interface=new Interfaces($this->db);
+ $result=$interface->run_triggers('ORDER_SUPPLIER_APPROVE',$this,$user,$langs,$conf);
+ if ($result < 0) { $error++; $this->errors=$interface->errors; }
+ // Fin appel triggers
+ }
+
+ if ($error == 0)
+ {
+ $subject = "Votre commande ".$this->ref." a �t� approuv�e";
+ $message = "Bonjour,\n\n";
+ $message .= "Votre commande ".$this->ref." a �t� approuv�e, par $user->fullname";
+ $message .= "\n\nCordialement,\n\n";
+ $this->_NotifyCreator($user, $subject, $message);
+ }
+
+ if ($error == 0)
+ {
+ $this->db->commit();
+ return 1;
+ }
+ else
+ {
+ $this->db->rollback();
+ $this->error=$this->db->lasterror();
+ return -1;
+ }
+ }
+ else
+ {
+ $this->db->rollback();
+ $this->error=$this->db->lasterror();
+ dolibarr_syslog("CommandeFournisseur::Approve Error ",$this->error, LOG_ERR);
+ return -1;
+ }
}
else
{
- dolibarr_syslog("CommandeFournisseur::Approve Not Authorized");
+ dolibarr_syslog("CommandeFournisseur::Approve Not Authorized", LOG_ERR);
}
- return $result ;
+ return -1;
}
/**
@@ -786,7 +820,7 @@ class CommandeFournisseur extends Commande
$total_ttc = $tabprice[2];
$subprice = price2num($pu,'MU');
-
+
// \TODO A virer
// Anciens indicateurs: $price, $remise (a ne plus utiliser)
$remise = 0;
@@ -1304,7 +1338,7 @@ class CommandeFournisseur extends Commande
{
// Mise a jour info denormalisees au niveau facture
$this->update_price();
-
+
$this->db->commit();
return $result;
}
diff --git a/htdocs/includes/modules/commande/mod_commande_marbre.php b/htdocs/includes/modules/commande/mod_commande_marbre.php
index 9ac246fa224..f6ce656d217 100644
--- a/htdocs/includes/modules/commande/mod_commande_marbre.php
+++ b/htdocs/includes/modules/commande/mod_commande_marbre.php
@@ -39,12 +39,13 @@ class mod_commande_marbre extends ModeleNumRefCommandes
var $nom='Marbre';
- /** \brief Renvoi la description du modele de num�rotation
+ /** \brief Renvoi la description du modele de numerotation
* \return string Texte descripif
*/
function info()
{
- return "Renvoie le num�ro sous la forme ".$this->prefix."yymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise e 0";
+ global $langs;
+ return $langs->trans("MarbreNumRefDesc",$this->prefix);
}
diff --git a/htdocs/includes/modules/commande/mod_commande_opale.php b/htdocs/includes/modules/commande/mod_commande_opale.php
deleted file mode 100644
index f37b2f10662..00000000000
--- a/htdocs/includes/modules/commande/mod_commande_opale.php
+++ /dev/null
@@ -1,115 +0,0 @@
-
- *
- * 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.
- * or see http://www.gnu.org/
- */
-
-/**
- \file htdocs/includes/modules/commande/mod_commande_opale.php
- \ingroup commande
- \brief Fichier contenant la classe du modèle de numérotation de référence de commande Opale
- \version $Id$
- */
-
-include_once("modules_commande.php");
-
-
-/**
- \class mod_commande_opale
- \brief Classe du modèle de numérotation de référence de commande Opale
- */
-
-class mod_commande_opale extends ModeleNumRefCommandes
-{
- var $version='dolibarr'; // 'development', 'experimental', 'dolibarr'
- var $error = '';
- var $nom = 'Opale';
-
-
- /** \brief Constructeur
- */
- function mod_commande_opale()
- {
- $this->nom = "Opale";
- }
-
-
- /** \brief Renvoi la description du modele de numérotation
- * \return string Texte descripif
- */
- function info()
- {
- return "Renvoie le numéro sous la forme numérique COMhexa, où hexa représente un incrément global codé en héxadécimal. (COM-000-001 à COM-FFF-FFF)";
- }
-
- /** \brief Renvoi un exemple de numérotation
- * \return string Example
- */
- function getExample()
- {
- return "COM-000-001";
- }
-
-
- /** \brief Return next value
- * \param objsoc Objet third party
- * \param commande Object order
- * \return string Value if OK, 0 if KO
- */
- function getNextValue($objsoc,$commande)
- {
- global $db;
-
- // D'abord on récupère la valeur max (réponse immédiate car champ indéxé)
- $com='';
- $sql = "SELECT MAX(ref)";
- $sql.= " FROM ".MAIN_DB_PREFIX."commande";
- $sql.= " WHERE ref like 'COM%'";
- $resql=$db->query($sql);
- if ($resql)
- {
- $row = $db->fetch_row($resql);
- if ($row)
- {
- //on extrait la valeur max et on la passe en décimale
- $max = hexdec((substr($row[0],4,3)).(substr($row[0],8,3)));
- }
- }
- else
- {
- $max=0;
- }
- //$date=time();
- $date=$commande->date;
- $yy = strftime("%y",$date);
- $hex = strtoupper(dechex($max+1));
- $ref = substr("000000".($hex),-6);
-
- return 'COM-'.substr($ref,0,3)."-".substr($ref,3,3);
- }
-
- /** \brief Return next free value
- * \param objsoc Object third party
- * \param objforref Object for number to search
- * \return string Next free value
- */
- function commande_get_num($objsoc,$objforref)
- {
- return $this->getNextValue($objsoc,$objforref);
- }
-
-}
-?>
diff --git a/htdocs/langs/en_US/orders.lang b/htdocs/langs/en_US/orders.lang
index 68e0c2a7d2e..fdc6120fdba 100755
--- a/htdocs/langs/en_US/orders.lang
+++ b/htdocs/langs/en_US/orders.lang
@@ -115,5 +115,8 @@ QtyOrdered=Qty ordered
AddDeliveryCostLine=Add a delivery cost line indicating the weight of the order
-# einstein PDF Model
+# Documents models
PDFEinsteinDescription=A complete order model (logo...)
+
+# NumRef Modules
+MarbreNumRefDesc=Renvoie le numéro sous la forme %syymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise e 0
diff --git a/htdocs/langs/fr_FR/orders.lang b/htdocs/langs/fr_FR/orders.lang
index f9f7147efc2..5a422f8fcc8 100755
--- a/htdocs/langs/fr_FR/orders.lang
+++ b/htdocs/langs/fr_FR/orders.lang
@@ -118,11 +118,4 @@ AddDeliveryCostLine=Ajouter une ligne de frais port indiquant le poids de la com
PDFEinsteinDescription=Modèle de propositions commerciales complet (logo...)
# NumRef Modules
-EmeraudeNumRefModelDesc1=Renvoie le numéro sous la forme CYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1
-EmeraudeNumRefModelDesc2=L'année s'incrémente de 1 et le numéro d'incrément se remet à zero en début d'année d'exercice.
-EmeraudeNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
-EmeraudeNumRefModelDesc4=Dans cette exemple nous aurons au 1er septembre 2007 une commande nommée C0800001
-RubisNumRefModelDesc1=Renvoie le numéro sous la forme CYYNNNNN où YY est l'année et NNNNN le numéro d'incrément qui commence à 1
-RubisNumRefModelDesc2=L'année s'incrémente de 1 SANS remise à zero en début d'année d'exercice.
-RubisNumRefModelDesc3=Définir le mois de début d'exercice dans configuration->société, ex: septembre.
-RubisNumRefModelDesc4=Dans cette exemple nous aurons au 1er septembre 2007 une commande nommée C0800345
+MarbreNumRefDesc=Renvoie le numéro sous la forme %syymm-nnnn ou yy est l'annee, mm le mois et nnnn un compteur sequentiel sans rupture et sans remise à 0