From ec1d95ca0eb75a3be6d0826d6c2915f90bbfd215 Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Wed, 27 Aug 2025 12:10:19 +0700 Subject: [PATCH 1/3] fix ensure multiple split expenses are created on confirm page --- .../step/IOURequestStepConfirmation.tsx | 43 +++++++++++-------- 1 file changed, 26 insertions(+), 17 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index 87d4bc29e4c8..b6c4119521b9 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -721,23 +721,32 @@ function IOURequestStepConfirmation({ const currentTransactionReceiptFile = transaction?.transactionID ? receiptFiles[transaction.transactionID] : undefined; - // If we have a receipt let's start the split expense by creating only the action, the transaction, and the group DM if needed - if (iouType === CONST.IOU.TYPE.SPLIT && currentTransactionReceiptFile) { - if (currentUserPersonalDetails.login && !!transaction) { - startSplitBill({ - participants: selectedParticipants, - currentUserLogin: currentUserPersonalDetails.login, - currentUserAccountID: currentUserPersonalDetails.accountID, - comment: trimmedComment, - receipt: currentTransactionReceiptFile, - existingSplitChatReportID: report?.reportID, - billable: transaction.billable, - reimbursable: transaction.reimbursable, - category: transaction.category, - tag: transaction.tag, - currency: transaction.currency, - taxCode: transactionTaxCode, - taxAmount: transactionTaxAmount, + // If any split transaction has a receipt, process each with action, transaction, and group DM as needed. + if (iouType === CONST.IOU.TYPE.SPLIT && Object.values(receiptFiles).filter((receipt) => !!receipt).length) { + if (currentUserPersonalDetails.login) { + transactions.forEach((item, index) => { + const transactionReceiptFile = receiptFiles[item.transactionID]; + if (!transactionReceiptFile) { + return; + } + const itemTrimmedComment = item?.comment?.comment?.trim() ?? ''; + + startSplitBill({ + participants: selectedParticipants, + currentUserLogin: currentUserPersonalDetails.login ?? '', + currentUserAccountID: currentUserPersonalDetails.accountID, + comment: itemTrimmedComment, + receipt: transactionReceiptFile, + existingSplitChatReportID: report?.reportID, + billable: item.billable, + reimbursable: item.reimbursable, + category: item.category, + tag: item.tag, + currency: item.currency, + taxCode: transactionTaxCode, + taxAmount: transactionTaxAmount, + shouldPlaySound: index === transactions.length - 1, + }); }); } return; From f34984431a2f4317a869bb549e2351b5bd215992 Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Thu, 28 Aug 2025 12:34:16 +0700 Subject: [PATCH 2/3] refactor code --- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index b6c4119521b9..f8fbb26da555 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -723,7 +723,8 @@ function IOURequestStepConfirmation({ // If any split transaction has a receipt, process each with action, transaction, and group DM as needed. if (iouType === CONST.IOU.TYPE.SPLIT && Object.values(receiptFiles).filter((receipt) => !!receipt).length) { - if (currentUserPersonalDetails.login) { + const currentUserLogin = currentUserPersonalDetails.login; + if (currentUserLogin) { transactions.forEach((item, index) => { const transactionReceiptFile = receiptFiles[item.transactionID]; if (!transactionReceiptFile) { @@ -733,7 +734,7 @@ function IOURequestStepConfirmation({ startSplitBill({ participants: selectedParticipants, - currentUserLogin: currentUserPersonalDetails.login ?? '', + currentUserLogin, currentUserAccountID: currentUserPersonalDetails.accountID, comment: itemTrimmedComment, receipt: transactionReceiptFile, From 98a99dc7bbe748ba0655557003daf8fa71e3822f Mon Sep 17 00:00:00 2001 From: Huu Le <20178761+huult@users.noreply.github.com> Date: Fri, 29 Aug 2025 12:12:01 +0700 Subject: [PATCH 3/3] update comment explanation --- src/pages/iou/request/step/IOURequestStepConfirmation.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx index f8fbb26da555..ad3db18f7ca2 100644 --- a/src/pages/iou/request/step/IOURequestStepConfirmation.tsx +++ b/src/pages/iou/request/step/IOURequestStepConfirmation.tsx @@ -721,7 +721,6 @@ function IOURequestStepConfirmation({ const currentTransactionReceiptFile = transaction?.transactionID ? receiptFiles[transaction.transactionID] : undefined; - // If any split transaction has a receipt, process each with action, transaction, and group DM as needed. if (iouType === CONST.IOU.TYPE.SPLIT && Object.values(receiptFiles).filter((receipt) => !!receipt).length) { const currentUserLogin = currentUserPersonalDetails.login; if (currentUserLogin) { @@ -732,6 +731,7 @@ function IOURequestStepConfirmation({ } const itemTrimmedComment = item?.comment?.comment?.trim() ?? ''; + // If we have a receipt let's start the split expense by creating only the action, the transaction, and the group DM if needed startSplitBill({ participants: selectedParticipants, currentUserLogin,