diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.php index f4b480eb4d..3ae2698aa3 100644 --- a/app/Models/Labels/DefaultLabel.php +++ b/app/Models/Labels/DefaultLabel.php @@ -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++; + } + } } }