Fix: uniformize code

Fix: variable conflict
This commit is contained in:
Regis Houssin 2011-06-15 19:53:37 +00:00
parent 1b52f6de30
commit e540dd5aef
2 changed files with 19 additions and 16 deletions

View File

@ -569,12 +569,12 @@ class Commande extends CommonObject
} }
/** /**
* \brief Create order * Create order
* \param user Objet user that make creation * @param user Objet user that make creation
* \return int <0 if KO, >0 if OK * @return int <0 if KO, >0 if OK
* \remarks this->ref can be set or empty. If empty, we will use "(PROV)" * 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; global $conf,$langs,$mysoc;
$error=0; $error=0;
@ -728,13 +728,16 @@ class Commande extends CommonObject
} }
} }
} }
// Appel des triggers if (! $notrigger)
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php"); {
$interface=new Interfaces($this->db); // Appel des triggers
$result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf); include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
if ($result < 0) { $error++; $this->errors=$interface->errors; } $interface=new Interfaces($this->db);
// Fin appel triggers $result=$interface->run_triggers('ORDER_CREATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit(); $this->db->commit();
return $this->id; return $this->id;

View File

@ -443,18 +443,18 @@ class Expedition extends CommonObject
// Define new ref // Define new ref
if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref))) if (! $error && (preg_match('/^[\(]?PROV/i', $this->ref)))
{ {
$num = $this->getNextNumRef($soc); $numref = $this->getNextNumRef($soc);
} }
else else
{ {
$num = "EXP".$this->id; $numref = "EXP".$this->id;
} }
$now=dol_now(); $now=dol_now();
// Validate // Validate
$sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET"; $sql = "UPDATE ".MAIN_DB_PREFIX."expedition SET";
$sql.= " ref='".$num."'"; $sql.= " ref='".$numref."'";
$sql.= ", fk_statut = 1"; $sql.= ", fk_statut = 1";
$sql.= ", date_valid = '".$this->db->idate($now)."'"; $sql.= ", date_valid = '".$this->db->idate($now)."'";
$sql.= ", fk_user_valid = ".$user->id; $sql.= ", fk_user_valid = ".$user->id;
@ -542,7 +542,7 @@ class Expedition extends CommonObject
// Set new ref // Set new ref
if (! $error) if (! $error)
{ {
$this->ref = $num; $this->ref = $numref;
} }
if (! $error) if (! $error)