FIX : #5629 PgSQL Interger string stylish error
This commit is contained in:
parent
bf2955909a
commit
3932a32399
@ -595,50 +595,56 @@ abstract class CommonObject
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$datecreate = dol_now();
|
|
||||||
|
|
||||||
$this->db->begin();
|
|
||||||
|
|
||||||
// Insertion dans la base
|
if(! empty($id_type_contact)) {
|
||||||
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
|
||||||
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
|
||||||
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
|
|
||||||
$sql.= "'".$this->db->idate($datecreate)."'";
|
|
||||||
$sql.= ", 4, '". $id_type_contact . "' ";
|
|
||||||
$sql.= ")";
|
|
||||||
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
|
|
||||||
|
|
||||||
$resql=$this->db->query($sql);
|
$datecreate = dol_now();
|
||||||
if ($resql)
|
|
||||||
{
|
$this->db->begin();
|
||||||
if (! $notrigger)
|
|
||||||
{
|
// Insertion dans la base
|
||||||
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
$sql = "INSERT INTO ".MAIN_DB_PREFIX."element_contact";
|
||||||
if ($result < 0)
|
$sql.= " (element_id, fk_socpeople, datecreate, statut, fk_c_type_contact) ";
|
||||||
|
$sql.= " VALUES (".$this->id.", ".$fk_socpeople." , " ;
|
||||||
|
$sql.= "'".$this->db->idate($datecreate)."'";
|
||||||
|
$sql.= ", 4, ". $id_type_contact . " ";
|
||||||
|
$sql.= ")";
|
||||||
|
dol_syslog(get_class($this)."::add_contact", LOG_DEBUG);
|
||||||
|
|
||||||
|
$resql=$this->db->query($sql);
|
||||||
|
if ($resql)
|
||||||
|
{
|
||||||
|
if (! $notrigger)
|
||||||
{
|
{
|
||||||
|
$result=$this->call_trigger(strtoupper($this->element).'_ADD_CONTACT', $user);
|
||||||
|
if ($result < 0)
|
||||||
|
{
|
||||||
|
$this->db->rollback();
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->db->commit();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
||||||
|
{
|
||||||
|
$this->error=$this->db->errno();
|
||||||
|
$this->db->rollback();
|
||||||
|
return -2;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
$this->error=$this->db->error();
|
||||||
$this->db->rollback();
|
$this->db->rollback();
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->db->commit();
|
|
||||||
return 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if ($this->db->errno() == 'DB_ERROR_RECORD_ALREADY_EXISTS')
|
|
||||||
{
|
|
||||||
$this->error=$this->db->errno();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -2;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
$this->error=$this->db->error();
|
|
||||||
$this->db->rollback();
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user