You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element." AS c";
200
197
if (!empty($code)) {
201
-
$sql .= ' WHERE c.code = \''.$this->db->escape($code).'\' AND c.entity = '.$conf->entity;
198
+
$sql .= " WHERE c.code = '".$this->db->escape($code)."'";
199
+
$sql .= " AND c.entity IN (".getEntity($this->element).")";
202
200
} else {
203
201
$sql .= ' WHERE c.rowid = '.((int) $id);
204
202
}
@@ -244,9 +242,10 @@ public function fetch($id, $code = null)
244
242
publicfunctionfetchAllCurrencyRate()
245
243
{
246
244
$sql = "SELECT cr.rowid";
247
-
$sql .= ' FROM '.MAIN_DB_PREFIX.$this->table_element_line.' as cr';
248
-
$sql .= ' WHERE cr.fk_multicurrency = '.((int) $this->id);
249
-
$sql .= ' ORDER BY cr.date_sync DESC';
245
+
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." as cr";
246
+
$sql .= " WHERE cr.entity IN (".getEntity($this->element).")";
247
+
$sql .= " AND cr.fk_multicurrency = ".((int) $this->id);
248
+
$sql .= " ORDER BY cr.date_sync DESC";
250
249
251
250
$this->rates = array();
252
251
@@ -482,8 +481,10 @@ public function getRate()
482
481
{
483
482
$sql = "SELECT cr.rowid";
484
483
$sql .= " FROM ".MAIN_DB_PREFIX.$this->table_element_line." as cr";
485
-
$sql .= " WHERE cr.fk_multicurrency = ".((int) $this->id);
486
-
$sql .= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS cr2 WHERE cr2.fk_multicurrency = ".((int) $this->id).")";
484
+
$sql .= " WHERE cr.entity IN (".getEntity($this->element).")";
485
+
$sql .= " AND cr.fk_multicurrency = ".((int) $this->id);
486
+
$sql .= " AND cr.date_sync = (SELECT MAX(cr2.date_sync) FROM ".MAIN_DB_PREFIX.$this->table_element_line." AS cr2";
487
+
$sql .= " WHERE cr2.entity IN (".getEntity($this->element).") AND cr2.fk_multicurrency = ".((int) $this->id).")";
0 commit comments