Fixed uninitialized offset in labels

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2024-03-08 16:46:56 +00:00
parent 07880dfe50
commit 37dfecf098

View file

@ -163,17 +163,21 @@ class DefaultLabel extends RectangleSheet
// Fields
$fieldsDone = 0;
if ($fieldsDone < $this->getSupportFields()) {
// dd($record->get('fields'));
foreach ($record->get('fields') as $field) {
static::writeText(
$pdf, $field['label'][0]. ': ' . $field['value'],
$textX1, $textY,
'freesans', '', $this->textSize, 'L',
$textW, $this->textSize,
true, 0
);
$textY += $this->textSize + self::TEXT_MARGIN;
$fieldsDone++;
if ((array_key_exists('label', $field)) && (is_array($field['label']))) {
static::writeText(
$pdf, $field['label'][0]. ': ' . $field['value'],
$textX1, $textY,
'freesans', '', $this->textSize, 'L',
$textW, $this->textSize,
true, 0
);
$textY += $this->textSize + self::TEXT_MARGIN;
$fieldsDone++;
}
}
}
}