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

fix: Show the connected QBO file #56022

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2826,6 +2826,7 @@ const translations = {
itemsDescription: 'Choose how to handle QuickBooks Desktop items in Expensify.',
},
qbo: {
connectedTo: 'Connected to',
importDescription: 'Choose which coding configurations to import from QuickBooks Online to Expensify.',
classes: 'Classes',
locations: 'Locations',
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2852,6 +2852,7 @@ const translations = {
itemsDescription: 'Elige cómo gestionar los elementos de QuickBooks Desktop en Expensify.',
},
qbo: {
connectedTo: 'Conectado a',
Copy link
Member

Choose a reason for hiding this comment

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

is it Confirmed?

importDescription: 'Elige que configuraciónes de codificación son importadas desde QuickBooks Online a Expensify.',
classes: 'Clases',
locations: 'Lugares',
Expand Down
25 changes: 19 additions & 6 deletions src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import {isAuthenticationError, isConnectionInProgress, isConnectionUnverified, removePolicyConnection, syncConnection} from '@libs/actions/connections';
import {getAssignedSupportData} from '@libs/actions/Policy/Policy';
import {getConciergeReportID} from '@libs/actions/Report';
import * as PolicyUtils from '@libs/PolicyUtils';
import {
areSettingsInErrorFields,
findCurrentXeroOrganization,
Expand All @@ -40,14 +39,16 @@
getCurrentXeroOrganizationName,
getIntegrationLastSuccessfulDate,
getXeroTenants,
hasUnsupportedIntegration,
isControlPolicy,
settingsPendingAction,
shouldShowSyncError,
} from '@libs/PolicyUtils';
import Navigation from '@navigation/Navigation';
import AccessOrNotFoundWrapper from '@pages/workspace/AccessOrNotFoundWrapper';
import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import type {AnchorPosition} from '@styles/index';
import * as Link from '@userActions/Link';
import {openOldDotLink} from '@userActions/Link';
import CONST from '@src/CONST';
import ONYXKEYS from '@src/ONYXKEYS';
import ROUTES from '@src/ROUTES';
Expand All @@ -65,7 +66,7 @@

function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
const [connectionSyncProgress] = useOnyx(`${ONYXKEYS.COLLECTION.POLICY_CONNECTION_SYNC_PROGRESS}${policy?.id}`);
const [cardSettings] = useOnyx(`${ONYXKEYS.COLLECTION.PRIVATE_EXPENSIFY_CARD_SETTINGS}${policy?.workspaceAccountID ?? -1}`);

Check failure on line 69 in src/pages/workspace/accounting/PolicyAccountingPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

const theme = useTheme();
const styles = useThemeStyles();
const {translate, datetimeToRelative: getDatetimeToRelative} = useLocalize();
Expand Down Expand Up @@ -95,15 +96,15 @@

const shouldShowEnterCredentials = connectedIntegration && !!synchronizationError && isAuthenticationError(policy, connectedIntegration);

const policyID = policy?.id ?? '-1';

Check failure on line 99 in src/pages/workspace/accounting/PolicyAccountingPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

// Get the last successful date of the integration. Then, if `connectionSyncProgress` is the same integration displayed and the state is 'jobDone', get the more recent update time of the two.
const successfulDate = getIntegrationLastSuccessfulDate(
connectedIntegration ? policy?.connections?.[connectedIntegration] : undefined,
connectedIntegration === connectionSyncProgress?.connectionName ? connectionSyncProgress : undefined,
);

const hasSyncError = PolicyUtils.shouldShowSyncError(policy, isSyncInProgress);
const hasUnsupportedNDIntegration = !isEmptyObject(policy?.connections) && PolicyUtils.hasUnsupportedIntegration(policy, accountingIntegrations);
const hasSyncError = shouldShowSyncError(policy, isSyncInProgress);
const hasUnsupportedNDIntegration = !isEmptyObject(policy?.connections) && hasUnsupportedIntegration(policy, accountingIntegrations);

const tenants = useMemo(() => getXeroTenants(policy), [policy]);
const currentXeroOrganization = findCurrentXeroOrganization(tenants, policy?.connections?.xero?.config?.tenantID);
Expand Down Expand Up @@ -202,7 +203,7 @@
if (!(tenants.length > 1)) {
return;
}
Navigation.navigate(ROUTES.POLICY_ACCOUNTING_XERO_ORGANIZATION.getRoute(policyID, currentXeroOrganization?.id ?? '-1'));

Check failure on line 206 in src/pages/workspace/accounting/PolicyAccountingPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

},
pendingAction: settingsPendingAction([CONST.XERO_CONFIG.TENANT_ID], policy?.connections?.xero?.config?.pendingFields),
brickRoadIndicator: areSettingsInErrorFields([CONST.XERO_CONFIG.TENANT_ID], policy?.connections?.xero?.config?.errorFields)
Expand Down Expand Up @@ -249,6 +250,18 @@
Navigation.navigate(ROUTES.POLICY_ACCOUNTING_SAGE_INTACCT_ENTITY.getRoute(policyID));
},
};
case CONST.POLICY.CONNECTIONS.NAME.QBO:
return !policy?.connections?.quickbooksOnline?.config?.companyName
? {}
: {
description: translate('workspace.qbo.connectedTo'),
title: policy?.connections?.quickbooksOnline?.config?.companyName,
wrapperStyle: [styles.sectionMenuItemTopDescription],
titleStyle: styles.fontWeightNormal,
shouldShowDescriptionOnTop: true,
interactive: false,
};

default:
return undefined;
}
Expand Down Expand Up @@ -537,7 +550,7 @@
<TextLink
onPress={() => {
// Go to Expensify Classic.
Link.openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
}}
>
{translate('workspace.accounting.goToODToFix')}
Expand All @@ -551,7 +564,7 @@
<TextLink
onPress={() => {
// Go to Expensify Classic.
Link.openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
openOldDotLink(CONST.OLDDOT_URLS.POLICY_CONNECTIONS_URL(policyID));
}}
>
{translate('workspace.accounting.goToODToSettings')}
Expand Down Expand Up @@ -583,7 +596,7 @@
/>
<View style={[!isLargeScreenWidth ? styles.flexColumn : styles.flexRow]}>
<Text style={styles.textSupporting}>{translate('workspace.accounting.needAnotherAccounting')}</Text>
<TextLink onPress={() => Navigation.navigate(ROUTES.REPORT_WITH_ID.getRoute(chatReportID ?? ''))}>{chatTextLink}</TextLink>

Check failure on line 599 in src/pages/workspace/accounting/PolicyAccountingPage.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

</View>
</View>
)}
Expand Down
Loading