Merge pull request 'Added logs in sticker pdf service' (#1130) from ranjith-dev into master
All checks were successful
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Successful in 13s

Reviewed-on: #1130
This commit was merged in pull request #1130.
This commit is contained in:
2026-09-29 12:45:40 +00:00

View File

@@ -20,6 +20,7 @@ use TCPDF_FONTS;
class StickerPdfService
{
public function generateStickerItem(string $stickerId, Collection $dynamicElements, ?ItemCharacteristic $itemCharacteristic)
{
$dynamicValueMap = [];
@@ -1123,18 +1124,6 @@ class StickerPdfService
if ($row->characteristics_type == 'to_serial_number') {
$textValue = 'TO__SERIAL_NUMBER__';
}
// if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
// $column = 'zmm_grwt_pump';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
// if ($row->characteristics_type == 'zmm_newt_pump_dual') {
// $column = 'zmm_newt_pump';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
if ($row->characteristics_type == 'zmm_grwt_pump_dual') {
$column = 'zmm_grwt_pump';
@@ -1150,12 +1139,6 @@ class StickerPdfService
? number_format((float) $itemCharacteristic->{$column} * 2, 3, '.', '')
: '';
}
// if ($row->characteristics_type == 'mrp_dual') {
// $column = 'zmm_mrp';
// $textValue = $itemCharacteristic?->{$column} != null
// ? (float) $itemCharacteristic->{$column} * 2
// : '';
// }
if ($row->characteristics_type == 'mrp_dual') {
$column = 'zmm_mrp';
@@ -1179,19 +1162,36 @@ class StickerPdfService
if (!empty($row->string_font)) {
$fontFile = storage_path('app/private/fonts/' . $row->string_font . '.ttf');
Log::info($fontFile, [
'font' => $row->string_font,
]);
if (file_exists($fontFile)) {
\Log::info('TCPDF FONT DEBUG', [
'K_PATH_FONTS' => defined('K_PATH_FONTS') ? K_PATH_FONTS : 'NOT DEFINED',
'fontFile' => $fontFile,
'php_sapi' => PHP_SAPI,
]);
$font = TCPDF_FONTS::addTTFfont(
$fontFile,
'TrueTypeUnicode',
'',
32
);
Log::info('FONT CONVERSION RESULT', [
'result' => $font,
]);
} else {
Log::warning('FONT FILE NOT FOUND', [
'font_file' => $fontFile,
]);
$font = 'helvetica';
}
} else {
$font = 'helvetica';
}
}
$templateElements[] =
@@ -1461,6 +1461,7 @@ class StickerPdfService
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
{
Log::info('PDF DEBUG: ENTERED generateBulkFromTemplate');
$stickerWidth = (float) $template['width'];
$stickerHeight = (float) $template['height'];
$stickerId = $template['sticker_id'] ?? null;
@@ -1663,6 +1664,12 @@ class StickerPdfService
}
}
Log::info('PDF FONT DEBUG', [
'font' => $element['font'],
'size' => $element['size'],
'text' => $textValue,
]);
$pdf->SetFont(
$element['font'],
'',