fix(SPG-601) Confirm data status draft error - Cannot read properties of null (reading 'count')
continuous-integration/drone/tag Build is passing Details

pull/28/head devel_10.6.13
Aswin Ashar Abdullah 2024-07-15 12:43:57 +07:00
parent 001f371244
commit 688be5828d
2 changed files with 4 additions and 7 deletions

View File

@ -9,14 +9,14 @@ export async function generateInvoiceCodeHelper(dataService) {
const char = generateRandom(1);
const number = generateRandom(1, true);
const invoice_code = await dataService.getOneByOptions({
const invoice_code = await dataService.getManyByOptions({
where: {
invoice_code: ILike(`%${month_year}%`),
},
});
const current_number = invoice_code.length + 1;
return `INV-${month_year}${char}${number}/${invoice_code
.count()
return `INV-${month_year}${char}${number}/${current_number
.toString()
.padStart(5, '0')}`;
}

View File

@ -81,9 +81,6 @@ export function mappingRevertTransaction(data, type) {
booking_date: data.created_at,
settlement_date: data.created_at,
payment_type: data.payment_type,
payment_type_method_id: data.payment_type_bank?._id,
payment_type_method_name: data.payment_type_bank?.issuer_name,
payment_type_method_number: data.payment_type_bank?.account_number,
payment_card_information: data.card_information,
payment_code_reference: data.payment_code,
discount_code_id: data.discount_code?.id,
@ -109,7 +106,7 @@ export function mappingRevertTransaction(data, type) {
data.payment_type_method?.id ?? data.payment_type_bank?.id,
payment_type_method_number:
data.payment_type_method?.account_number ??
data.payment_type?.account_number,
data.payment_type_bank?.account_number,
payment_type_method_name:
data.payment_type_method?.issuer_name ??
data.payment_type_bank?.issuer_name,