A free open source IT asset/license management system
Handle blank labels on asset label fields
snipecde5502f946f
diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.phpindex 3ae2698aa3..1377e93beb 100644--- a/app/Models/Labels/DefaultLabel.php+++ b/app/Models/Labels/DefaultLabel.php@@ -160,24 +160,31 @@ class DefaultLabel extends RectangleSheet$textY += $this->textSize + self::TEXT_MARGIN;}- // Fields+ // Render the selected fields with their labels$fieldsDone = 0;if ($fieldsDone < $this->getSupportFields()) {foreach ($record->get('fields') as $field) {-- 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++;++ $field_label = $field['label'];++ // If the label field in the visible fields on the asset label is NOT blank,+ // set the label to that value.+ if ($field_label!='') {+ $field_label = $field_label.': ';}+ // Actually write the selected fields and their matching values+ static::writeText(+ $pdf, $field_label . $field['value'],+ $textX1, $textY,+ 'freesans', '', $this->textSize, 'L',+ $textW, $this->textSize,+ true, 0+ );++ $textY += $this->textSize + self::TEXT_MARGIN;+ $fieldsDone++;}}}