Skip to content

fix Report fields still appear on the expense report when the feature is disabled #45668

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/components/ReportActionItem/MoneyReportView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ function MoneyReportView({report, policy, isCombinedReport = false, shouldShowTo
{!ReportUtils.isClosedExpenseReportWithNoExpenses(report) && (
<>
{ReportUtils.isPaidGroupPolicyExpenseReport(report) &&
policy?.areReportFieldsEnabled &&
(!isCombinedReport || !isOnlyTitleFieldEnabled) &&
sortedPolicyReportFields.map((reportField) => {
if (ReportUtils.isReportFieldOfTypeTitle(reportField)) {
Expand Down
6 changes: 3 additions & 3 deletions src/pages/EditReportFieldPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,10 @@ function EditReportFieldPage({route, policy, report}: EditReportFieldPageProps)
const isDisabled = ReportUtils.isReportFieldDisabled(report, reportField, policy);
const [isDeleteModalVisible, setIsDeleteModalVisible] = useState(false);
const {translate} = useLocalize();
const isReportFieldTitle = ReportUtils.isReportFieldOfTypeTitle(reportField);
const reportFieldsEnabled = (ReportUtils.isPaidGroupPolicyExpenseReport(report) && !!policy?.areReportFieldsEnabled) || isReportFieldTitle;

if (!reportField || !report || isDisabled) {
if (!reportFieldsEnabled || !reportField || !report || isDisabled) {
return (
<ScreenWrapper
includeSafeAreaPaddingBottom={false}
Expand All @@ -71,8 +73,6 @@ function EditReportFieldPage({route, policy, report}: EditReportFieldPageProps)
);
}

const isReportFieldTitle = ReportUtils.isReportFieldOfTypeTitle(reportField);

const handleReportFieldChange = (form: FormOnyxValues<typeof ONYXKEYS.FORMS.REPORT_FIELDS_EDIT_FORM>) => {
const value = form[fieldKey];
if (isReportFieldTitle) {
Expand Down
Loading