Fix when creating recurring invoice, date next gen was not set
This commit is contained in:
parent
d821df070b
commit
7c9996c840
@ -311,13 +311,15 @@ class Facture extends CommonInvoice
|
||||
|
||||
$forceduedate = $this->calculate_date_lim_reglement();
|
||||
|
||||
// For recurrn invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
|
||||
// For recurring invoices, update date and number of last generation of recurring template invoice, before inserting new invoice
|
||||
if ($_facrec->frequency > 0)
|
||||
{
|
||||
dol_syslog("This is a recurring invoice so we set date_last_gen and next date_when");
|
||||
if (empty($_facrec->date_when)) $_facrec->date_when = $now;
|
||||
$next_date = $_facrec->getNextDate(); // Calculate next date
|
||||
$_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
||||
$result = $_facrec->setValueFrom('date_last_gen', $now, '', null, 'date');
|
||||
//$_facrec->setValueFrom('nb_gen_done', $_facrec->nb_gen_done + 1); // Not required, +1 already included into setNextDate when second param is 1.
|
||||
$_facrec->setNextDate($next_date,1);
|
||||
$result = $_facrec->setNextDate($next_date,1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user