New: add trigger PAYMENT_DELETE

This commit is contained in:
Regis Houssin 2011-06-16 10:32:41 +00:00
parent b22a7ce335
commit 403302e5b5
2 changed files with 19 additions and 1 deletions

View File

@ -257,8 +257,12 @@ class Paiement extends CommonObject
* Si le paiement porte sur au moins une facture a "payee", on refuse
* @return int <0 si ko, >0 si ok
*/
function delete()
function delete($notrigger=0)
{
global $conf, $user, $langs;
$error=0;
$bank_line_id = $this->bank_line;
$this->db->begin();
@ -324,6 +328,16 @@ class Paiement extends CommonObject
return -4;
}
}
if (! $notrigger)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('PAYMENT_DELETE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit();
return 1;

View File

@ -372,6 +372,10 @@ class InterfaceDemo
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_ADD_TO_BANK')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}
elseif ($action == 'PAYMENT_DELETE')
{
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
}