Refactor: RESOURCE_* trigger
This commit is contained in:
parent
5e7c0639b0
commit
ca97c0bef3
@ -43,7 +43,7 @@ For developers:
|
|||||||
- New: Add trigger DON_UPDATE, DON_DELETE
|
- New: Add trigger DON_UPDATE, DON_DELETE
|
||||||
- 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, LINK_DELETE, ORDER_SUPPLIER_DELETE trigger called before SQL delete
|
- LINEBILL_DELETE, LINK_DELETE, ORDER_SUPPLIER_DELETE, RESOURCE_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:
|
||||||
|
|||||||
@ -332,6 +332,14 @@ class Resource extends CommonObject
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
|
|
||||||
|
if (! $notrigger)
|
||||||
|
{
|
||||||
|
// Call trigger
|
||||||
|
$result=$this->call_trigger('RESOURCE_DELETE',$user);
|
||||||
|
if ($result < 0) return -1;
|
||||||
|
// End call triggers
|
||||||
|
}
|
||||||
|
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."resource";
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."resource";
|
||||||
$sql.= " WHERE rowid =".$rowid;
|
$sql.= " WHERE rowid =".$rowid;
|
||||||
|
|
||||||
@ -343,18 +351,6 @@ class Resource extends CommonObject
|
|||||||
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
dol_syslog(get_class($this)."::delete", LOG_DEBUG);
|
||||||
if ($this->db->query($sql))
|
if ($this->db->query($sql))
|
||||||
{
|
{
|
||||||
if (! $notrigger)
|
|
||||||
{
|
|
||||||
// Call triggers
|
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('RESOURCE_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// End call triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -734,15 +730,10 @@ class Resource extends CommonObject
|
|||||||
{
|
{
|
||||||
if (! $notrigger)
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
// Uncomment this and change MYOBJECT to your own tag if you
|
// Call trigger
|
||||||
// want this action calls a trigger.
|
$result=$this->call_trigger('RESOURCE_MODIFY',$user);
|
||||||
|
if ($result < 0) $error++;
|
||||||
// Call triggers
|
// End call triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('RESOURCE_MODIFY',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
|
||||||
// End call triggers
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user