From 37dfecf098b4e6867c22d101cc1ff975b29c8c75 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 8 Mar 2024 16:46:56 +0000 Subject: [PATCH 1/4] Fixed uninitialized offset in labels Signed-off-by: snipe --- app/Models/Labels/DefaultLabel.php | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) 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++; + } + } } } From 28ec0b8ebb6f9f5a85e640aa3c98e55f5c8fa100 Mon Sep 17 00:00:00 2001 From: snipe Date: Fri, 8 Mar 2024 17:19:31 +0000 Subject: [PATCH 2/4] Removed debugging console lines Signed-off-by: snipe --- resources/views/partials/bootstrap-table.blade.php | 2 -- 1 file changed, 2 deletions(-) diff --git a/resources/views/partials/bootstrap-table.blade.php b/resources/views/partials/bootstrap-table.blade.php index e69e525e2b..430f9566c2 100644 --- a/resources/views/partials/bootstrap-table.blade.php +++ b/resources/views/partials/bootstrap-table.blade.php @@ -411,13 +411,11 @@ // add some stuff to get the value of the select2 option here? if ((row.available_actions) && (row.available_actions.bulk_selectable) && (row.available_actions.bulk_selectable.delete !== true)) { - console.log('value for ID ' + row.id + ' is NOT true:' + row.available_actions.bulk_selectable.delete); return { disabled:true, //checked: false, <-- not sure this will work the way we want? } } - console.log('value for ID ' + row.id + ' IS true:' + row.available_actions.bulk_selectable.delete); } From cde5502f946ff19b0f9ccedd0d18b064a23efe54 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 10 Mar 2024 14:03:21 +0000 Subject: [PATCH 3/4] Handle blank labels on asset label fields Signed-off-by: snipe --- app/Models/Labels/DefaultLabel.php | 31 ++++++++++++++++++------------ 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.php index 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++; } } } From a289dfaf8804a175dbfe6c2f895103e9f4fb9cd8 Mon Sep 17 00:00:00 2001 From: snipe Date: Sun, 10 Mar 2024 14:33:53 +0000 Subject: [PATCH 4/4] Cleanup Signed-off-by: snipe --- app/Models/Labels/DefaultLabel.php | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/app/Models/Labels/DefaultLabel.php b/app/Models/Labels/DefaultLabel.php index 1377e93beb..9f7059bcd5 100644 --- a/app/Models/Labels/DefaultLabel.php +++ b/app/Models/Labels/DefaultLabel.php @@ -166,17 +166,9 @@ class DefaultLabel extends RectangleSheet foreach ($record->get('fields') as $field) { - $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'], + $pdf, (($field['label']) ? $field['label'].' ' : '') . $field['value'], $textX1, $textY, 'freesans', '', $this->textSize, 'L', $textW, $this->textSize,