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
4 changes: 4 additions & 0 deletions src/languages/en.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2085,6 +2085,7 @@ export default {
letsDoubleCheck: "Let's double check that everything looks right.",
lineItemLevel: 'Line-item level',
reportLevel: 'Report level',
topLevel: 'Top level',
appliedOnExport: 'Not imported into Expensify, applied on export',
shareNote: {
header: 'Easily share your workspace with other members.',
Expand Down Expand Up @@ -3212,9 +3213,12 @@ export default {
return 'Marking NetSuite bills and invoices as paid';
case 'intacctCheckConnection':
return 'Checking Sage Intacct connection';
case 'intacctImportDimensions':
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This looks like it's missing a corresponding change in es.ts

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I checked es.ts and this key already existed

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I noticed it when connecting to Sage Intacct. It showed "Translation missing for stage: intacctImportDimensions", so decided to fix it before somebody else notices this bug.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice. Thanks for fixing that!

return 'Importing Sage Intacct dimensions';
case 'intacctImportTitle':
return 'Importing Sage Intacct data';
default: {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need this line now? 🤔

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

+1 @SzymczakJ do you have a reason for this one?

return `Translation missing for stage: ${stage}`;
}
}
Expand Down
1 change: 1 addition & 0 deletions src/languages/es.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2133,6 +2133,7 @@ export default {
reuseExistingConnection: 'Reutilizar la conexión existente',
existingConnections: 'Conexiones existentes',
lastSyncDate: (connectionName: string, formattedDate: string) => `${connectionName} - Última sincronización ${formattedDate}`,
topLevel: 'Nivel superior',
},
qbo: {
importDescription: 'Elige que configuraciónes de codificación son importadas desde QuickBooks Online a Expensify.',
Expand Down
5 changes: 4 additions & 1 deletion src/libs/PolicyUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -761,8 +761,11 @@ function getIntegrationLastSuccessfulDate(connection?: Connections[keyof Connect
return (connection as ConnectionWithLastSyncData)?.lastSync?.successfulDate;
}

function getCurrentSageIntacctEntityName(policy?: Policy): string | undefined {
function getCurrentSageIntacctEntityName(policy: Policy | undefined, defaultNameIfNoEntity: string): string | undefined {
const currentEntityID = policy?.connections?.intacct?.config?.entity;
if (!currentEntityID) {
return defaultNameIfNoEntity;
}
const entities = policy?.connections?.intacct?.data?.entities;
return entities?.find((entity) => entity.id === currentEntityID)?.name;
}
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 @@ -303,7 +303,7 @@ function PolicyAccountingPage({policy}: PolicyAccountingPageProps) {
: {
description: translate('workspace.intacct.entity'),
iconRight: Expensicons.ArrowRight,
title: getCurrentSageIntacctEntityName(policy),
title: getCurrentSageIntacctEntityName(policy, translate('workspace.common.topLevel')),
wrapperStyle: [styles.sectionMenuItemTopDescription],
titleStyle: styles.fontWeightNormal,
shouldShowRightIcon: true,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import RadioListItem from '@components/SelectionList/RadioListItem';
import type {ListItem} from '@components/SelectionList/types';
import SelectionScreen from '@components/SelectionScreen';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {clearSageIntacctErrorField, updateSageIntacctEntity} from '@libs/actions/connections/SageIntacct';
import * as ErrorUtils from '@libs/ErrorUtils';
Expand All @@ -15,22 +16,28 @@ function SageIntacctEntityPage({policy}: WithPolicyProps) {
const styles = useThemeStyles();
const config = policy?.connections?.intacct?.config;
const entityID = config?.entity ?? '';
const {translate} = useLocalize();

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

const sections =
policy?.connections?.intacct?.data?.entities.map((entity) => ({
const sections = [
{
text: translate('workspace.common.topLevel'),
value: translate('workspace.common.topLevel'),
keyForList: '',
isSelected: entityID === '',
},
];
policy?.connections?.intacct?.data?.entities.forEach((entity) => {
sections.push({
text: entity.name,
value: entity.name,
keyForList: entity.id,
isSelected: entity.id === entityID,
})) ?? [];
});
});

const saveSelection = ({keyForList}: ListItem) => {
if (!keyForList) {
return;
}

updateSageIntacctEntity(policyID, keyForList ?? '');
Navigation.goBack();
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function SageIntacctAdvancedPage({policy}: WithPolicyProps) {
<ConnectionLayout
displayName={SageIntacctAdvancedPage.displayName}
headerTitle="workspace.accounting.advanced"
headerSubtitle={getCurrentSageIntacctEntityName(policy)}
headerSubtitle={getCurrentSageIntacctEntityName(policy, translate('workspace.common.topLevel'))}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ function SageIntacctExportPage({policy}: WithPolicyProps) {
<ConnectionLayout
displayName={SageIntacctExportPage.displayName}
headerTitle="workspace.accounting.export"
headerSubtitle={getCurrentSageIntacctEntityName(policy)}
headerSubtitle={getCurrentSageIntacctEntityName(policy, translate('workspace.common.topLevel'))}
title="workspace.sageIntacct.exportDescription"
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={policyID}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ function SageIntacctImportPage({policy}: WithPolicyProps) {
<ConnectionLayout
displayName={SageIntacctImportPage.displayName}
headerTitle="workspace.accounting.import"
headerSubtitle={getCurrentSageIntacctEntityName(policy)}
headerSubtitle={getCurrentSageIntacctEntityName(policy, translate('workspace.common.topLevel'))}
accessVariants={[CONST.POLICY.ACCESS_VARIANTS.ADMIN, CONST.POLICY.ACCESS_VARIANTS.PAID]}
policyID={policyID}
featureName={CONST.POLICY.MORE_FEATURES.ARE_CONNECTIONS_ENABLED}
Expand Down