Skip to content

Commit

Permalink
Merge pull request #14404 from snipe/fixes/Uninitialized-string-offse…
Browse files Browse the repository at this point in the history
…t-0-in-labels

Fixed uninitialized offset in labels in new label engine
  • Loading branch information
snipe committed Mar 10, 2024
2 parents 28ec0b8 + a289dfa commit 3fdee88
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions app/Models/Labels/DefaultLabel.php
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,21 @@ public function write($pdf, $record) {
$textY += $this->textSize + self::TEXT_MARGIN;
}

// Fields
// Render the selected fields with their labels
$fieldsDone = 0;
if ($fieldsDone < $this->getSupportFields()) {
// dd($record->get('fields'));

foreach ($record->get('fields') as $field) {

// Actually write the selected fields and their matching values
static::writeText(
$pdf, $field['label'][0]. ': ' . $field['value'],
$pdf, (($field['label']) ? $field['label'].' ' : '') . $field['value'],
$textX1, $textY,
'freesans', '', $this->textSize, 'L',
$textW, $this->textSize,
true, 0
);

$textY += $this->textSize + self::TEXT_MARGIN;
$fieldsDone++;
}
Expand Down

0 comments on commit 3fdee88

Please sign in to comment.