Skip to content

A free open source IT asset/license management system

update LW 1933081

Godfrey M66d85d17d954
diff --git a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php
index bba3c992dc..fd988a0f79 100644
--- a/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php
+++ b/app/Models/Labels/Tapes/Dymo/LabelWriter_1933081.php
@@ -81,19 +81,18 @@ class LabelWriter_1933081 extends LabelWriter
);
$currentX += $barcodeSize + self::BARCODE_MARGIN;
$usableWidth -= $barcodeSize + self::BARCODE_MARGIN;
- }
-
- if ($record->has('title')) {
- static::writeText(
- $pdf, $record->get('title'),
- $currentX, $currentY,
- 'freesans', 'b', self::TITLE_SIZE, 'L',
- $usableWidth, self::TITLE_SIZE, true, 0
- );
- $currentY += self::TITLE_SIZE + self::TITLE_MARGIN;
}
+ $title = $record->has('title') ? $record->get('title') : null;
$fields = $record->get('fields');
+ $maxFields = $this->getSupportFields();
+ $fields = collect($fields);
+ if ($title) {
+ $maxFields = max(0, $maxFields - 1); // title consumes one row’s worth of space
+ }
+
+ $fields = $fields->take($maxFields)->values();
+
$usableHeight = $pa->h
- self::TAG_SIZE // bottom tag text
- self::BARCODE_MARGIN; // gap between fields and 1D
@@ -107,29 +106,42 @@ class LabelWriter_1933081 extends LabelWriter
baseLabelSize: self::LABEL_SIZE,
baseFieldSize: self::FIELD_SIZE,
baseFieldMargin: self::FIELD_MARGIN,
+ title: $title,
+ baseTitleSize: self::TITLE_SIZE,
+ baseTitleMargin: self::TITLE_MARGIN,
baseLabelPadding: 1.5,
baseGap: 1.5,
maxScale: 1.8,
labelFont: 'freesans',
);
+ extract($field_layout);
+ if ($hasTitle) {
+ static::writeText(
+ $pdf, $title,
+ $currentX, $currentY,
+ 'freesans', 'b', $titleSize, 'L',
+ $usableWidth, $titleSize, true, 0
+ );
+ $currentY += $titleAdvance;
+ }
foreach ($fields as $field) {
$labelText = rtrim($field['label'], ':') . ':';
static::writeText(
$pdf, $labelText,
$currentX, $currentY,
- 'freesans', '', $field_layout['labelSize'], 'L',
- $field_layout['labelWidth'], $field_layout['rowAdvance'], true, 0
+ 'freesans', '', $labelSize, 'L',
+ $labelWidth, $rowAdvance, true, 0
);
static::writeText(
$pdf, $field['value'],
$field_layout['valueX'], $currentY,
- 'freemono', 'B', $field_layout['fieldSize'], 'L',
- $field_layout['valueWidth'], $field_layout['rowAdvance'], true, 0, 0.01
+ 'freemono', 'B', $fieldSize, 'L',
+ $valueWidth, $rowAdvance, true, 0, 0.01
);
- $currentY += $field_layout['rowAdvance'];
+ $currentY += $rowAdvance;
}
if ($record->has('barcode1d')) {