Skip to content

Commit

Permalink
Merge pull request #53943 from FitseTLT/fix-money-request-report-head…
Browse files Browse the repository at this point in the history
…er-titles

Fix - Expense - Report header title changes to Workspace owes X after editing custom name field
  • Loading branch information
francoisl authored Dec 13, 2024
2 parents fb332f2 + 319062e commit c7b91a4
Showing 1 changed file with 1 addition and 8 deletions.
9 changes: 1 addition & 8 deletions src/libs/ReportUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2990,13 +2990,6 @@ function isReportFieldDisabled(report: OnyxEntry<Report>, 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<string, PolicyReportField>) {
return Object.values(reportFields).find((field) => field?.type === 'formula');
}

/**
* Given a set of report fields, return the field that refers to title
*/
Expand Down Expand Up @@ -3074,7 +3067,7 @@ function getAvailableReportFields(report: Report, policyReportFields: PolicyRepo
function getMoneyRequestReportName(report: OnyxEntry<Report>, policy?: OnyxEntry<Policy>, invoiceReceiverPolicy?: OnyxEntry<Policy>): 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;
Expand Down

0 comments on commit c7b91a4

Please sign in to comment.