diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index 31e7792a7310..dfb219866524 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -54,7 +54,7 @@ function MoneyReportHeader({session, policy, chatReport, nextStep, report: money const canAllowSettlement = ReportUtils.hasUpdatedTotal(moneyRequestReport); const policyType = policy?.type; const isPayer = ReportUtils.isPayer(session, moneyRequestReport); - const isDraft = ReportUtils.isDraftExpenseReport(moneyRequestReport); + const isDraft = ReportUtils.isOpenExpenseReport(moneyRequestReport); const [isConfirmModalVisible, setIsConfirmModalVisible] = useState(false); const cancelPayment = useCallback(() => { diff --git a/src/components/ReportActionItem/ReportPreview.tsx b/src/components/ReportActionItem/ReportPreview.tsx index c78a3cedebbd..743bfd8fff88 100644 --- a/src/components/ReportActionItem/ReportPreview.tsx +++ b/src/components/ReportActionItem/ReportPreview.tsx @@ -119,7 +119,7 @@ function ReportPreview({ const numberOfRequests = ReportActionUtils.getNumberOfMoneyRequests(action); const moneyRequestComment = action?.childLastMoneyRequestComment ?? ''; const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(chatReport); - const isDraftExpenseReport = isPolicyExpenseChat && ReportUtils.isDraftExpenseReport(iouReport); + const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport); const isApproved = ReportUtils.isReportApproved(iouReport); const canAllowSettlement = ReportUtils.hasUpdatedTotal(iouReport); @@ -147,7 +147,7 @@ function ReportPreview({ pendingReceipts: numberOfPendingRequests, }); - const shouldShowSubmitButton = isDraftExpenseReport && reimbursableSpend !== 0; + const shouldShowSubmitButton = isOpenExpenseReport && reimbursableSpend !== 0; // The submit button should be success green colour only if the user is submitter and the policy does not have Scheduled Submit turned on const isWaitingForSubmissionFromCurrentUser = useMemo( diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index afa7efe93938..b828ad1f17e4 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -706,7 +706,7 @@ function isReportApproved(reportOrID: OnyxEntry | string | EmptyObject): /** * Checks if the supplied report is an expense report in Open state and status. */ -function isDraftExpenseReport(report: OnyxEntry | EmptyObject): boolean { +function isOpenExpenseReport(report: OnyxEntry | EmptyObject): boolean { return isExpenseReport(report) && report?.stateNum === CONST.REPORT.STATE_NUM.OPEN && report?.statusNum === CONST.REPORT.STATUS_NUM.OPEN; } @@ -2145,7 +2145,7 @@ function getMoneyRequestReportName(report: OnyxEntry, policy: OnyxEntry< return Localize.translateLocal('iou.payerSpentAmount', {payer: payerOrApproverName, amount: formattedAmount}); } - if (isProcessingReport(report) || isDraftExpenseReport(report) || moneyRequestTotal === 0) { + if (isProcessingReport(report) || isOpenExpenseReport(report) || moneyRequestTotal === 0) { return Localize.translateLocal('iou.payerOwesAmount', {payer: payerOrApproverName, amount: formattedAmount}); } @@ -2226,7 +2226,7 @@ function canEditMoneyRequest(reportAction: OnyxEntry): boolean { const isManager = currentUserAccountID === moneyRequestReport?.managerID; // Admin & managers can always edit coding fields such as tag, category, billable, etc. As long as the report has a state higher than OPEN. - if ((isAdmin || isManager) && !isDraftExpenseReport(moneyRequestReport)) { + if ((isAdmin || isManager) && !isOpenExpenseReport(moneyRequestReport)) { return true; } @@ -5366,7 +5366,7 @@ export { getIOUReportActionDisplayMessage, isWaitingForAssigneeToCompleteTask, isGroupChat, - isDraftExpenseReport, + isOpenExpenseReport, shouldUseFullTitleToDisplay, parseReportRouteParams, getReimbursementQueuedActionMessage, diff --git a/src/libs/actions/IOU.ts b/src/libs/actions/IOU.ts index 1c0d7fef2729..29cab600bd2d 100644 --- a/src/libs/actions/IOU.ts +++ b/src/libs/actions/IOU.ts @@ -3693,12 +3693,12 @@ function canIOUBePaid(iouReport: OnyxEntry | EmptyObject, chat iouReport, ); - const isDraftExpenseReport = isPolicyExpenseChat && ReportUtils.isDraftExpenseReport(iouReport); + const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport); const iouSettled = ReportUtils.isSettled(iouReport?.reportID); const {reimbursableSpend} = ReportUtils.getMoneyRequestSpendBreakdown(iouReport); const isAutoReimbursable = ReportUtils.canBeAutoReimbursed(iouReport, policy); - return isPayer && !isDraftExpenseReport && !iouSettled && !iouReport?.isWaitingOnBankAccount && reimbursableSpend !== 0 && !iouCanceled && !isAutoReimbursable; + return isPayer && !isOpenExpenseReport && !iouSettled && !iouReport?.isWaitingOnBankAccount && reimbursableSpend !== 0 && !iouCanceled && !isAutoReimbursable; } function canApproveIOU(iouReport: OnyxEntry | EmptyObject, chatReport: OnyxEntry | EmptyObject, policy: OnyxEntry | EmptyObject) { @@ -3720,11 +3720,11 @@ function canApproveIOU(iouReport: OnyxEntry | EmptyObject, cha const isCurrentUserManager = managerID === userAccountID; const isPolicyExpenseChat = ReportUtils.isPolicyExpenseChat(chatReport); - const isDraftExpenseReport = isPolicyExpenseChat && ReportUtils.isDraftExpenseReport(iouReport); + const isOpenExpenseReport = isPolicyExpenseChat && ReportUtils.isOpenExpenseReport(iouReport); const isApproved = ReportUtils.isReportApproved(iouReport); const iouSettled = ReportUtils.isSettled(iouReport?.reportID); - return isCurrentUserManager && !isDraftExpenseReport && !isApproved && !iouSettled; + return isCurrentUserManager && !isOpenExpenseReport && !isApproved && !iouSettled; } function hasIOUToApproveOrPay(chatReport: OnyxEntry | EmptyObject, excludedIOUReportID: string): boolean {