Skip to content

Commit

Permalink
Fix website in multicompany mode
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Jan 7, 2018
1 parent 82fcf3c commit 2812dae
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions htdocs/website/class/website.class.php
Expand Up @@ -215,10 +215,11 @@ public function fetch($id, $ref = null)
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element . ' as t';
$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
if (null !== $ref) {
$sql .= " WHERE t.ref = '" . $this->db->escape($ref) . "'";
$sql .= " AND t.ref = '" . $this->db->escape($ref) . "'";
} else {
$sql .= ' WHERE t.rowid = ' . $id;
$sql .= ' AND t.rowid = ' . $id;
}

$resql = $this->db->query($sql);
Expand Down Expand Up @@ -304,7 +305,7 @@ public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, arra
$sql .= " t.date_creation,";
$sql .= " t.tms as date_modification";
$sql .= ' FROM ' . MAIN_DB_PREFIX . $this->table_element. ' as t';

$sql .= ' WHERE t.entity IN ('.getEntity('website').')';
// Manage filter
$sqlwhere = array();
if (count($filter) > 0) {
Expand All @@ -313,7 +314,7 @@ public function fetchAll($sortorder='', $sortfield='', $limit=0, $offset=0, arra
}
}
if (count($sqlwhere) > 0) {
$sql .= ' WHERE ' . implode(' '.$filtermode.' ', $sqlwhere);
$sql .= ' AND ' . implode(' '.$filtermode.' ', $sqlwhere);
}

if (!empty($sortfield)) {
Expand Down

0 comments on commit 2812dae

Please sign in to comment.