// Replace shop->sqlAsso(), shop->sqlLang() and shop->sqlRestriction() with shop->addSqlAssociation(), shop->addSqlRestrictionOnLang() and shop->addSqlRestriction()

This commit is contained in:
rMalie
2011-10-17 09:46:08 +00:00
parent b0be0dd5ab
commit e6f45e54a6
60 changed files with 205 additions and 197 deletions
+8 -8
View File
@@ -679,7 +679,7 @@ class OrderCore extends ObjectModel
$sql = 'SELECT `id_order`
FROM `'._DB_PREFIX_.'orders`
WHERE DATE_ADD(date_upd, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND date_upd >= \''.pSQL($date_from).'\'
'.Context::getContext()->shop->sqlRestriction()
'.Context::getContext()->shop->addSqlRestriction()
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '');
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
@@ -707,7 +707,7 @@ class OrderCore extends ObjectModel
FROM `'._DB_PREFIX_.'orders` o
LEFT JOIN `'._DB_PREFIX_.'customer` c ON (c.`id_customer` = o.`id_customer`)
WHERE 1
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
'.Context::getContext()->shop->addSqlRestriction(false, 'o').'
ORDER BY o.`date_add` DESC
'.((int)$limit ? 'LIMIT 0, '.(int)$limit : '');
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
@@ -718,7 +718,7 @@ class OrderCore extends ObjectModel
$sql = 'SELECT `id_order`
FROM `'._DB_PREFIX_.'orders`
WHERE DATE_ADD(invoice_date, INTERVAL -1 DAY) <= \''.pSQL($date_to).'\' AND invoice_date >= \''.pSQL($date_from).'\'
'.Context::getContext()->shop->sqlRestriction()
'.Context::getContext()->shop->addSqlRestriction()
.($type ? ' AND '.pSQL(strval($type)).'_number != 0' : '')
.($id_customer ? ' AND id_customer = '.(int)($id_customer) : '').
' ORDER BY invoice_date ASC';
@@ -741,7 +741,7 @@ class OrderCore extends ObjectModel
ORDER BY date_add DESC, id_order_history DESC
LIMIT 1
)
'.Context::getContext()->shop->sqlRestriction(false, 'o').'
'.Context::getContext()->shop->addSqlRestriction(false, 'o').'
ORDER BY invoice_date ASC';
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
@@ -812,7 +812,7 @@ class OrderCore extends ObjectModel
$sql = 'SELECT COUNT(`id_order`) AS nb
FROM `'._DB_PREFIX_.'orders`
WHERE `id_customer` = '.(int)$id_customer
.Context::getContext()->shop->sqlRestriction();
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
return isset($result['nb']) ? $result['nb'] : 0;
@@ -829,7 +829,7 @@ class OrderCore extends ObjectModel
$sql = 'SELECT `id_order`
FROM `'._DB_PREFIX_.'orders`
WHERE `id_cart` = '.(int)($id_cart)
.Context::getContext()->shop->sqlRestriction();
.Context::getContext()->shop->addSqlRestriction();
$result = Db::getInstance()->getRow($sql);
return isset($result['id_order']) ? $result['id_order'] : false;
@@ -948,7 +948,7 @@ class OrderCore extends ObjectModel
$sql = 'SELECT id_order
FROM `'._DB_PREFIX_.'orders`
WHERE `delivery_number` = '.(int)($id_delivery).'
'.Context::getContext()->shop->sqlRestriction();
'.Context::getContext()->shop->addSqlRestriction();
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow($sql);
return new Order((int)($res['id_order']));
}
@@ -981,7 +981,7 @@ class OrderCore extends ObjectModel
WHERE o.`id_order` = '.(int)$this->id.'
AND c.`email` = \''.pSQL($email).'\'
AND c.`is_guest` = 1
'.Context::getContext()->shop->sqlRestriction(false, 'c');
'.Context::getContext()->shop->addSqlRestriction(false, 'c');
return (bool)Db::getInstance()->getValue($sql);
}