Skip to content

Commit 178f8a1

Browse files
puneetlathOSBotify
authored andcommitted
Merge pull request #89357 from nyomanjyotisa/issue-84130-2
fix: correct add existing expense eligibility rules (cherry picked from commit a3ed587) (cherry-picked to staging by roryabraham)
1 parent f7c8b41 commit 178f8a1

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/pages/AddExistingExpense.tsx

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,13 @@ function AddExistingExpense({route}: AddExistingExpensePageType) {
9999
if (!transactions) {
100100
return [];
101101
}
102+
const isIOU = isIOUReport(report);
102103
return Object.values(transactions || {}).filter((item) => {
103104
const isUnreported = isUnreportedTransaction(item);
105+
if (isIOU && !isUnreported) {
106+
return false;
107+
}
108+
104109
const isOnOpenExpenseReport = !!(item?.reportID && (allOpenReports?.[item.reportID] ?? openReportDrafts?.[item.reportID]));
105110
if (!isUnreported && !isOnOpenExpenseReport) {
106111
return false;
@@ -121,13 +126,13 @@ function AddExistingExpense({route}: AddExistingExpensePageType) {
121126

122127
const transactionAmount = getTransactionDetails(item)?.amount ?? 0;
123128

124-
// Negative values are not allowed for unreported expenses
125-
if (transactionAmount < 0) {
129+
// Only block negative amounts for unreported expenses.
130+
if (transactionAmount < 0 && isUnreported) {
126131
return false;
127132
}
128133

129134
// Zero amount expenses are not allowed in IOU reports
130-
if (isIOUReport(report) && transactionAmount === 0) {
135+
if (isIOU && transactionAmount === 0) {
131136
return false;
132137
}
133138

0 commit comments

Comments
 (0)