From bcb85bdb1369ce8e25983c65bfbd7458ceb5056a Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Thu, 24 Aug 2023 15:49:53 +0200 Subject: [PATCH] Fix warnings --- htdocs/core/class/commonobject.class.php | 6 +++--- htdocs/core/class/commonpeople.class.php | 8 ++++++-- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index 33dcfc4b135..e45ecf13d7b 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -1892,10 +1892,10 @@ abstract class CommonObject dol_syslog(get_class($this).'::fetchObjectFrom', LOG_DEBUG); $resql = $this->db->query($sql); if ($resql) { - $row = $this->db->fetch_row($resql); + $obj = $this->db->fetch_object($resql); // Test for avoid error -1 - if ($row[0] > 0) { - $result = $this->fetch($row[0]); + if ($obj) { + $result = $this->fetch($obj->rowid); } } diff --git a/htdocs/core/class/commonpeople.class.php b/htdocs/core/class/commonpeople.class.php index 8ec59be05c7..456eeefeb4f 100644 --- a/htdocs/core/class/commonpeople.class.php +++ b/htdocs/core/class/commonpeople.class.php @@ -282,12 +282,16 @@ trait CommonPeople $this->lastname = dol_ucwords(dol_strtolower($this->lastname)); $this->firstname = dol_ucwords(dol_strtolower($this->firstname)); $this->name = dol_ucwords(dol_strtolower($this->name)); - $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):''; + if (property_exists($this, 'name_alias')) { + $this->name_alias = isset($this->name_alias)?dol_ucwords(dol_strtolower($this->name_alias)):''; + } } if (!empty($conf->global->MAIN_ALL_TO_UPPER)) { $this->lastname = dol_strtoupper($this->lastname); $this->name = dol_strtoupper($this->name); - $this->name_alias = dol_strtoupper($this->name_alias); + if (property_exists($this, 'name_alias')) { + $this->name_alias = dol_strtoupper($this->name_alias); + } } if (!empty($conf->global->MAIN_ALL_TOWN_TO_UPPER)) { $this->address = dol_strtoupper($this->address);