Fix: button to generate invoice manually must be disabled if we reach

max number of generation.
This commit is contained in:
Laurent Destailleur 2016-06-06 11:48:39 +02:00
parent a0458be943
commit 9c88eadbe4

View File

@ -1269,7 +1269,7 @@ else
// Nb of generation already done // Nb of generation already done
print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>'; print '<tr><td width="20%">'.$langs->trans("NbOfGenerationDone").'</td>';
print '<td>'; print '<td>';
print $object->nb_gen_done?$object->nb_gen_done:''; print $object->nb_gen_done?$object->nb_gen_done:'0';
print '</td>'; print '</td>';
print '</tr>'; print '</tr>';
@ -1337,6 +1337,12 @@ else
//if ($object->statut == Facture::STATUS_DRAFT) // there is no draft status on templates. //if ($object->statut == Facture::STATUS_DRAFT) // there is no draft status on templates.
//{ //{
if ($user->rights->facture->creer) if ($user->rights->facture->creer)
{
if (! empty($object->frequency) && $object->nb_gen_max > 0 && ($object->nb_gen_done >= $object->nb_gen_max))
{
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("MaxGenerationReached")).'">'.$langs->trans("CreateBill").'</a></div>';
}
else
{ {
if (empty($object->frequency) || $object->date_when <= $today) if (empty($object->frequency) || $object->date_when <= $today)
{ {
@ -1347,6 +1353,7 @@ else
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#" title="'.dol_escape_htmltag($langs->trans("DateIsNotEnough")).'">'.$langs->trans("CreateBill").'</a></div>';
} }
} }
}
else else
{ {
print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateBill").'</a></div>'; print '<div class="inline-block divButAction"><a class="butActionRefused" href="#">'.$langs->trans("CreateBill").'</a></div>';