Qual: Uniformize code.

This commit is contained in:
Laurent Destailleur 2012-04-28 18:49:01 +02:00
parent edb3178def
commit b9133410c2

View File

@ -802,10 +802,11 @@ class CommandeFournisseur extends Commande
* Cancel an approved order. * Cancel an approved order.
* L'annulation se fait apres l'approbation * L'annulation se fait apres l'approbation
* *
* @param User $user User making action * @param User $user User making action
* @return int >0 if Ok, <0 if Ko * @param int $idwarehouse Id warehouse to use for stock change (not used for supplier orders).
* @return int >0 if Ok, <0 if Ko
*/ */
function Cancel($user) function Cancel($user, $idwarehouse=-1)
{ {
global $langs,$conf; global $langs,$conf;
@ -900,12 +901,13 @@ class CommandeFournisseur extends Commande
} }
/** /**
* Create order with draft status * Create order with draft status
* *
* @param User $user User making creation * @param User $user User making creation
* @return int <0 if KO, Id of supplier order if OK * @param int $notrigger Disable all triggers
* @return int <0 if KO, Id of supplier order if OK
*/ */
function create($user) function create($user, $notrigger=0)
{ {
global $langs,$conf; global $langs,$conf;
@ -956,12 +958,15 @@ class CommandeFournisseur extends Commande
// On logue creation pour historique // On logue creation pour historique
$this->log($user, 0, time()); $this->log($user, 0, time());
// 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_SUPPLIER_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_SUPPLIER_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;