FIX Max nb of generation of recurring invoice should not show warning

This commit is contained in:
Laurent Destailleur 2018-04-16 15:05:35 +02:00
parent 50d86a7cfd
commit 622042e9b2
3 changed files with 27 additions and 8 deletions

View File

@ -1518,7 +1518,7 @@ else
}
print '</td></tr>';
// Date when
// Date when (next invoice generation)
print '<tr><td>';
if ($action == 'date_when' || $object->frequency > 0)
{
@ -1534,7 +1534,14 @@ else
print $form->editfieldval($langs->trans("NextDateToExecution"), 'date_when', $object->date_when, $object, $user->rights->facture->creer, 'day', $object->date_when, null, '', '', 0, 'strikeIfMaxNbGenReached');
}
//var_dump(dol_print_date($object->date_when+60, 'dayhour').' - '.dol_print_date($now, 'dayhour'));
if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
if (! $object->isMaxNbGenReached())
{
if ($action != 'editdate_when' && $object->frequency > 0 && $object->date_when && $object->date_when < $now) print img_warning($langs->trans("Late"));
}
else
{
print img_info($langs->trans("MaxNumberOfGenerationReached"));
}
print '</td>';
print '</tr>';

View File

@ -598,11 +598,18 @@ if ($resql)
// Date next generation
if (! empty($arrayfields['f.date_when']['checked']))
{
print '<td align="center">';
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
print '</td>';
if (! $i) $totalarray['nbfield']++;
print '<td align="center">';
print ($objp->frequency ? ($invoicerectmp->isMaxNbGenReached()?'<strike>':'').dol_print_date($db->jdate($objp->date_when),'day').($invoicerectmp->isMaxNbGenReached()?'</strike>':'') : '<span class="opacitymedium">'.$langs->trans('NA').'</span>');
if (! $invoicerectmp->isMaxNbGenReached())
{
if ($objp->frequency > 0 && $db->jdate($objp->date_when) && $db->jdate($objp->date_when) < $now) print img_warning($langs->trans("Late"));
}
else
{
print img_info($langs->trans("MaxNumberOfGenerationReached"));
}
print '</td>';
if (! $i) $totalarray['nbfield']++;
}
if (! empty($arrayfields['f.datec']['checked']))
{
@ -629,7 +636,11 @@ if ($resql)
print '<td align="center">';
if ($user->rights->facture->creer && empty($invoicerectmp->suspended))
{
if (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today)
if ($invoicerectmp->isMaxNbGenReached())
{
print $langs->trans("MaxNumberOfGenerationReached");
}
elseif (empty($objp->frequency) || $db->jdate($objp->date_when) <= $today)
{
print '<a href="'.DOL_URL_ROOT.'/compta/facture/card.php?action=create&amp;socid='.$objp->socid.'&amp;fac_rec='.$objp->facid.'">';
print $langs->trans("CreateBill").'</a>';

View File

@ -521,3 +521,4 @@ BillCreated=%s bill(s) created
StatusOfGeneratedDocuments=Status of document generation
DoNotGenerateDoc=Do not generate document file
AutogenerateDoc=Auto generate document file
MaxNumberOfGenerationReached=Max number of gen. reached