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