Skip to content

Commit

Permalink
Fix regression
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 11, 2018
1 parent eaecb9d commit f93f9e1
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions htdocs/contact/class/contact.class.php
Expand Up @@ -76,17 +76,17 @@ class Contact extends CommonObject
public $email;
public $skype;
public $photo;
public $jabberid;
public $jabberid;
public $phone_pro;
public $phone_perso;
public $phone_mobile;
public $fax;
public $fax;

public $priv;
public $priv;

public $birthday;
public $default_lang;
public $no_email; // 1=Don't send e-mail to this contact, 0=do
public $no_email; // 1=Don't send e-mail to this contact, 0=do

public $ref_facturation; // Reference number of invoice for which it is contact
public $ref_contrat; // Nb de reference contrat pour lequel il est contact
Expand Down Expand Up @@ -177,6 +177,8 @@ function create($user)
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)?$this->entity:$conf->entity;

This comment has been minimized.

Copy link
@hregis

hregis Jan 11, 2018

Contributor

@eldy
Add is_numeric test, if entity is empty the isset test return true

$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql.= " datec";
$sql.= ", fk_soc";
Expand All @@ -199,7 +201,7 @@ function create($user)
$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.= ")";
Expand Down

0 comments on commit f93f9e1

Please sign in to comment.