// SupplyOrder form updated

git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@12784 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
bMancone
2012-01-30 10:11:36 +00:00
parent 22ccb0625b
commit d8f2908666
4 changed files with 35 additions and 7 deletions
@@ -979,8 +979,15 @@ class AdminSupplyOrdersControllerCore extends AdminController
// checks if supply order reference is unique
if (Tools::isSubmit('reference'))
{
// gets the reference
$ref = pSQL(Tools::getValue('reference'));
if ((int)SupplyOrder::exists($ref) != (int)Tools::getValue('id_supply_order'))
if (Tools::getValue('id_supply_order') != 0 && SupplyOrder::getReferenceById((int)Tools::getValue('id_supply_order')) != $ref)
{
if ((int)SupplyOrder::exists($ref) != 0)
$this->errors[] = Tools::displayError($this->l('The reference has to be unique.'));
}
else if (Tools::getValue('id_supply_order') == 0 && (int)SupplyOrder::exists($ref) != 0)
$this->errors[] = Tools::displayError($this->l('The reference has to be unique.'));
}