New: Add patch from Laurent Bouquet to support trigger events on line updates

This commit is contained in:
Laurent Destailleur 2009-07-01 23:05:51 +00:00
parent 9ce8d0d71c
commit b3c83490f8
3 changed files with 51 additions and 4 deletions

View File

@ -1717,7 +1717,9 @@ class Commande extends CommonObject
* \return int < 0 si erreur, > 0 si ok
*/
function updateline($rowid, $desc, $pu, $qty, $remise_percent=0, $txtva, $price_base_type='HT', $info_bits=0, $date_start='', $date_end='', $type=0)
{
{
global $conf;
dol_syslog("Commande::UpdateLine $rowid, $desc, $pu, $qty, $remise_percent, $txtva, $price_base_type, $info_bits, $date_start, $date_end, $type");
include_once(DOL_DOCUMENT_ROOT.'/lib/price.lib.php');
@ -1784,6 +1786,13 @@ class Commande extends CommonObject
// Mise a jour info denormalisees
$this->update_price();
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result=$interface->run_triggers('LINEORDER_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
$this->db->commit();
return $result;
}

View File

@ -3045,7 +3045,9 @@ class FactureLigne
*/
function update()
{
// Clean parameters
global $conf;
// Clean parameters
$this->desc=trim($this->desc);
// Check parameters
@ -3082,6 +3084,15 @@ class FactureLigne
$resql=$this->db->query($sql);
if ($resql)
{
if (! $notrigger)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEBILL_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit();
return 1;
}

View File

@ -448,7 +448,20 @@ class Propal extends CommonObject
if ($result > 0)
{
$this->update_price();
$this->db->commit();
$this->fk_propal = $this->id;
$this->rowid = $rowid;
if (! $notrigger)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEPROPAL_UPDATE',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit();
return $result;
}
else
@ -2167,7 +2180,9 @@ class PropaleLigne
* \return int <0 si ko, >0 si ok
*/
function insert()
{
{
global $conf;
dol_syslog("PropaleLigne::insert rang=".$this->rang);
$this->db->begin();
@ -2232,6 +2247,18 @@ class PropaleLigne
if ($resql)
{
$this->rang=$rangmax;
$this->rowid=$this->db->last_insert_id(MAIN_DB_PREFIX.'propaldet');
if (! $notrigger)
{
// Appel des triggers
include_once(DOL_DOCUMENT_ROOT . "/interfaces.class.php");
$interface=new Interfaces($this->db);
$result = $interface->run_triggers('LINEPROPAL_INSERT',$this,$user,$langs,$conf);
if ($result < 0) { $error++; $this->errors=$interface->errors; }
// Fin appel triggers
}
$this->db->commit();
return 1;
}