// Supply Orders CSV Import

This commit is contained in:
bMancone
2011-12-29 16:24:24 +00:00
parent 822ad7a155
commit 0d4ce7a269
8 changed files with 274 additions and 29 deletions
+1 -1
View File
@@ -115,7 +115,7 @@ class ProductSupplierCore extends ObjectModel
* @param int $id_product
* @param int $id_product_attribute
* @param int $id_supplier
* @return array
* @return string
*/
public static function getProductSupplierReference($id_product, $id_product_attribute, $id_supplier)
{
+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())
+1 -1
View File
@@ -462,7 +462,7 @@ class SupplyOrderCore extends ObjectModel
$query = new DbQuery();
$query->select('id_supply_order');
$query->from('supply_order', 'so');
$query->where('so.reference = "'.pSQL($match).'"');
$query->where('so.reference = "'.pSQL($reference).'"');
$id = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
if ($id === false)