Merge branch 'develop' of git@github.com:Dolibarr/dolibarr.git into develop

This commit is contained in:
Laurent Destailleur 2015-03-17 00:23:49 +01:00
commit 6f7b07548c

View File

@ -643,7 +643,7 @@ class Commande extends CommonOrder
$error=0; $error=0;
// Clean parameters // Clean parameters
$this->brouillon = 1; // On positionne en mode brouillon la commande $this->brouillon = 1; // set command as draft
dol_syslog(get_class($this)."::create user=".$user->id); dol_syslog(get_class($this)."::create user=".$user->id);
@ -727,7 +727,7 @@ class Commande extends CommonOrder
$num=count($this->lines); $num=count($this->lines);
/* /*
* Insertion du detail des produits dans la base * Insert products details into db
*/ */
for ($i=0;$i<$num;$i++) for ($i=0;$i<$num;$i++)
{ {
@ -776,14 +776,16 @@ class Commande extends CommonOrder
} }
} }
// Mise a jour ref // update ref
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='(PROV".$this->id.")' WHERE rowid=".$this->id; if (empty($this->ref))
{
$this->ref = '(PROV'.$this->id.')';
}
$sql = 'UPDATE '.MAIN_DB_PREFIX."commande SET ref='".$this->ref."' WHERE rowid=".$this->id;
if ($this->db->query($sql)) if ($this->db->query($sql))
{ {
if ($this->id) if ($this->id)
{ {
$this->ref="(PROV".$this->id.")";
// Add object linked // Add object linked
if (is_array($this->linked_objects) && ! empty($this->linked_objects)) if (is_array($this->linked_objects) && ! empty($this->linked_objects))
{ {