Skip to content

Commit dc3c396

Browse files
authored
Merge pull request #35125 from dukenv0307/fix/33763
2 parents c2083e3 + 9263a0f commit dc3c396

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

src/libs/actions/IOU.js

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1401,10 +1401,11 @@ function requestMoney(
14011401
* @param {String} category
14021402
* @param {String} tag
14031403
* @param {String} existingSplitChatReportID - the report ID where the split bill happens, could be a group chat or a workspace chat
1404+
* @param {Boolean} billable
14041405
*
14051406
* @return {Object}
14061407
*/
1407-
function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') {
1408+
function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '', billable = false) {
14081409
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin);
14091410
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID));
14101411
const existingSplitChatReport =
@@ -1428,6 +1429,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
14281429
undefined,
14291430
category,
14301431
tag,
1432+
billable,
14311433
);
14321434

14331435
// Note: The created action must be optimistically generated before the IOU action so there's no chance that the created action appears after the IOU action in the chat
@@ -1629,6 +1631,7 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
16291631
undefined,
16301632
category,
16311633
tag,
1634+
billable,
16321635
);
16331636

16341637
// STEP 4: Build optimistic reportActions. We need:
@@ -1746,8 +1749,9 @@ function createSplitsAndOnyxData(participants, currentUserLogin, currentUserAcco
17461749
* @param {String} category
17471750
* @param {String} tag
17481751
* @param {String} existingSplitChatReportID - Either a group DM or a workspace chat
1752+
* @param {Boolean} billable
17491753
*/
1750-
function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '') {
1754+
function splitBill(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, existingSplitChatReportID = '', billable = false) {
17511755
const {splitData, splits, onyxData} = createSplitsAndOnyxData(
17521756
participants,
17531757
currentUserLogin,
@@ -1759,6 +1763,7 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount,
17591763
category,
17601764
tag,
17611765
existingSplitChatReportID,
1766+
billable,
17621767
);
17631768
API.write(
17641769
'SplitBill',
@@ -1771,6 +1776,7 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount,
17711776
category,
17721777
merchant,
17731778
tag,
1779+
billable,
17741780
transactionID: splitData.transactionID,
17751781
reportActionID: splitData.reportActionID,
17761782
createdReportActionID: splitData.createdReportActionID,
@@ -1794,9 +1800,10 @@ function splitBill(participants, currentUserLogin, currentUserAccountID, amount,
17941800
* @param {String} merchant
17951801
* @param {String} category
17961802
* @param {String} tag
1803+
* @param {Boolean} billable
17971804
*/
1798-
function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag) {
1799-
const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag);
1805+
function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, billable) {
1806+
const {splitData, splits, onyxData} = createSplitsAndOnyxData(participants, currentUserLogin, currentUserAccountID, amount, comment, currency, merchant, category, tag, billable);
18001807

18011808
API.write(
18021809
'SplitBillAndOpenReport',
@@ -1809,6 +1816,7 @@ function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccou
18091816
comment,
18101817
category,
18111818
tag,
1819+
billable,
18121820
transactionID: splitData.transactionID,
18131821
reportActionID: splitData.reportActionID,
18141822
createdReportActionID: splitData.createdReportActionID,
@@ -1833,8 +1841,9 @@ function splitBillAndOpenReport(participants, currentUserLogin, currentUserAccou
18331841
* @param {String} tag
18341842
* @param {Object} receipt
18351843
* @param {String} existingSplitChatReportID - Either a group DM or a workspace chat
1844+
* @param {Boolean} billable
18361845
*/
1837-
function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, category, tag, receipt, existingSplitChatReportID = '') {
1846+
function startSplitBill(participants, currentUserLogin, currentUserAccountID, comment, category, tag, receipt, existingSplitChatReportID = '', billable = false) {
18381847
const currentUserEmailForIOUSplit = OptionsListUtils.addSMSDomainIfPhoneNumber(currentUserLogin);
18391848
const participantAccountIDs = _.map(participants, (participant) => Number(participant.accountID));
18401849
const existingSplitChatReport =
@@ -1862,6 +1871,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
18621871
undefined,
18631872
category,
18641873
tag,
1874+
billable,
18651875
);
18661876

18671877
// Note: The created action must be optimistically generated before the IOU action so there's no chance that the created action appears after the IOU action in the chat
@@ -2075,6 +2085,7 @@ function startSplitBill(participants, currentUserLogin, currentUserAccountID, co
20752085
category,
20762086
tag,
20772087
isFromGroupDM: !existingSplitChatReport,
2088+
billable,
20782089
...(existingSplitChatReport ? {} : {createdReportActionID: splitChatCreatedReportAction.reportActionID}),
20792090
},
20802091
{optimisticData, successData, failureData},

src/pages/iou/SplitBillDetailsPage.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ function SplitBillDetailsPage(props) {
102102
created: splitCreated,
103103
category: splitCategory,
104104
tag: splitTag,
105+
billable: splitBillable,
105106
} = isEditingSplitBill && props.draftTransaction ? ReportUtils.getTransactionDetails(props.draftTransaction) : ReportUtils.getTransactionDetails(props.transaction);
106107

107108
const onConfirm = useCallback(
@@ -133,6 +134,7 @@ function SplitBillDetailsPage(props) {
133134
iouMerchant={splitMerchant}
134135
iouCategory={splitCategory}
135136
iouTag={splitTag}
137+
iouIsBillable={splitBillable}
136138
iouType={CONST.IOU.TYPE.SPLIT}
137139
isReadOnly={!isEditingSplitBill}
138140
shouldShowSmartScanFields

src/pages/iou/request/step/IOURequestStepConfirmation.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ function IOURequestStepConfirmation({
226226
transaction.tag,
227227
receiptFile,
228228
report.reportID,
229+
transaction.billable,
229230
);
230231
return;
231232
}
@@ -244,6 +245,7 @@ function IOURequestStepConfirmation({
244245
transaction.category,
245246
transaction.tag,
246247
report.reportID,
248+
transaction.billable,
247249
);
248250
return;
249251
}
@@ -260,6 +262,7 @@ function IOURequestStepConfirmation({
260262
transaction.merchant,
261263
transaction.category,
262264
transaction.tag,
265+
transaction.billable,
263266
);
264267
return;
265268
}

0 commit comments

Comments
 (0)