Refactor: LINK_* trigger
This commit is contained in:
parent
971ae8ae59
commit
b8499a80ec
@ -43,7 +43,8 @@ For developers:
|
||||
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||
- 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.
|
||||
- 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
|
||||
Dolibarr better:
|
||||
|
||||
@ -99,15 +99,10 @@ class Link extends CommonObject
|
||||
$this->id = $this->db->last_insert_id(MAIN_DB_PREFIX . "links");
|
||||
|
||||
if ($this->id > 0) {
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('LINK_CREATE', $this, $user, $langs, $conf);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors = $interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_CREATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
} else {
|
||||
$error++;
|
||||
}
|
||||
@ -190,15 +185,10 @@ class Link extends CommonObject
|
||||
{
|
||||
if ($call_trigger)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface = new Interfaces($this->db);
|
||||
$result = $interface->run_triggers('LINK_MODIFY', $this, $user, $langs, $conf);
|
||||
if ($result < 0) {
|
||||
$error++;
|
||||
$this->errors = $interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_MODIFY',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
@ -339,6 +329,11 @@ class Link extends CommonObject
|
||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||
$error = 0;
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINK_DELETE',$user);
|
||||
if ($result < 0) return -1;
|
||||
// End call triggers
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// 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) {
|
||||
$this->db->commit();
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user