// Supply Orders CSV Import

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11901 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2011-12-29 16:24:24 +00:00
parent fffdc9b114
commit 9681cfc3a6
8 changed files with 274 additions and 29 deletions
+11 -8
View File
@@ -300,26 +300,29 @@ class SupplierCore extends ObjectModel
)
GROUP BY p.`id_product`';
return Db::getInstance()->executeS($sql);
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
/*
* Specify if a supplier already in base
* Tells if a supplier exists
*
* @param $id_supplier Supplier id
* @return boolean
*/
public static function supplierExists($id_supplier)
{
$row = Db::getInstance()->getRow('
SELECT `id_supplier`
FROM '._DB_PREFIX_.'supplier s
WHERE s.`id_supplier` = '.(int)$id_supplier
);
$query = new DbQuery();
$query->select('id_supplier');
$query->from('supplier');
$query->where('id_supplier = '.(int)$id_supplier);
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
return isset($row['id_supplier']);
return ($res > 0);
}
/**
* @see ObjectModel::delete()
*/
public function delete()
{
if (parent::delete())