fix(webstatement): perbaikan format narasi dan penghilangan karakter tidak diinginkan

- Menambahkan pemanggilan fungsi `trim()` untuk menghapus spasi berlebihan di akhir narasi pada return value di fungsi pertama.
- Memperbaiki kondisi pengecekan `!==` pada variable `$fieldName` untuk meningkatkan kejelasan dan konsistensi dalam penulisan.
- Mengubah logika pengisian hasil narasi dengan memanfaatkan shorthand `$item->ft?->$fieldName ?? ''` untuk menghindari error saat field tidak ada nilainya.
- Menambahkan fungsi `str_replace` untuk menghapus karakter `<NL>` yang tidak diinginkan dari hasil narasi pada return value di fungsi kedua.

Signed-off-by: Daeng Deni Mardaeni <ddeni05@gmail.com>
This commit is contained in:
Daeng Deni Mardaeni
2025-05-23 20:44:38 +07:00
parent ed4ffb4254
commit 9f0ee812a9

View File

@@ -164,7 +164,7 @@
if ($item->ft?->recipt_no) { if ($item->ft?->recipt_no) {
$narr .= 'Receipt No: ' . $item->ft->recipt_no; $narr .= 'Receipt No: ' . $item->ft->recipt_no;
} }
return $narr; return trim($narr);
} }
/** /**
@@ -240,14 +240,14 @@
$result .= $paramValue; $result .= $paramValue;
} else { } else {
// If no value found, try to use the original field name as a fallback // If no value found, try to use the original field name as a fallback
if ($fieldName != 'recipt_no') { if ($fieldName !== 'recipt_no') {
$result .= $this->getTransaction($item->trans_reference, $fieldName) . ' '; $result .= ($item->ft?->$fieldName ?? '') . ' ';
} }
} }
} }
} }
return $result; return str_replace('<NL>','',$result);
} }
/** /**