Fix: uniformize code
Fix: variable conflict
This commit is contained in:
parent
1b52f6de30
commit
e540dd5aef
@ -569,12 +569,12 @@ class Commande extends CommonObject
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Create order
|
||||
* \param user Objet user that make creation
|
||||
* \return int <0 if KO, >0 if OK
|
||||
* \remarks this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||
* Create order
|
||||
* @param user Objet user that make creation
|
||||
* @return int <0 if KO, >0 if OK
|
||||
* remarks this->ref can be set or empty. If empty, we will use "(PROV)"
|
||||
*/
|
||||
function create($user)
|
||||
function create($user, $notrigger=0)
|
||||
{
|
||||
global $conf,$langs,$mysoc;
|
||||
$error=0;
|
||||
@ -728,13 +728,16 @@ class Commande extends CommonObject
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
|
||||
@ -443,18 +443,18 @@ class Expedition extends CommonObject
|
||||
// Define new ref
|
||||
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
|
||||
{
|
||||
$num = $this->getNextNumRef($soc);
|
||||
$numref = $this->getNextNumRef($soc);
|
||||
}
|
||||
else
|
||||
{
|
||||
$num = "EXP".$this->id;
|
||||
$numref = "EXP".$this->id;
|
||||
}
|
||||
|
||||
$now=dol_now();
|
||||
|
||||
// Validate
|
||||
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
|
||||
$sql.= " ref='".$num."'";
|
||||
$sql.= " ref='".$numref."'";
|
||||
$sql.= ", fk_statut = 1";
|
||||
$sql.= ", date_valid = '".$this->db->idate($now)."'";
|
||||
$sql.= ", fk_user_valid = ".$user->id;
|
||||
@ -542,7 +542,7 @@ class Expedition extends CommonObject
|
||||
// Set new ref
|
||||
if (! $error)
|
||||
{
|
||||
$this->ref = $num;
|
||||
$this->ref = $numref;
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user