-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Remove outdated conditions #42883
Remove outdated conditions #42883
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,8 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne | |
const {translate} = useLocalize(); | ||
const styles = useThemeStyles(); | ||
const policyID = policy?.id ?? ''; | ||
const {syncLocations, reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, syncTax, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; | ||
const isLocationEnabled = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE); | ||
const isTaxesEnabled = Boolean(syncTax); | ||
const shouldShowTaxError = isTaxesEnabled && reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; | ||
const shouldShowLocationError = isLocationEnabled && reimbursableExpensesExportDestination !== CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same reasoning ^ |
||
const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination) || shouldShowTaxError || shouldShowLocationError; | ||
const {reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {}; | ||
const hasErrors = Boolean(errorFields?.reimbursableExpensesExportDestination); | ||
|
||
return ( | ||
<AccessOrNotFoundWrapper | ||
|
@@ -37,7 +33,7 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne | |
> | ||
<HeaderWithBackButton title={translate('workspace.qbo.exportExpenses')} /> | ||
<ScrollView contentContainerStyle={styles.pb2}> | ||
{!isLocationEnabled && <Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportOutOfPocketExpensesDescription')}</Text>} | ||
<Text style={[styles.ph5, styles.pb5]}>{translate('workspace.qbo.exportOutOfPocketExpensesDescription')}</Text> | ||
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesExportDestination}> | ||
<MenuItemWithTopDescription | ||
title={reimbursableExpensesExportDestination ? translate(`workspace.qbo.accounts.${reimbursableExpensesExportDestination}`) : undefined} | ||
|
@@ -47,24 +43,22 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne | |
brickRoadIndicator={hasErrors ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
shouldShowRightIcon | ||
hintText={ | ||
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL && !isLocationEnabled | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same ^ |
||
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.VENDOR_BILL | ||
? translate('workspace.qbo.exportVendorBillDescription') | ||
: undefined | ||
} | ||
/> | ||
</OfflineWithFeedback> | ||
{!isLocationEnabled && ( | ||
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}> | ||
<MenuItemWithTopDescription | ||
Comment on lines
-56
to
-58
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This render condition was used so we don't show the account row if the selected entity value is invalid/unsupported (e.g. vendor bill with location enabled). This is all outdated as the user won't fall into a case where the selected value is invalid. |
||
title={reimbursableExpensesAccount?.name} | ||
description={translate('workspace.qbo.accountsPayable')} | ||
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} | ||
brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
shouldShowRightIcon | ||
errorText={errorFields?.exportAccount ? translate('common.genericErrorMessage') : undefined} | ||
/> | ||
</OfflineWithFeedback> | ||
)} | ||
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}> | ||
<MenuItemWithTopDescription | ||
title={reimbursableExpensesAccount?.name} | ||
description={translate('workspace.qbo.accountsPayable')} | ||
onPress={() => Navigation.navigate(ROUTES.POLICY_ACCOUNTING_QUICKBOOKS_ONLINE_EXPORT_OUT_OF_POCKET_EXPENSES_ACCOUNT_SELECT.getRoute(policyID))} | ||
brickRoadIndicator={errorFields?.exportAccount ? CONST.BRICK_ROAD_INDICATOR_STATUS.ERROR : undefined} | ||
shouldShowRightIcon | ||
errorText={errorFields?.exportAccount ? translate('common.genericErrorMessage') : undefined} | ||
/> | ||
</OfflineWithFeedback> | ||
</ScrollView> | ||
</ScreenWrapper> | ||
</AccessOrNotFoundWrapper> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will never be true.