Fix website in multicompany mode

This commit is contained in:
Laurent Destailleur 2018-01-07 18:28:47 +01:00
parent 82fcf3cbdb
commit 2812dae3b3

View File

@ -215,10 +215,11 @@ class Website extends CommonObject
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms as date_modification"; $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
if (null !== $ref) { if (null !== $ref) {
$sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'"; $sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
} else { } else {
$sql .= ' WHERE t.rowid = ' . $id; $sql .= ' AND t.rowid = ' . $id;
} }
$resql = $this->db->query($sql); $resql = $this->db->query($sql);
@ -304,7 +305,7 @@ class Website extends CommonObject
$sql .= " t.date_creation,"; $sql .= " t.date_creation,";
$sql .= " t.tms as date_modification"; $sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t'; $sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
// Manage filter // Manage filter
$sqlwhere = array(); $sqlwhere = array();
if (count($filter) > 0) { if (count($filter) > 0) {
@ -313,7 +314,7 @@ class Website extends CommonObject
} }
} }
if (count($sqlwhere) > 0) { if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere); $sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
} }
if (!empty($sortfield)) { if (!empty($sortfield)) {