Fix: Normalize trigger names for fichinter module.
This commit is contained in:
parent
a1b0fbcc2c
commit
0d09de0cf8
@ -227,7 +227,7 @@ function fichinter_create($db, $object, $modele, $outputlangs, $hidedetails=0, $
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('FICHEINTER_BUILDDOC',$object,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_BUILDDOC',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
|
||||
@ -311,7 +311,7 @@ class InterfaceActionsAuto
|
||||
$object->sendtoid=0;
|
||||
$ok=1;
|
||||
}
|
||||
elseif ($action == 'FICHEINTER_VALIDATE')
|
||||
elseif ($action == 'FICHINTER_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
@ -328,7 +328,7 @@ class InterfaceActionsAuto
|
||||
$object->elementtype='';
|
||||
$ok=1;
|
||||
}
|
||||
elseif ($action == 'FICHEINTER_SENTBYMAIL')
|
||||
elseif ($action == 'FICHINTER_SENTBYMAIL')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
$langs->load("other");
|
||||
|
||||
@ -29,8 +29,14 @@
|
||||
class InterfaceNotification
|
||||
{
|
||||
var $db;
|
||||
var $listofmanagedevents=array('BILL_VALIDATE','ORDER_VALIDATE','PROPAL_VALIDATE',
|
||||
'FICHEINTER_VALIDATE','ORDER_SUPPLIER_APPROVE','ORDER_SUPPLIER_REFUSE');
|
||||
var $listofmanagedevents=array(
|
||||
'BILL_VALIDATE',
|
||||
'ORDER_VALIDATE',
|
||||
'PROPAL_VALIDATE',
|
||||
'FICHINTER_VALIDATE',
|
||||
'ORDER_SUPPLIER_APPROVE',
|
||||
'ORDER_SUPPLIER_REFUSE'
|
||||
);
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@ -146,7 +152,7 @@ class InterfaceNotification
|
||||
$notify->send($action, $object->socid, $mesg, 'propal', $object->id, $filepdf);
|
||||
}
|
||||
|
||||
elseif ($action == 'FICHEINTER_VALIDATE')
|
||||
elseif ($action == 'FICHINTER_VALIDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
|
||||
|
||||
@ -164,18 +164,27 @@ class Fichinter extends CommonObject
|
||||
if (! $ret) dol_print_error($this->db);
|
||||
}
|
||||
|
||||
$this->db->commit();
|
||||
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHEINTER_CREATE',$this,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_CREATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
// Fin appel triggers
|
||||
|
||||
return $this->id;
|
||||
if (! $error)
|
||||
{
|
||||
$this->db->commit();
|
||||
return $this->id;
|
||||
}
|
||||
else
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=join(',',$this->errors);
|
||||
dol_syslog(get_class($this)."::create ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -213,7 +222,7 @@ class Fichinter extends CommonObject
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHEINTER_MODIFY',$this,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_MODIFY',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
@ -357,14 +366,14 @@ class Fichinter extends CommonObject
|
||||
$sql.= " AND entity = ".$conf->entity;
|
||||
$sql.= " AND fk_statut = 0";
|
||||
|
||||
dol_syslog("Fichinter::setValid sql=".$sql);
|
||||
dol_syslog(get_class($this)."::setValid sql=".$sql);
|
||||
$resql=$this->db->query($sql);
|
||||
if ($resql)
|
||||
{
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHEINTER_VALIDATE',$this,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_VALIDATE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
@ -377,7 +386,7 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=join(',',$this->errors);
|
||||
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR);
|
||||
dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -385,7 +394,7 @@ class Fichinter extends CommonObject
|
||||
{
|
||||
$this->db->rollback();
|
||||
$this->error=$this->db->lasterror();
|
||||
dol_syslog("Fichinter::setValid ".$this->error,LOG_ERR);
|
||||
dol_syslog(get_class($this)."::setValid ".$this->error,LOG_ERR);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
@ -675,7 +684,7 @@ class Fichinter extends CommonObject
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($this->db);
|
||||
$result=$interface->run_triggers('FICHEINTER_DELETE',$this,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_DELETE',$this,$user,$langs,$conf);
|
||||
if ($result < 0) {
|
||||
$error++; $this->errors=$interface->errors;
|
||||
}
|
||||
|
||||
@ -719,7 +719,7 @@ if ($action == 'send' && ! GETPOST('cancel','alpha') && (empty($conf->global->MA
|
||||
// Appel des triggers
|
||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||
$interface=new Interfaces($db);
|
||||
$result=$interface->run_triggers('FICHEINTER_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
$result=$interface->run_triggers('FICHINTER_SENTBYMAIL',$object,$user,$langs,$conf);
|
||||
if ($result < 0) { $error++; $this->errors=$interface->errors; }
|
||||
// Fin appel triggers
|
||||
|
||||
@ -1387,7 +1387,7 @@ else if ($id > 0 || ! empty($ref))
|
||||
else print '<a class="butActionRefused" href="#" title="'.$langs->trans("NotEnoughPermissions").'">'.$langs->trans("CreateBill").'</a>';
|
||||
}
|
||||
|
||||
if (! empty($conf->global->FICHEINTER_CLASSIFY_BILLED))
|
||||
if (! empty($conf->global->FICHINTER_CLASSIFY_BILLED))
|
||||
{
|
||||
if ($object->statut != 2)
|
||||
{
|
||||
|
||||
@ -30,7 +30,7 @@
|
||||
-- List of all managed triggered events (used for trigger agenda and for notification)
|
||||
--
|
||||
delete from llx_c_action_trigger;
|
||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHEINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18);
|
||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (1,'FICHINTER_VALIDATE','Intervention validated','Executed when a intervention is validated','ficheinter',18);
|
||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (2,'BILL_VALIDATE','Customer invoice validated','Executed when a customer invoice is approved','facture',6);
|
||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (3,'ORDER_SUPPLIER_APPROVE','Supplier order request approved','Executed when a supplier order is approved','order_supplier',11);
|
||||
insert into llx_c_action_trigger (rowid,code,label,description,elementtype,rang) values (4,'ORDER_SUPPLIER_REFUSE','Supplier order request refused','Executed when a supplier order is refused','order_supplier',12);
|
||||
|
||||
Loading…
Reference in New Issue
Block a user