From acf83149356631ed8199e773dd979cc6f7b38fe3 Mon Sep 17 00:00:00 2001 From: Laurent Destailleur Date: Sat, 3 Aug 2019 16:32:35 +0200 Subject: [PATCH] FIX Missing where on entity --- htdocs/core/class/commonobject.class.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/htdocs/core/class/commonobject.class.php b/htdocs/core/class/commonobject.class.php index f69b4db68c1..442b50c27cf 100644 --- a/htdocs/core/class/commonobject.class.php +++ b/htdocs/core/class/commonobject.class.php @@ -2053,7 +2053,7 @@ abstract class CommonObject return -2; } } - + /** * Change the retained warranty payments terms * @@ -2066,11 +2066,11 @@ abstract class CommonObject if ($this->statut >= 0 || $this->element == 'societe') { $fieldname = 'retained_warranty_fk_cond_reglement'; - + $sql = 'UPDATE '.MAIN_DB_PREFIX.$this->table_element; $sql .= ' SET '.$fieldname.' = '.$id; $sql .= ' WHERE rowid='.$this->id; - + if ($this->db->query($sql)) { $this->retained_warranty_fk_cond_reglement = $id; @@ -5064,7 +5064,7 @@ abstract class CommonObject //dol_syslog("attributeLabel=".$attributeLabel, LOG_DEBUG); //dol_syslog("attributeType=".$attributeType, LOG_DEBUG); - + if (!empty($attrfieldcomputed)) { if (!empty($conf->global->MAIN_STORE_COMPUTED_EXTRAFIELDS)) @@ -7390,6 +7390,7 @@ abstract class CommonObject if (!empty($id)) $sql.= ' WHERE rowid = '.$id; elseif (!empty($ref)) $sql.= " WHERE ref = ".$this->quote($ref, $this->fields['ref']); else $sql.=' WHERE 1 = 1'; // usage with empty id and empty ref is very rare + if (empty($id) && $this->ismultientitymanaged == 1) $sql.=' AND entity IN ('.getEntity($this->table_element).')'; if ($morewhere) $sql.= $morewhere; $sql.=' LIMIT 1'; // This is a fetch, to be sure to get only one record