[ Task #1495 ] Add trigger LINECONTRACT_CREATE
This commit is contained in:
parent
ff19a87941
commit
9c2aaf7d23
@ -47,7 +47,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.
|
||||
- New: [ Task #1481 ] Add trigger BILL_SUPPLIER_MODIFY.
|
||||
- New: [ Task #1481 ] Add trigger BILL_SUPPLIER_UPDATE.
|
||||
- New: [ Task #1495 ] Add trigger LINECONTRACT_CREATE.
|
||||
|
||||
WARNING: Following change may create regression for some external modules, but was necessary to make
|
||||
Dolibarr better:
|
||||
|
||||
@ -824,6 +824,11 @@ class Contrat extends CommonObject
|
||||
$error=0;
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
@ -909,14 +914,6 @@ class Contrat extends CommonObject
|
||||
}
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('CONTRACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; }
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
if (! $error)
|
||||
{
|
||||
// We remove directory
|
||||
@ -1078,6 +1075,15 @@ class Contrat extends CommonObject
|
||||
$result=$this->update_statut($user);
|
||||
if ($result > 0)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_CREATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -1;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -1222,6 +1228,15 @@ class Contrat extends CommonObject
|
||||
$result=$this->update_statut($user);
|
||||
if ($result >= 0)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_UPDATE',$user);
|
||||
if ($result < 0)
|
||||
{
|
||||
$this->db->rollback();
|
||||
return -3;
|
||||
}
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -1257,6 +1272,11 @@ class Contrat extends CommonObject
|
||||
if ($this->statut >= 0)
|
||||
{
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_DELETE',$user);
|
||||
if ($result < 0) return -1;
|
||||
// End call triggers
|
||||
|
||||
$this->db->begin();
|
||||
|
||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."contratdet";
|
||||
@ -1271,11 +1291,6 @@ class Contrat extends CommonObject
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('LINECONTRACT_DELETE',$user);
|
||||
if ($result < 0) { $error++; $this->db->rollback(); return -1; }
|
||||
// End call triggers
|
||||
|
||||
$this->db->commit();
|
||||
return 1;
|
||||
}
|
||||
@ -1734,13 +1749,8 @@ class Contrat extends CommonObject
|
||||
/**
|
||||
* Classe permettant la gestion des lignes de contrats
|
||||
*/
|
||||
class ContratLigne
|
||||
class ContratLigne extends CommonObject
|
||||
{
|
||||
var $db; //!< To store db handler
|
||||
var $error; //!< To return error code (or message)
|
||||
var $errors=array(); //!< To return several error codes (or messages)
|
||||
//var $element='contratdet'; //!< Id that identify managed objects
|
||||
//var $table_element='contratdet'; //!< Name of table without prefix where object is stored
|
||||
|
||||
var $id;
|
||||
var $ref;
|
||||
|
||||
@ -417,6 +417,10 @@ class InterfaceDemo
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
elseif ($action == 'LINECONTRACT_CREATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
elseif ($action == 'LINECONTRACT_UPDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
@ -484,6 +488,10 @@ class InterfaceDemo
|
||||
elseif ($action == 'BILL_SUPPLIER_CREATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
elseif ($action == 'BILL_SUPPLIER_UPDATE')
|
||||
{
|
||||
dol_syslog("Trigger '".$this->name."' for action '$action' launched by ".__FILE__.". id=".$object->id);
|
||||
}
|
||||
elseif ($action == 'BILL_SUPPLIER_DELETE')
|
||||
{
|
||||
|
||||
@ -602,7 +602,7 @@ class FactureFournisseur extends CommonInvoice
|
||||
if (! $notrigger)
|
||||
{
|
||||
// Call trigger
|
||||
$result=$this->call_trigger('BILL_SUPPLIER_MODIFY',$user);
|
||||
$result=$this->call_trigger('BILL_SUPPLIER_UPDATE',$user);
|
||||
if ($result < 0) $error++;
|
||||
// End call triggers
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user