Skip to content

Commit

Permalink
Merge pull request #266 from dbarzin/dev
Browse files Browse the repository at this point in the history
add observations field
  • Loading branch information
dbarzin authored Feb 9, 2025
2 parents 796faee + 98693d0 commit 002baea
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Http/Controllers/ControlController.php
Original file line number Diff line number Diff line change
Expand Up @@ -1678,6 +1678,7 @@ public function template()
$templateProcessor->setComplexValue('objective', self::string2Textrun($control->objective));
$templateProcessor->setComplexValue('input', self::string2Textrun($control->input));
$templateProcessor->setComplexValue('model', self::string2Textrun($control->model));
$templateProcessor->setComplexValue('observations', self::string2Textrun($control->observations));

$templateProcessor->setValue('date', Carbon::today()->format('d/m/Y'));

Expand All @@ -1697,7 +1698,9 @@ public function template()
return response()->download($filepath);
}

private static function string2Textrun(string $str) {
private static function string2Textrun(?string $str) {
if ($str === null)
return new \PhpOffice\PhpWord\Element\TextRun();
$textlines = explode("\n", $str);
$textrun = new \PhpOffice\PhpWord\Element\TextRun();
$textrun->addText(array_shift($textlines));
Expand Down

0 comments on commit 002baea

Please sign in to comment.