Merge pull request 'solved bug in current date issue' (#1164) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled

Reviewed-on: #1164
This commit was merged in pull request #1164.
This commit is contained in:
2026-10-04 10:00:43 +00:00

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(