Refactor: LINK_* trigger
This commit is contained in:
parent
971ae8ae59
commit
b8499a80ec
@ -44,6 +44,7 @@ For developers:
|
|||||||
- New: Add country iso code on 3 chars into table of countries.
|
- New: Add country iso code on 3 chars into table of countries.
|
||||||
- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger.
|
- Qual: Removed hard coded rowid into data init of table llx_c_action_trigger.
|
||||||
- LINEBILL_DELETE trigger called before SQL delete in facturedet
|
- LINEBILL_DELETE trigger called before SQL delete in facturedet
|
||||||
|
- LINK_DELETE trigger called before SQL delete
|
||||||
|
|
||||||
WARNING: Following change may create regression for some external modules, but was necessary to make
|
WARNING: Following change may create regression for some external modules, but was necessary to make
|
||||||
Dolibarr better:
|
Dolibarr better:
|
||||||
|
|||||||
@ -99,15 +99,10 @@ class Link extends CommonObject
|
|||||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
||||||
|
|
||||||
if ($this->id > 0) {
|
if ($this->id > 0) {
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINK_CREATE',$user);
|
||||||
$interface=new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
} else {
|
} else {
|
||||||
$error++;
|
$error++;
|
||||||
}
|
}
|
||||||
@ -190,15 +185,10 @@ class Link extends CommonObject
|
|||||||
{
|
{
|
||||||
if ($call_trigger)
|
if ($call_trigger)
|
||||||
{
|
{
|
||||||
// Appel des triggers
|
// Call trigger
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
$result=$this->call_trigger('LINK_MODIFY',$user);
|
||||||
$interface = new Interfaces($this->db);
|
if ($result < 0) $error++;
|
||||||
$result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf);
|
// End call triggers
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
@ -339,6 +329,11 @@ class Link extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
$error = 0;
|
$error = 0;
|
||||||
|
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('LINK_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// Remove link
|
// Remove link
|
||||||
@ -353,18 +348,6 @@ class Link extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (! $error) {
|
|
||||||
// Appel des triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result = $interface->run_triggers('LINK_DELETE', $this, $user, $langs, $conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++;
|
|
||||||
$this->errors = $interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
if (! $error) {
|
if (! $error) {
|
||||||
$this->db->commit();
|
$this->db->commit();
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user