Refactor: BILL_SUPPLIER_* and LINEBILL_SUPPLIER_* trigger
This commit is contained in:
parent
bbdaa59921
commit
42ef7149fd
@ -254,12 +254,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$result=$this->update_price();
|
$result=$this->update_price();
|
||||||
if ($result > 0)
|
if ($result > 0)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -601,11 +599,9 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Call triggers
|
// Call trigger
|
||||||
//include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
//$result=$this->call_trigger('BILL_SUPPLIER_MODIFY',$user);
|
||||||
//$interface=new Interfaces($this->db);
|
//if ($result < 0) $error++;
|
||||||
//$result=$interface->run_triggers('BILL_SUPPLIER_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
//if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -673,13 +669,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0)
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
{
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -771,12 +764,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_PAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_PAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -821,12 +812,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
$resql = $this->db->query($sql);
|
$resql = $this->db->query($sql);
|
||||||
if ($resql)
|
if ($resql)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_UNPAYED',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_UNPAYED',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -962,12 +951,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
// Triggers call
|
// Triggers call
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('BILL_SUPPLIER_VALIDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('BILL_SUPPLIER_VALIDATE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -1129,18 +1116,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
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=$this->call_trigger('LINEBILL_SUPPLIER_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_CREATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
@ -1263,18 +1246,14 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
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=$this->call_trigger('LINEBILL_SUPPLIER_UPDATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_UPDATE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0)
|
if ($result < 0)
|
||||||
{
|
{
|
||||||
$error++;
|
|
||||||
$this->errors=$interface->errors;
|
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update total price into invoice record
|
// Update total price into invoice record
|
||||||
@ -1312,14 +1291,10 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
if (! $error && ! $notrigger)
|
if (! $error && ! $notrigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
$result=$this->call_trigger('LINEBILL_SUPPLIER_DELETE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user