correction : delete trigger must be called before the delete of object
This commit is contained in:
parent
676101b02f
commit
c7f8699973
@ -1398,17 +1398,17 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
* @param int $idligne Id of line to delete
|
* @param int $idligne Id of line to delete
|
||||||
* @return 0 if Ok, <0 ik Ko
|
* @return 0 if Ok, <0 ik Ko
|
||||||
*/
|
*/
|
||||||
function deleteline($idligne)
|
function deleteline($idligne, $notrigger=0)
|
||||||
{
|
{
|
||||||
if ($this->statut == 0)
|
if ($this->statut == 0)
|
||||||
{
|
{
|
||||||
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idligne;
|
$sql = "DELETE FROM ".MAIN_DB_PREFIX."commande_fournisseurdet WHERE rowid = ".$idligne;
|
||||||
$resql=$this->db->query($sql);
|
$resql=$this->db->query($sql);
|
||||||
|
|
||||||
dol_syslog(get_class($this)."::deleteline sql=".$sql);
|
dol_syslog(get_class($this)."::deleteline sql=".$sql);
|
||||||
if ($resql)
|
|
||||||
{
|
if(!$notrigger && $resql){
|
||||||
// Appel des triggers
|
// Appel des triggers
|
||||||
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
include_once DOL_DOCUMENT_ROOT . '/core/class/interfaces.class.php';
|
||||||
$result = 0;
|
$result = 0;
|
||||||
$interface=new Interfaces($this->db);
|
$interface=new Interfaces($this->db);
|
||||||
@ -1417,7 +1417,10 @@ class CommandeFournisseur extends CommonOrder
|
|||||||
$error++; $this->errors=$interface->errors;
|
$error++; $this->errors=$interface->errors;
|
||||||
}
|
}
|
||||||
// Fin appel triggers
|
// Fin appel triggers
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
$result=$this->update_price();
|
$result=$this->update_price();
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1258,6 +1258,18 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
|
|
||||||
$error=0;
|
$error=0;
|
||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
|
if (! $error && ! $notrigger)
|
||||||
|
{
|
||||||
|
// Appel des triggers
|
||||||
|
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
||||||
|
$interface=new Interfaces($this->db);
|
||||||
|
$result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
||||||
|
if ($result < 0) {
|
||||||
|
$error++; $this->errors=$interface->errors;
|
||||||
|
}
|
||||||
|
// Fin appel triggers
|
||||||
|
}
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
@ -1273,19 +1285,6 @@ class FactureFournisseur extends CommonInvoice
|
|||||||
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
dol_syslog(get_class($this)."::delete ".$this->error, LOG_ERR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! $error && ! $notrigger)
|
|
||||||
{
|
|
||||||
// Appel des triggers
|
|
||||||
include_once(DOL_DOCUMENT_ROOT . "/core/class/interfaces.class.php");
|
|
||||||
$interface=new Interfaces($this->db);
|
|
||||||
$result=$interface->run_triggers('LINEBILL_SUPPLIER_DELETE',$this,$user,$langs,$conf);
|
|
||||||
if ($result < 0) {
|
|
||||||
$error++; $this->errors=$interface->errors;
|
|
||||||
}
|
|
||||||
// Fin appel triggers
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
if (! $error)
|
if (! $error)
|
||||||
{
|
{
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user