fix : warehouse creation failed with mysql 5.7 (string 'NULL' instead of

"NULL")
This commit is contained in:
florian HENRY 2017-01-11 09:19:07 +01:00
parent cb7cd3baaf
commit 2c2bb366bd

View File

@ -112,7 +112,7 @@ class Entrepot extends CommonObject
$this->db->begin();
$sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (entity, datec, fk_user_author, label, fk_parent)";
$sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."', ".($this->fk_parent > 0 ? $this->fk_parent : 'NULL').")";
$sql .= " VALUES (".$conf->entity.",'".$this->db->idate($now)."',".$user->id.",'".$this->db->escape($this->libelle)."', ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")";
dol_syslog(get_class($this)."::create", LOG_DEBUG);
$result=$this->db->query($sql);
@ -186,7 +186,7 @@ class Entrepot extends CommonObject
$sql = "UPDATE ".MAIN_DB_PREFIX."entrepot ";
$sql .= " SET label = '" . $this->db->escape($this->libelle) ."'";
$sql .= ", fk_parent = " . (($this->fk_parent > 0) ? $this->fk_parent : 'NULL');
$sql .= ", fk_parent = " . (($this->fk_parent > 0) ? $this->fk_parent : "NULL");
$sql .= ", description = '" . $this->db->escape($this->description) ."'";
$sql .= ", statut = " . $this->statut;
$sql .= ", lieu = '" . $this->db->escape($this->lieu) ."'";