From defef24c3c39296e1f99bcece7c2a9fc8c6e0b92 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 23 Apr 2020 13:57:27 +0200 Subject: [PATCH] Fix regression --- htdocs/product/stock/class/entrepot.class.php | 8 ++++---- test/phpunit/EntrepotTest.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/htdocs/product/stock/class/entrepot.class.php b/htdocs/product/stock/class/entrepot.class.php index db2f84db15a..5f98de4993b 100644 --- a/htdocs/product/stock/class/entrepot.class.php +++ b/htdocs/product/stock/class/entrepot.class.php @@ -184,10 +184,10 @@ class Entrepot extends CommonObject $error = 0; - $this->libelle = trim($this->libelle); + if (empty($this->label)) $this->label = $this->libelle; // For backward compatibility - // Si libelle non defini, erreur - if ($this->libelle == '') + $this->label = trim($this->label); + if ($this->label == '') { $this->error = "ErrorFieldRequired"; return 0; @@ -198,7 +198,7 @@ class Entrepot extends CommonObject $this->db->begin(); $sql = "INSERT INTO ".MAIN_DB_PREFIX."entrepot (ref, entity, datec, fk_user_author, fk_parent)"; - $sql .= " VALUES ('".$this->db->escape($this->libelle)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; + $sql .= " VALUES ('".$this->db->escape($this->label)."', ".$conf->entity.", '".$this->db->idate($now)."', ".$user->id.", ".($this->fk_parent > 0 ? $this->fk_parent : "NULL").")"; dol_syslog(get_class($this)."::create", LOG_DEBUG); $result = $this->db->query($sql); diff --git a/test/phpunit/EntrepotTest.php b/test/phpunit/EntrepotTest.php index f5468d49c4b..45845cc8033 100644 --- a/test/phpunit/EntrepotTest.php +++ b/test/phpunit/EntrepotTest.php @@ -139,7 +139,7 @@ class EntrepotTest extends PHPUnit\Framework\TestCase $result=$localobject->create($user); print __METHOD__." result=".$result."\n"; - $this->assertLessThanOrEqual($result, 0); + $this->assertGreaterThan(0, $result); return $result; }