FIX Can't create invoice if PO disapproved

This commit is contained in:
Laurent Destailleur 2017-06-14 10:28:02 +02:00
parent 7939daa225
commit 0e867229db

View File

@ -2591,7 +2591,7 @@ elseif (! empty($object->id))
// Create bill // Create bill
if (! empty($conf->facture->enabled)) if (! empty($conf->facture->enabled))
{ {
if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->billed != 1)) // statut 2 means approved if (! empty($conf->fournisseur->enabled) && ($object->statut >= 2 && $object->statut != 7 && $object->billed != 1)) // statut 2 means approved, 7 means canceled
{ {
if ($user->rights->fournisseur->facture->creer) if ($user->rights->fournisseur->facture->creer)
{ {
@ -2601,7 +2601,7 @@ elseif (! empty($object->id))
} }
// Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not) // Classify billed manually (need one invoice if module invoice is on, no condition on invoice if not)
if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->billed != 1) // statut 2 means approved if ($user->rights->fournisseur->commande->creer && $object->statut >= 2 && $object->statut != 7 && $object->billed != 1) // statut 2 means approved
{ {
if (empty($conf->facture->enabled)) if (empty($conf->facture->enabled))
{ {