1
0
forked from poc/pds

solved bug in current date issue

This commit is contained in:
dhanabalan
2026-10-04 15:30:31 +05:30
parent 4eb316cf34
commit bb1c54f094

View File

@@ -1646,11 +1646,29 @@ class StickerPdfService
$pdf->AddPage(); $pdf->AddPage();
$serialString = (string) $serial; $serialString = (string) $serial;
$serialDate = '';
$firstSerial = $serial; $firstSerial = $serial;
$secondSerial = $serial + 1; $secondSerial = $serial + 1;
$serialString = (string) $firstSerial;
$serialDate = '';
if (strlen($serialString) >= 4) {
$year = substr($serialString, 0, 2);
$month = substr($serialString, 2, 2);
if ((int) $month >= 1 && (int) $month <= 12) {
$serialDate = \Carbon\Carbon::createFromFormat(
'y-m',
$year . '-' . $month
)->format('M-y');
}
}
foreach ($template['elements'] as $element) { foreach ($template['elements'] as $element) {
if ($element['type'] == 'text') { if ($element['type'] == 'text') {
@@ -1668,16 +1686,8 @@ class StickerPdfService
$textValue = ''; $textValue = '';
} }
} }
if (strlen($serialString) >= 4) { if ($textValue == '__CURRENT_DATE__') {
$year = substr($serialString, 0, 2); $textValue = $serialDate;
$month = substr($serialString, 2, 2);
if ((int) $month >= 1 && (int) $month <= 12) {
$textValue = \Carbon\Carbon::createFromFormat(
'y-m',
$year . '-' . $month
)->format('M-y');
}
} }
$pdf->SetFont( $pdf->SetFont(