A better fix to have default statut to enabled when created an address.

This commit is contained in:
Laurent Destailleur 2014-01-30 18:17:52 +01:00
parent d15aeb268f
commit c5d5d6a8d6

View File

@ -103,6 +103,7 @@ class Contact extends CommonObject
function __construct($db) function __construct($db)
{ {
$this->db = $db; $this->db = $db;
$this->statut = 1; // By default, status is enabled
} }
/** /**
@ -125,9 +126,9 @@ class Contact extends CommonObject
$this->firstname=trim($this->firstname); $this->firstname=trim($this->firstname);
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords($this->lastname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->lastname=ucwords($this->lastname);
if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname); if (! empty($conf->global->MAIN_FIRST_TO_UPPER)) $this->firstname=ucwords($this->firstname);
if (! $this->socid) $this->socid = 0; if (empty($this->socid)) $this->socid = 0;
if (! $this->priv) $this->priv = 0; if (empty($this->priv)) $this->priv = 0;
if (empty($this->statut)) $this->statut = 1; //Defult status to Actif if (empty($this->statut)) $this->statut = 0; // This is to convert '' into '0' to avoid bad sql request
$sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople ("; $sql = "INSERT INTO ".MAIN_DB_PREFIX."socpeople (";
$sql.= " datec"; $sql.= " datec";
@ -1100,7 +1101,5 @@ class Contact extends CommonObject
} }
} }
} }
?> ?>