-
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
fix: Show the connected QBO file #56022
base: main
Are you sure you want to change the base?
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 |
---|---|---|
|
@@ -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, | ||
|
@@ -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'; | ||
|
@@ -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
|
||
const theme = useTheme(); | ||
const styles = useThemeStyles(); | ||
const {translate, datetimeToRelative: getDatetimeToRelative} = useLocalize(); | ||
|
@@ -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
|
||
// 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); | ||
|
@@ -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
|
||
}, | ||
pendingAction: settingsPendingAction([CONST.XERO_CONFIG.TENANT_ID], policy?.connections?.xero?.config?.pendingFields), | ||
brickRoadIndicator: areSettingsInErrorFields([CONST.XERO_CONFIG.TENANT_ID], policy?.connections?.xero?.config?.errorFields) | ||
|
@@ -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; | ||
} | ||
|
@@ -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')} | ||
|
@@ -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')} | ||
|
@@ -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> | ||
</View> | ||
)} | ||
|
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.
is it Confirmed?