E-Invoice - Fix an error reported by Eileen on a transfer with refund inaccessible

This commit is contained in:
Dillon Ngo
2025-10-03 14:13:37 +08:00
parent b829477d1a
commit 6ce4af05d9
+7 -5
View File
@@ -42,11 +42,13 @@ class TransactionResource extends JsonResource
$eInvoice = false;
if($booking && $this->type === TransactionType::REFUND){
$kvp = $this->attributesKVP()->where('key', KVPKey::TRANSACTION_MODEL_CLASS)->first();
$transactionCreditNote = Transaction::where('id', $kvp->value)->first();
if($transactionCreditNote){
$kvp = $transactionCreditNote->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
if($kvp){
$eInvoice = true;
if($kvp){
$transactionCreditNote = Transaction::where('id', $kvp->value)->first();
if($transactionCreditNote){
$kvp = $transactionCreditNote->attributesKVP()->where('key', KVPKey::AUTOCOUNT_DOCNO_CREDIT_NOTE)->first();
if($kvp){
$eInvoice = true;
}
}
}
}