Merge pull request 'Changed logic in sticker pdf service of current date' (#1163) from ranjith-dev into master
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Some checks failed
Scan for leaked secrets using Kingfisher / kingfisher-secrets-scan (push) Has been cancelled
Reviewed-on: #1163
This commit was merged in pull request #1163.
This commit is contained in:
@@ -1054,7 +1054,7 @@ class StickerPdfService
|
|||||||
$plantName = $itemCharacteristic?->plant?->name ?? '';
|
$plantName = $itemCharacteristic?->plant?->name ?? '';
|
||||||
$plantAddress = $itemCharacteristic?->plant?->address ?? '';
|
$plantAddress = $itemCharacteristic?->plant?->address ?? '';
|
||||||
$dateOfTest = $itemCharacteristic?->created_at?->format('d.m.Y') ?? '';
|
$dateOfTest = $itemCharacteristic?->created_at?->format('d.m.Y') ?? '';
|
||||||
$currentDate = $itemCharacteristic?->created_at?->format('M-y') ?? '';
|
// $currentDate = $itemCharacteristic?->created_at?->format('M-y') ?? '';
|
||||||
|
|
||||||
|
|
||||||
foreach ($dynamicElements as $element) {
|
foreach ($dynamicElements as $element) {
|
||||||
@@ -1116,8 +1116,11 @@ class StickerPdfService
|
|||||||
if ($row->characteristics_type == 'plant_address') {
|
if ($row->characteristics_type == 'plant_address') {
|
||||||
$textValue = $plantAddress;
|
$textValue = $plantAddress;
|
||||||
}
|
}
|
||||||
|
// if ($row->characteristics_type == 'current_date') {
|
||||||
|
// $textValue = $currentDate;
|
||||||
|
// }
|
||||||
if ($row->characteristics_type == 'current_date') {
|
if ($row->characteristics_type == 'current_date') {
|
||||||
$textValue = $currentDate;
|
$textValue = '__CURRENT_DATE__';
|
||||||
}
|
}
|
||||||
if ($row->characteristics_type == 'date_of_test') {
|
if ($row->characteristics_type == 'date_of_test') {
|
||||||
$textValue = $dateOfTest;
|
$textValue = $dateOfTest;
|
||||||
@@ -1462,7 +1465,6 @@ class StickerPdfService
|
|||||||
|
|
||||||
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
|
public function generateBulkFromTemplate(array $template,$fromSerial,$toSerial,string $itemCode)
|
||||||
{
|
{
|
||||||
Log::info('PDF DEBUG: ENTERED generateBulkFromTemplate');
|
|
||||||
$stickerWidth = (float) $template['width'];
|
$stickerWidth = (float) $template['width'];
|
||||||
$stickerHeight = (float) $template['height'];
|
$stickerHeight = (float) $template['height'];
|
||||||
$stickerId = $template['sticker_id'] ?? null;
|
$stickerId = $template['sticker_id'] ?? null;
|
||||||
@@ -1643,6 +1645,8 @@ class StickerPdfService
|
|||||||
|
|
||||||
$pdf->AddPage();
|
$pdf->AddPage();
|
||||||
|
|
||||||
|
$serialString = (string) $serial;
|
||||||
|
|
||||||
$firstSerial = $serial;
|
$firstSerial = $serial;
|
||||||
|
|
||||||
$secondSerial = $serial + 1;
|
$secondSerial = $serial + 1;
|
||||||
@@ -1664,12 +1668,17 @@ class StickerPdfService
|
|||||||
$textValue = '';
|
$textValue = '';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (strlen($serialString) >= 4) {
|
||||||
|
$year = substr($serialString, 0, 2);
|
||||||
|
$month = substr($serialString, 2, 2);
|
||||||
|
|
||||||
Log::info('PDF FONT DEBUG', [
|
if ((int) $month >= 1 && (int) $month <= 12) {
|
||||||
'font' => $element['font'],
|
$textValue = \Carbon\Carbon::createFromFormat(
|
||||||
'size' => $element['size'],
|
'y-m',
|
||||||
'text' => $textValue,
|
$year . '-' . $month
|
||||||
]);
|
)->format('M-y');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$pdf->SetFont(
|
$pdf->SetFont(
|
||||||
$element['font'],
|
$element['font'],
|
||||||
|
|||||||
Reference in New Issue
Block a user