Fix the trigger on delete thirdparty was not called
This commit is contained in:
parent
7e169c0801
commit
37cadaf4bf
@ -1215,7 +1215,7 @@ class Categorie extends CommonObject
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return list of categories (id or instances) linked to element of id $id and type $type
|
* Return list of categories (object instances or labels) linked to element of id $id and type $type
|
||||||
* Should be named getListOfCategForObject
|
* Should be named getListOfCategForObject
|
||||||
*
|
*
|
||||||
* @param int $id Id of element
|
* @param int $id Id of element
|
||||||
@ -1228,20 +1228,15 @@ class Categorie extends CommonObject
|
|||||||
*/
|
*/
|
||||||
function containing($id,$type,$mode='object')
|
function containing($id,$type,$mode='object')
|
||||||
{
|
{
|
||||||
// Deprecation warning
|
|
||||||
if (is_numeric($type)) {
|
|
||||||
dol_syslog(__METHOD__ . ': using numeric types is deprecated.', LOG_WARNING);
|
|
||||||
}
|
|
||||||
|
|
||||||
$cats = array();
|
$cats = array();
|
||||||
|
|
||||||
// For backward compatibility
|
// For backward compatibility
|
||||||
if (is_numeric( $type )) {
|
if (is_numeric($type))
|
||||||
|
{
|
||||||
|
dol_syslog(__METHOD__ . ': using numeric value for parameter type is deprecated. Use string code instead.', LOG_WARNING);
|
||||||
// We want to reverse lookup
|
// We want to reverse lookup
|
||||||
$map_type = array_flip($this->MAP_ID);
|
$map_type = array_flip($this->MAP_ID);
|
||||||
$type = $map_type[$type];
|
$type = $map_type[$type];
|
||||||
dol_syslog( get_class( $this ) . "::containing(): numeric types are deprecated, please use string instead",
|
|
||||||
LOG_WARNING );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sql = "SELECT ct.fk_categorie, c.label";
|
$sql = "SELECT ct.fk_categorie, c.label";
|
||||||
@ -1249,7 +1244,6 @@ class Categorie extends CommonObject
|
|||||||
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
|
$sql .= " WHERE ct.fk_categorie = c.rowid AND ct.fk_" . $this->MAP_CAT_FK[$type] . " = " . $id . " AND c.type = " . $this->MAP_ID[$type];
|
||||||
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
|
$sql .= " AND c.entity IN (" . getEntity( 'category', 1 ) . ")";
|
||||||
|
|
||||||
dol_syslog(get_class($this).'::containing', LOG_DEBUG);
|
|
||||||
$res = $this->db->query($sql);
|
$res = $this->db->query($sql);
|
||||||
if ($res)
|
if ($res)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -317,6 +317,7 @@ class Societe extends CommonObject
|
|||||||
* @var string
|
* @var string
|
||||||
*/
|
*/
|
||||||
var $note_public;
|
var $note_public;
|
||||||
|
|
||||||
//! code statut prospect
|
//! code statut prospect
|
||||||
var $stcomm_id;
|
var $stcomm_id;
|
||||||
var $statut_commercial;
|
var $statut_commercial;
|
||||||
@ -1305,9 +1306,11 @@ class Societe extends CommonObject
|
|||||||
* @param int $call_trigger 0=No, 1=yes
|
* @param int $call_trigger 0=No, 1=yes
|
||||||
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
* @return int <0 if KO, 0 if nothing done, >0 if OK
|
||||||
*/
|
*/
|
||||||
function delete($id, $user='', $call_trigger=1)
|
function delete($id, User $fuser=null, $call_trigger=1)
|
||||||
{
|
{
|
||||||
global $langs, $conf;
|
global $langs, $conf, $user;
|
||||||
|
|
||||||
|
if (empty($fuser)) $fuser=$user;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/lib/files.lib.php';
|
||||||
|
|
||||||
@ -1323,10 +1326,10 @@ class Societe extends CommonObject
|
|||||||
$this->db->begin();
|
$this->db->begin();
|
||||||
|
|
||||||
// User is mandatory for trigger call
|
// User is mandatory for trigger call
|
||||||
if ($user && $call_trigger)
|
if ($call_trigger)
|
||||||
{
|
{
|
||||||
// Call trigger
|
// Call trigger
|
||||||
$result=$this->call_trigger('COMPANY_DELETE',$user);
|
$result=$this->call_trigger('COMPANY_DELETE',$fuser);
|
||||||
if ($result < 0) $error++;
|
if ($result < 0) $error++;
|
||||||
// End call triggers
|
// End call triggers
|
||||||
}
|
}
|
||||||
@ -1452,6 +1455,7 @@ class Societe extends CommonObject
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
dol_syslog($this->error, LOG_ERR);
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user