Skip to content

Commit 15452e6

Browse files
author
Hayata Suenaga
authored
Merge pull request #42883 from s77rt/s77rt-do-not-allow-invalid-location-account-combo
Remove outdated conditions
2 parents 911d494 + a421cdd commit 15452e6

File tree

1 file changed

+14
-20
lines changed

1 file changed

+14
-20
lines changed

src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocketExpenseConfigurationPage.tsx

+14-20
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,8 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
1818
const {translate} = useLocalize();
1919
const styles = useThemeStyles();
2020
const policyID = policy?.id ?? '';
21-
const {syncLocations, reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, syncTax, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};
22-
const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
23-
const isTaxesEnabled = Boolean(syncTax);
24-
const shouldShowTaxError = isTaxesEnabled && reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY;
25-
const shouldShowLocationError = isLocationEnabled && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY;
26-
const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination) || shouldShowTaxError || shouldShowLocationError;
21+
const {reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};
22+
const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination);
2723

2824
return (
2925
<AccessOrNotFoundWrapper
@@ -37,7 +33,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
3733
>
3834
<HeaderWithBackButton title={translate('workspace.qbo.exportExpenses')} />
3935
<ScrollView contentContainerStyle={styles.pb2}>
40-
{!isLocationEnabled && <Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportOutOfPocketExpensesDescription')}</Text>}
36+
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportOutOfPocketExpensesDescription')}</Text>
4137
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesExportDestination}>
4238
<MenuItemWithTopDescription
4339
title={reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${reimbursableExpensesExportDestination}`) : undefined}
@@ -47,24 +43,22 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
4743
brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
4844
shouldShowRightIcon
4945
hintText={
50-
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL && !isLocationEnabled
46+
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL
5147
? translate('workspace.qbo.exportVendorBillDescription')
5248
: undefined
5349
}
5450
/>
5551
</OfflineWithFeedback>
56-
{!isLocationEnabled && (
57-
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}>
58-
<MenuItemWithTopDescription
59-
title={reimbursableExpensesAccount?.name}
60-
description={translate('workspace.qbo.accountsPayable')}
61-
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))}
62-
brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
63-
shouldShowRightIcon
64-
errorText={errorFields?.exportAccount ? translate('common.genericErrorMessage') : undefined}
65-
/>
66-
</OfflineWithFeedback>
67-
)}
52+
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}>
53+
<MenuItemWithTopDescription
54+
title={reimbursableExpensesAccount?.name}
55+
description={translate('workspace.qbo.accountsPayable')}
56+
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))}
57+
brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined}
58+
shouldShowRightIcon
59+
errorText={errorFields?.exportAccount ? translate('common.genericErrorMessage') : undefined}
60+
/>
61+
</OfflineWithFeedback>
6862
</ScrollView>
6963
</ScreenWrapper>
7064
</AccessOrNotFoundWrapper>

0 commit comments

Comments
 (0)