[-] BO : #PSCFV-3222 - Fix array unique strange working

This commit is contained in:
mDeflotte
2012-07-16 13:44:38 +00:00
parent b9fad9c5ef
commit d63b93a66e
2 changed files with 14 additions and 1 deletions
+13
View File
@@ -2178,6 +2178,19 @@ FileETag INode MTime Size
return false;
}
/**
* Reproduce array_unique working before php version 5.2.9
* @param array $array
* @return array
*/
public static function arrayUnique($array)
{
if (version_compare(phpversion(), '5.2.9', '<'))
return array_unique($array);
else
return array_unique($array, SORT_REGULAR);
}
}
/**
@@ -3567,7 +3567,7 @@ class AdminProductsControllerCore extends AdminController
if ($ws)
$warehouses[] = $ws;
}
$warehouses = array_unique($warehouses);
$warehouses = Tools::arrayUnique($warehouses);
if (empty($warehouses))
$advanced_stock_management_warning = true;