FIX Error management. Do no try to approve PO if validation fails.

This commit is contained in:
Laurent Destailleur 2020-08-24 17:07:30 +02:00
parent 0944e8b156
commit 05d82a0684

View File

@ -854,11 +854,12 @@ if (empty($reshook))
}
else
{
$error++;
setEventMessages($object->error, $object->errors, 'errors');
}
// If we have permission, and if we don't need to provide the idwarehouse, we go directly on approved step
if (empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)))
if (!$error && empty($conf->global->SUPPLIER_ORDER_NO_DIRECT_APPROVE) && $user->rights->fournisseur->commande->approuver && !(!empty($conf->global->STOCK_CALCULATE_ON_SUPPLIER_VALIDATE_ORDER) && $object->hasProductsOrServices(1)))
{
$action = 'confirm_approve'; // can make standard or first level approval also if permission is set
}