diff --git a/htdocs/compta/facture/fiche-rec.php b/htdocs/compta/facture/fiche-rec.php index 8118cbea1ac..0e0bc1d474b 100644 --- a/htdocs/compta/facture/fiche-rec.php +++ b/htdocs/compta/facture/fiche-rec.php @@ -1269,7 +1269,7 @@ else // Nb of generation already done print ''.$langs->trans("NbOfGenerationDone").''; print ''; - print $object->nb_gen_done?$object->nb_gen_done:''; + print $object->nb_gen_done?$object->nb_gen_done:'0'; print ''; print ''; @@ -1338,14 +1338,21 @@ else //{ if ($user->rights->facture->creer) { - if (empty($object->frequency) || $object->date_when <= $today) - { - print '
'.$langs->trans("CreateBill").'
'; - } - else - { - print '
'.$langs->trans("CreateBill").'
'; - } + if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max)) + { + print '
'.$langs->trans("CreateBill").'
'; + } + else + { + if (empty($object->frequency) || $object->date_when <= $today) + { + print '
'.$langs->trans("CreateBill").'
'; + } + else + { + print '
'.$langs->trans("CreateBill").'
'; + } + } } else {