Fix CI warning

This commit is contained in:
ldestailleur 2025-08-09 14:18:14 +02:00
parent 4f0c24aedc
commit c1944d9224

View file

@ -410,7 +410,7 @@ class MyObject extends CommonObject
* @param int $id Id object
* @param string $ref Ref
* @param int<0,1> $noextrafields 0=Default to load extrafields, 1=No extrafields
* @param int<0,1> $nolines 0=Default to load extrafields, 1=No extrafields
* @param int<0,1> $nolines 0=Default to load lines, 1=No lines
* @return int<-1,1> Return integer <0 if KO, 0 if not found, >0 if OK
*/
public function fetch($id, $ref = null, $noextrafields = 0, $nolines = 0)
@ -460,11 +460,15 @@ class MyObject extends CommonObject
$sql = "SELECT ";
$sql .= $this->getFieldList('t');
$sql .= " FROM ".$this->db->prefix().$this->table_element." as t";
if (isset($this->isextrafieldmanaged) && $this->isextrafieldmanaged == 1) {
if (!empty($this->isextrafieldmanaged) && $this->isextrafieldmanaged == 1) {
$sql .= " LEFT JOIN ".$this->db->prefix().$this->table_element."_extrafields as te ON te.fk_object = t.rowid";
}
if (isset($this->ismultientitymanaged) && $this->ismultientitymanaged == 1) {
if (!empty($this->ismultientitymanaged) && (int) $this->ismultientitymanaged == 1) {
$sql .= " WHERE t.entity IN (".getEntity($this->element).")";
} elseif (preg_match('/^\w+@\w+$/', (string) $this->ismultientitymanaged)) {
$tmparray = explode('@', (string) $this->ismultientitymanaged);
$sql .= " LEFT JOIN ".$this->db->prefix().$tmparray[1]." as pt ON t.".$this->db->sanitize($tmparray[0])." = pt.rowid";
$sql .= " WHERE pt.entity IN (".getEntity($this->element).")";
} else {
$sql .= " WHERE 1 = 1";
}