diff --git a/classes/stock/SupplyOrder.php b/classes/stock/SupplyOrder.php index c16668ef2..e5f1ce195 100755 --- a/classes/stock/SupplyOrder.php +++ b/classes/stock/SupplyOrder.php @@ -432,6 +432,7 @@ class SupplyOrderCore extends ObjectModel /** * For a given id or reference, tells if the supply order exists * @param int|string $match + * @return int id */ public static function exists($match) { @@ -464,6 +465,9 @@ class SupplyOrderCore extends ObjectModel $query->where('so.reference = "'.pSQL($match).'"'); $id = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query); + if ($id === false) + return false; + return (new SupplyOrder((int)$id)); }