From 0f115dafee2a75cc7000c57265493d15c9038199 Mon Sep 17 00:00:00 2001 From: Chl Date: Tue, 24 Jul 2018 00:30:43 +0200 Subject: [PATCH] 2 bugfix for PDF generated by Templates/Cron: DueDate and translation When launching Cron on a facturerec with auto_validate at 1, the generated PDF doesn't contain the DueDate, and some tokens like __INVOICE_PREVIOUS_MONTH_TEXT__ in the public notes are not translated (tested with fr_FR). --- htdocs/compta/facture/class/facture-rec.class.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/htdocs/compta/facture/class/facture-rec.class.php b/htdocs/compta/facture/class/facture-rec.class.php index 71123d1c6e2..a82f06ad851 100644 --- a/htdocs/compta/facture/class/facture-rec.class.php +++ b/htdocs/compta/facture/class/facture-rec.class.php @@ -984,6 +984,7 @@ class FactureRec extends CommonInvoice $error=0; $langs->load("bills"); + $langs->load('main'); $nb_create=0; @@ -1060,6 +1061,8 @@ class FactureRec extends CommonInvoice } if (! $error && $facturerec->generate_pdf) { + // We refresh the object in order to have all necessary data (like date_lim_reglement) + $facture->fetch($facture->id); $result = $facture->generateDocument($facturerec->modelpdf, $langs); if ($result <= 0) {