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