// Warehouse: getWarehouseList is now getWarehouses. Employee: it is not possible to delete an employee if he manages warehouses, anymore.

This commit is contained in:
bMancone
2011-11-14 14:28:30 +00:00
parent 5bde977d1f
commit 0fd7bdcea4
7 changed files with 34 additions and 10 deletions
@@ -331,6 +331,14 @@ class AdminEmployeesControllerCore extends AdminController
$this->_errors[] = Tools::displayError('You cannot disable or delete the last administrator account.');
return false;
}
// It is not possible to delete an employee if he manages warehouses
$warehouses = Warehouse::getWarehousesByEmployee((int)Tools::getValue('id_employee'));
if (Tools::isSubmit('deleteemployee') && count($warehouses) > 0)
{
$this->_errors[] = Tools::displayError('You cannot delete this account since it manages warehouses. Check your warehouses first.');
return false;
}
}
else if (Tools::isSubmit('submitAddemployee'))
{