Skip to content
Merged
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
3 changes: 2 additions & 1 deletion src/pages/workspace/accounting/PolicyAccountingPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ import ROUTES from '@src/ROUTES';
import type {ConnectionName} from '@src/types/onyx/Policy';
import {isEmptyObject} from '@src/types/utils/EmptyObject';
import {AccountingContextProvider, useAccountingActions, useAccountingState} from './AccountingContext';
import {isCertiniaSRPConnection} from './certinia/utils';
import type {MenuItemData, PolicyAccountingPageProps} from './types';
import {getAccountingIntegrationData, getSynchronizationErrorMessage} from './utils';

Expand Down Expand Up @@ -322,7 +323,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
interactive: false,
};
case CONST.POLICY.CONNECTIONS.NAME.CERTINIA:
return !certiniaConfig?.hasPSA || certiniaConfig?.hasPSAOnly !== false
return !isCertiniaSRPConnection(certiniaConfig)
? {}
: {
description: translate('workspace.certinia.company'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import withPolicyConnections from '@pages/workspace/withPolicyConnections';
import variables from '@styles/variables';
import CONST from '@src/CONST';
import ROUTES from '@src/ROUTES';
import {isCertiniaSRPConnection} from './utils';

type CompanyListItem = ListItem & {
value: string;
Expand All @@ -27,7 +28,6 @@ function CertiniaCompanySelectorPage({policy}: WithPolicyConnectionsProps) {
const companyID = config?.credentials?.companyID;
const companies = data?.companies ?? [];
const illustrations = useMemoizedLazyIllustrations(['Telescope']);
const shouldShowCompanySelector = !!config?.hasPSA && config?.hasPSAOnly === false;

const dataOptions: CompanyListItem[] = companies.map((company) => ({
value: company.id,
Expand Down Expand Up @@ -59,7 +59,7 @@ function CertiniaCompanySelectorPage({policy}: WithPolicyConnectionsProps) {
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
displayName="CertiniaCompanySelectorPage"
shouldBeBlocked={!shouldShowCompanySelector}
shouldBeBlocked={!isCertiniaSRPConnection(config)}
data={dataOptions}
onSelectRow={selectCompany}
shouldSingleExecuteRowSelect
Expand Down
7 changes: 6 additions & 1 deletion src/pages/workspace/accounting/certinia/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
} from '@libs/actions/connections/FinancialForce';
import CONST from '@src/CONST';
import type {TranslationPaths} from '@src/languages/types';
import type {FinancialForceFFAExportStatus} from '@src/types/onyx/Policy';
import type {FinancialForceConnectionConfig, FinancialForceFFAExportStatus} from '@src/types/onyx/Policy';

const CERTINIA_DIMENSION_PARAMS = [
CONST.CERTINIA_CONFIG.CODING_DIMENSION1,
Expand Down Expand Up @@ -109,6 +109,10 @@ function isCertiniaDimensionParam(dimension: string): dimension is CertiniaDimen
return (CERTINIA_DIMENSION_PARAMS as readonly string[]).includes(dimension);
}

function isCertiniaSRPConnection(config: FinancialForceConnectionConfig | undefined): boolean {
return !!config?.hasPSA && config?.hasPSAOnly === false;
}

export {
CERTINIA_DIMENSION_PARAMS,
CERTINIA_FFA_EXPORT_STATUSES,
Expand All @@ -117,6 +121,7 @@ export {
getCertiniaFFAExportStatusValue,
getDimensionLabel,
getDisplayTypeLabel,
isCertiniaSRPConnection,
isCertiniaDimensionParam,
updateFinancialForceDimensionMapping,
};
Expand Down
Loading