From 319062e5404403289936bee5ce6fa0a3d88a9855 Mon Sep 17 00:00:00 2001 From: FitseTLT Date: Wed, 11 Dec 2024 00:24:14 +0300 Subject: [PATCH] fix getMoneyRequestReportName --- src/libs/ReportUtils.ts | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a419df09538d..e7fe3b8ce6ae 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -2959,13 +2959,6 @@ function isReportFieldDisabled(report: OnyxEntry, reportField: OnyxEntry return isTitleField ? !reportField?.deletable : !isAdmin && (isReportSettled || isReportClosed); } -/** - * Given a set of report fields, return the field of type formula - */ -function getFormulaTypeReportField(reportFields: Record) { - return Object.values(reportFields).find((field) => field?.type === 'formula'); -} - /** * Given a set of report fields, return the field that refers to title */ @@ -3043,7 +3036,7 @@ function getAvailableReportFields(report: Report, policyReportFields: PolicyRepo function getMoneyRequestReportName(report: OnyxEntry, policy?: OnyxEntry, invoiceReceiverPolicy?: OnyxEntry): string { const isReportSettled = isSettled(report?.reportID ?? '-1'); const reportFields = isReportSettled ? report?.fieldList : getReportFieldsByPolicyID(report?.policyID ?? '-1'); - const titleReportField = getFormulaTypeReportField(reportFields ?? {}); + const titleReportField = Object.values(reportFields ?? {}).find((reportField) => reportField?.fieldID === CONST.REPORT_FIELD_TITLE_FIELD_ID); if (titleReportField && report?.reportName && isPaidGroupPolicyExpenseReport(report)) { return report.reportName;