Skip to content
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

Prevent invalid configuration between location and JE selection #41638

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
faa4eb7
fix: lock the toggle for disabling location when the account selected…
May 4, 2024
43d57ac
fix the boolean condition
May 5, 2024
102c2bf
chore: filter out account options depending on whether the location t…
May 5, 2024
056c362
chore: lock the toggle button when the location import should be off
May 6, 2024
e74a7ae
chore: add a todo comment not to forget to change the description text
May 6, 2024
d3be0c3
Merge branch 'main' into hayata-do-not-allow-invalid-location-account…
May 10, 2024
add3daf
fix: wrong conditional statement
May 11, 2024
c771c51
change const name and don't force in-active state
May 11, 2024
21aef13
fix: use existing value to determine if the location is enabled or not
May 14, 2024
01d10e5
fix: don't use conditional rendering
May 14, 2024
286980f
fix: the ordering of items
May 14, 2024
a9f76f4
fix: the ordering of items
May 14, 2024
b9cf433
don't disable the switch for the location import if the location is a…
May 14, 2024
3c1b841
chore: remove todo comments
May 14, 2024
bcecada
update the UI copy
May 15, 2024
30cfcac
Merge branch 'main' into hayata-do-not-allow-invalid-location-account…
May 15, 2024
dd891b7
style: get config value from the destructuring statement
May 15, 2024
4774590
Merge branch 'main' into hayata-do-not-allow-invalid-location-account…
May 15, 2024
9b08271
fix: update the spanish translation
May 20, 2024
6ba9dc4
fix: use `isSwitchOn` to decide if the admin should be allowed to tog…
May 23, 2024
14943e7
fix: move the hint text to the entity select page
May 23, 2024
ac3e90b
fix: issue with the footer component
May 24, 2024
023c313
chore: remove unnecessary hint text
May 24, 2024
cdb176a
chore: fix the style of hint texts when there is no account to display
May 27, 2024
0688088
chore: don't display the hint text when there is misconfiguration
May 27, 2024
f5e4c04
fix: delete unnecessary UI text
May 28, 2024
a0845eb
fix: add back the footer
May 29, 2024
805b67e
chore: revert the commit for changing the hint display behavior in lo…
May 29, 2024
a313d7a
chore: change the hint text behavior on the taxes page
May 29, 2024
427ca57
fix: the display text
May 29, 2024
5925a85
chore: update the text
May 29, 2024
948b665
fix: check if the company card export destination is vendor bill & cr…
May 29, 2024
911d494
chore: add the word "checks"
May 29, 2024
a421cdd
remove outdated conditions
s77rt May 30, 2024
15452e6
Merge pull request #42883 from s77rt/s77rt-do-not-allow-invalid-locat…
May 31, 2024
7cd358e
fix: add back the check to see if the error should be shown
May 31, 2024
f769502
Merge branch 'qbo-freeze-branch' into hayata-do-not-allow-invalid-loc…
May 31, 2024
5d5d2cd
remove mistype
May 31, 2024
5ffc623
chore: replace with accountDescription
May 31, 2024
52a8ac0
remove isLocationEnabled check
May 31, 2024
362167d
Fix footer styles
s77rt May 31, 2024
c97ffd3
Update src/pages/workspace/accounting/qbo/export/QuickbooksOutOfPocke…
s77rt May 31, 2024
da6232d
Merge branch 'qbo-freeze-branch' into hayata-do-not-allow-invalid-loc…
lakchote May 31, 2024
715f3da
fix prettier
lakchote May 31, 2024
f8a9176
Merge pull request #42921 from s77rt/s77rt-do-not-allow-invalid-locat…
lakchote May 31, 2024
a3729d4
chore: update outdated spanish copy
May 31, 2024
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
9 changes: 4 additions & 5 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1938,10 +1938,11 @@ export default {
customersDescription: 'Choose whether to import customers/projects and see where customers/projects are displayed.',
locationsDescription: 'Choose whether to import locations, and see where locations are displayed.',
taxesDescription: 'Choose whether to import tax rates and tax defaults from your accounting integration.',
locationsAdditionalDescription: `QuickBooks Online does not support adding a location to vendor bills or checks. Update your export preference to journal entry if you'd like to import locations as tags.`,
outOfPocketLocationEnabledDescription:
'Note: QuickBooks Online does not support a field for locations on vendor bill or check exports. As you have locations enabled on your workspace, this export option is unavailable.',
taxesJournalEntrySwitchNote:
'Note: QuickBooks Online does not support a field for tax on Journal Entry exports. Change your export preference to Vendor Bill or Check to import taxes.',
locationsAdditionalDescription:
'Locations are imported as Tags. This limits exporting expense reports as Vendor Bills or Checks to QuickBooks Online. To unlock these export options, either disable Locations import or upgrade to the Control Plan to export Locations encoded as a Report Field.',
export: 'Export',
exportAs: 'Export as',
exportDescription: 'Configure how data in Expensify gets exported to QuickBooks Online.',
Expand Down Expand Up @@ -1993,13 +1994,11 @@ export default {
bankAccountDescription: 'This is your chosen bank account to write checks from.',
optionBelow: 'Choose an option below:',
companyCardsLocationEnabledDescription:
'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations from, this this export option is unavailable.',
'Note: QuickBooks Online does not support a field for locations on vendor bill exports. As you have locations enabled on your workspace, this export option is unavailable.',
outOfPocketTaxEnabledDescription:
"Note: QuickBooks Online doesn't support a field for tax on Journal Entry exports. Because you have tax tracking enabled on your workspace, this export option is unavailable.",
outOfPocketTaxEnabledError: 'Journal entry is not available when taxes enabled. please select a different export option.',
outOfPocketLocationEnabledError: 'Vendor Bills are not available when locations are enabled. Please select a different export option.',
outOfPocketLocationEnabledDescription:
'Note: QuickBooks Online does not support a field for Locations as Tags on Vendor Bills exports. As you import Locations as Tags, this export option is unavailable.',
advancedConfig: {
advanced: 'Advanced',
autoSync: 'Auto-sync',
Expand Down
4 changes: 2 additions & 2 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1965,7 +1965,7 @@ export default {
taxesJournalEntrySwitchNote:
'Nota: QuickBooks Online no admite un campo para impuestos al exportar entradas en el libro diario. Cambia tu preferencia de exportación a Factura de Proveedor o Cheque para importar impuestos.',
locationsAdditionalDescription:
'Los lugares son importados como Etiquegas. Esto limita a exportar los informes de gastos como Factura del Proveedor o Cheques a Quicbooks Online. Para desbloquear estas opciones de exportación desactiva la importación de Lugares o cambia al Plan Control para exportar Lugares como Campos de Informes.',
'QuickBooks Online no permite añadir una ubicación a las facturas de proveedores o a los cheques. Actualice su preferencia de exportación a asiento contable si desea importar ubicaciones como etiquetas.',
export: 'Exportar',
exportAs: 'Exportar cómo',
exportExpenses: 'Exportar gastos de bolsillo como',
Expand Down Expand Up @@ -2025,7 +2025,7 @@ export default {
outOfPocketTaxEnabledError: 'La Anotacion en el diario no está disponible cuando los impuestos están activados. Por favor, selecciona una opción de exportación diferente.',
outOfPocketLocationEnabledError: 'Las facturas de proveedores no están disponibles cuando las ubicaciones están activadas. Seleccione otra opción de exportación.',
outOfPocketLocationEnabledDescription:
'Nota: QuickBooks Online no admite un campo para Ubicaciones como Etiquetas en las exportaciones de Facturas de Proveedor. Al importar Ubicaciones como Etiquetas, esta opción de exportación no está disponible.',
'Nota: QuickBooks Online no permite añadir una ubicación a las facturas de proveedores o a los cheques. Al importar ubicaciones como etiquetas, esta opción de exportación no está disponible.',

advancedConfig: {
advanced: 'Avanzado',
Expand Down
2 changes: 1 addition & 1 deletion src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ function PolicyAccountingPage({policy, connectionSyncProgress}: PolicyAccounting
title: integrationData?.title,
errorText: shouldShowSynchronizationError ? translate('workspace.accounting.syncError', connectedIntegration) : undefined,
errorTextStyle: [styles.mt5],
shouldShowRedDotIndicator: true,
shouldShowRedDotIndicator: true,
description: isSyncInProgress ? translate('workspace.accounting.connections.syncStageName', connectionSyncProgress.stageInProgress) : datetimeToRelative,
rightComponent: isSyncInProgress ? (
<ActivityIndicator
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ 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 {syncLocations, syncTax, reimbursableExpensesAccount, reimbursableExpensesExportDestination, errorFields, 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;
Expand Down Expand Up @@ -59,7 +59,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}
Expand All @@ -71,19 +71,16 @@ function QuickbooksOutOfPocketExpenseConfigurationPage({policy}: WithPolicyConne
hintText={exportHintText}
/>
</OfflineWithFeedback>
{isLocationEnabled && <Text style={[styles.ph5, styles.mutedNormalTextLabel, styles.pt1]}>{translate('workspace.qbo.outOfPocketLocationEnabledDescription')}</Text>}
{!isLocationEnabled && (
<OfflineWithFeedback pendingAction={pendingFields?.reimbursableExpensesAccount}>
<MenuItemWithTopDescription
title={reimbursableExpensesAccount?.name}
description={accountDescription}
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={accountDescription}
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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,22 @@ import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import type {Account, QBOReimbursableExportAccountType} from '@src/types/onyx/Policy';

function Footer({isTaxEnabled, isLocationsEnabled}: {isTaxEnabled: boolean; isLocationsEnabled: boolean}) {
const styles = useThemeStyles();
const {translate} = useLocalize();

if (!isTaxEnabled && !isLocationsEnabled) {
return null;
}

return (
<View style={[styles.gap2, styles.mt2]}>
{isTaxEnabled && <Text style={styles.mutedNormalTextLabel}>{translate('workspace.qbo.outOfPocketTaxEnabledDescription')}</Text>}
{isLocationsEnabled && <Text style={styles.mutedNormalTextLabel}>{translate('workspace.qbo.outOfPocketLocationEnabledDescription')}</Text>}
</View>
);
}
Comment on lines +21 to +35
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB. We could have just used useMemo for the footer


type CardListItem = ListItem & {
value: QBOReimbursableExportAccountType;
isShown: boolean;
Expand Down Expand Up @@ -107,7 +123,12 @@ function QuickbooksOutOfPocketExpenseEntitySelectPage({policy}: WithPolicyConnec
onSelectRow={selectExportEntity}
shouldDebounceRowSelect
initiallyFocusedOptionKey={data.find((mode) => mode.isSelected)?.keyForList}
footerContent={isTaxesEnabled && <Text style={[styles.mutedNormalTextLabel, styles.pt2]}>{translate('workspace.qbo.outOfPocketTaxEnabledDescription')}</Text>}
footerContent={
<Footer
isTaxEnabled={isTaxesEnabled}
isLocationsEnabled={isLocationsEnabled}
/>
}
/>
</View>
</ScreenWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) {
const {translate} = useLocalize();
const styles = useThemeStyles();
const policyID = policy?.id ?? '';
const {syncLocations, pendingFields} = policy?.connections?.quickbooksOnline?.config ?? {};
const {syncLocations, pendingFields, reimbursableExpensesExportDestination, nonReimbursableExpensesExportDestination} = policy?.connections?.quickbooksOnline?.config ?? {};
const isSwitchOn = Boolean(syncLocations && syncLocations !== CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE);
const canImportLocation =
reimbursableExpensesExportDestination === CONST.QUICKBOOKS_REIMBURSABLE_ACCOUNT_TYPE.JOURNAL_ENTRY &&
nonReimbursableExpensesExportDestination !== CONST.QUICKBOOKS_NON_REIMBURSABLE_EXPORT_ACCOUNT_TYPE.VENDOR_BILL;
Comment on lines +25 to +27
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NAB. The locationsAdditionalDescription copy does not tell you that you need to change the export company cards option

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree that's NAB. We can improve it later to something like:

QuickBooks Online does not support adding a location to vendor bills or checks. Update your export preferences to journal entry and credit/debit card if you'd like to import locations as tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is the current copy, right?
Screenshot 2024-05-31 at 11 26 25 AM

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

^^ that's the old copy.

aldo-expensify marked this conversation as resolved.
Show resolved Hide resolved
const shouldBeDisabled = !canImportLocation && !isSwitchOn;
const isReportFieldsSelected = syncLocations === CONST.INTEGRATION_ENTITY_MAP_TYPES.REPORT_FIELD;

return (
Expand Down Expand Up @@ -55,6 +59,7 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) {
isSwitchOn ? CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE : CONST.INTEGRATION_ENTITY_MAP_TYPES.TAG,
)
}
disabled={shouldBeDisabled}
/>
</View>
</OfflineWithFeedback>
Expand All @@ -69,9 +74,11 @@ function QuickbooksLocationsPage({policy}: WithPolicyProps) {
/>
</OfflineWithFeedback>
)}
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.gap2, styles.mt1]}>
<Text style={styles.mutedTextLabel}>{translate('workspace.qbo.locationsAdditionalDescription')}</Text>
</View>
{shouldBeDisabled && (
hayata-suenaga marked this conversation as resolved.
Show resolved Hide resolved
<View style={[styles.flex1, styles.flexRow, styles.alignItemsCenter, styles.gap2, styles.mt1]}>
<Text style={styles.mutedTextLabel}>{translate('workspace.qbo.locationsAdditionalDescription')}</Text>
</View>
)}
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function QuickbooksTaxesPage({policy}: WithPolicyProps) {
</View>
</OfflineWithFeedback>
</View>
{isJournalExportEntity && <Text style={[styles.mutedNormalTextLabel, styles.pt2]}>{translate('workspace.qbo.taxesJournalEntrySwitchNote')}</Text>}
{!syncTax && isJournalExportEntity && <Text style={[styles.mutedNormalTextLabel, styles.pt2]}>{translate('workspace.qbo.taxesJournalEntrySwitchNote')}</Text>}
</ScrollView>
</ScreenWrapper>
</AccessOrNotFoundWrapper>
Expand Down
Loading