// SupplyOrder reference is now unique

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11854 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2011-12-28 14:58:55 +00:00
parent 72b7fa3801
commit d8422f1896
3 changed files with 34 additions and 0 deletions
+18
View File
@@ -429,6 +429,24 @@ class SupplyOrderCore extends ObjectModel
return ($res > 0);
}
/**
* For a given id or reference, tells if the supply order exists
* @param int|string $match
*/
public static function exists($match)
{
if (!$match)
return false;
$query = new DbQuery();
$query->select('id_supply_order');
$query->from('supply_order', 'so');
$query->where('so.id_supply_order = '.(int)$match.' OR so.reference = "'.pSQL($match).'"');
$res = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);
return ($res > 0);
}
/**
* Webservice : gets the ids supply_order_detail associated to this order
* @return array