Refactor: various trigger
This commit is contained in:
parent
5093fecc60
commit
5e7c0639b0
@ -201,12 +201,10 @@ class PaiementFourn extends Paiement
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('PAYMENT_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('PAYMENT_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@ -120,12 +120,9 @@ if ($_POST["action"] == 'dispatch' && $user->rights->fournisseur->commande->rece
|
|||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
global $conf, $langs, $user;
|
global $conf, $langs, $user;
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$commande->call_trigger('ORDER_SUPPLIER_DISPATCH',$user);
|
||||||
$interface=new Interfaces($db);
|
// End call triggers
|
||||||
$result_trigger=$interface->run_triggers('ORDER_SUPPLIER_DISPATCH',$commande,$user,$langs,$conf);
|
|
||||||
if ($result_trigger < 0) { $error++; $commande->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
|
|||||||
@ -313,11 +313,9 @@ class Import
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('IMPORT_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('IMPORT_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -142,12 +142,10 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf;
|
||||||
|
|
||||||
//// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('OPENSURVEY_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('OPENSURVEY_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -338,12 +336,10 @@ class Opensurveysondage extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
//// Call triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('OPENSURVEY_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('OPENSURVEY_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
//// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -245,17 +245,17 @@ class MouvementStock
|
|||||||
|
|
||||||
if ($movestock && ! $error)
|
if ($movestock && ! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
|
|
||||||
$this->product_id = $fk_product;
|
$this->product_id = $fk_product;
|
||||||
$this->entrepot_id = $entrepot_id;
|
$this->entrepot_id = $entrepot_id;
|
||||||
$this->qty = $qty;
|
$this->qty = $qty;
|
||||||
|
|
||||||
$result=$interface->run_triggers('STOCK_MOVEMENT',$this,$user,$langs,$conf);
|
// Call trigger
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
$result=$this->call_trigger('STOCK_MOVEMENT',$user);
|
||||||
// Fin appel triggers
|
if ($result < 0) $error++;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
|
//FIXME: Restore previous value of product_id, entrepot_id, qty if trigger fail
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user