support template variable entry.row for docx if description is not used (#504)
This commit is contained in:
@@ -13,6 +13,7 @@ use App\Entity\InvoiceDocument;
|
||||
use App\Invoice\RendererInterface;
|
||||
use App\Model\InvoiceModel;
|
||||
use PhpOffice\PhpWord\Escaper\Xml;
|
||||
use PhpOffice\PhpWord\Exception\Exception as OfficeException;
|
||||
use PhpOffice\PhpWord\TemplateProcessor;
|
||||
use Symfony\Component\HttpFoundation\File\Stream;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
@@ -40,7 +41,12 @@ class DocxRenderer extends AbstractRenderer implements RendererInterface
|
||||
$template->setValue($search, $replace);
|
||||
}
|
||||
|
||||
$template->cloneRow('entry.description', count($model->getCalculator()->getEntries()));
|
||||
try {
|
||||
$template->cloneRow('entry.description', count($model->getCalculator()->getEntries()));
|
||||
} catch (OfficeException $ex) {
|
||||
$template->cloneRow('entry.row', count($model->getCalculator()->getEntries()));
|
||||
}
|
||||
|
||||
$i = 1;
|
||||
foreach ($model->getCalculator()->getEntries() as $entry) {
|
||||
$values = $this->timesheetToArray($entry);
|
||||
|
||||
@@ -161,6 +161,7 @@ trait RendererTrait
|
||||
$end = $timesheet->getEnd();
|
||||
|
||||
return [
|
||||
'entry.row' => '',
|
||||
'entry.description' => $description,
|
||||
'entry.amount' => $amount,
|
||||
'entry.rate' => $this->getFormattedMoney($hourlyRate),
|
||||
|
||||
Reference in New Issue
Block a user