Fix: broken feature

This commit is contained in:
Regis Houssin 2018-01-11 10:47:40 +01:00
parent 95312d1944
commit 157e118cba
2 changed files with 3 additions and 2 deletions

View File

@ -176,6 +176,7 @@ class Contact extends CommonObject
if (empty($this->socid)) $this->socid = 0;
if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
$entity = (isset($this->entity) && is_numeric($this->entity)?$this->entity:$conf->entity);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql.= " datec";
@ -199,7 +200,7 @@ class Contact extends CommonObject
$sql.= " ".$this->priv.",";
$sql.= " ".$this->statut.",";
$sql.= " ".(! empty($this->canvas)?"'".$this->db->escape($this->canvas)."'":"null").",";
$sql.= " ".$this->entity.",";
$sql.= " ".$entity.",";
$sql.= "'".$this->db->escape($this->ref_ext)."',";
$sql.= " ".(! empty($this->import_key)?"'".$this->db->escape($this->import_key)."'":"null");
$sql.= ")";

View File

@ -471,7 +471,7 @@ class Societe extends CommonObject
if ($result >= 0)
{
$entity = isset($this->entity)?$this->entity:$conf->entity;
$entity = (isset($this->entity) && is_numeric($this->entity)?$this->entity:$conf->entity);
$sql = "INSERT INTO ".MAIN_DB_PREFIX."societe (nom, name_alias, entity, datec, fk_user_creat, canvas, status, ref_int, ref_ext, fk_stcomm, fk_incoterms, location_incoterms ,import_key, fk_multicurrency, multicurrency_code)";
$sql.= " VALUES ('".$this->db->escape($this->name)."', '".$this->db->escape($this->name_alias)."', ".$entity.", '".$this->db->idate($now)."'";