diff --git a/src/pages/workspace/accounting/intacct/export/DynamicSageIntacctDefaultVendorPage.tsx b/src/pages/workspace/accounting/intacct/export/DynamicSageIntacctDefaultVendorPage.tsx index d56e2523a3ab..577ac9222985 100644 --- a/src/pages/workspace/accounting/intacct/export/DynamicSageIntacctDefaultVendorPage.tsx +++ b/src/pages/workspace/accounting/intacct/export/DynamicSageIntacctDefaultVendorPage.tsx @@ -30,6 +30,9 @@ import {useRoute} from '@react-navigation/native'; import React, {useCallback, useMemo} from 'react'; import {View} from 'react-native'; +// Sage Intacct's default-vendor fields hold a raw vendor ID; sending this empty string clears the default. +const CLEAR_DEFAULT_VENDOR = ''; + function DynamicSageIntacctDefaultVendorPage() { const styles = useThemeStyles(); const {translate} = useLocalize(); @@ -75,14 +78,21 @@ function DynamicSageIntacctDefaultVendorPage() { [translate, styles.pb2, styles.ph5, styles.pb5, styles.textNormal, isReimbursable], ); + // Blank vendor only has a defined meaning for the non-reimbursable credit-card-charge path. The bill and reimbursable paths handle blank differently and re-tapping to clear them is out of scope here. + const canClearByReSelecting = settingName === CONST.SAGE_INTACCT_CONFIG.NON_REIMBURSABLE_CREDIT_CARD_VENDOR; + const updateDefaultVendor = useCallback( ({value}: SelectorType) => { - if (value !== defaultVendor) { + if (value === defaultVendor) { + if (canClearByReSelecting) { + updateSageIntacctDefaultVendor(policyID, settingName, CLEAR_DEFAULT_VENDOR, defaultVendor); + } + } else { updateSageIntacctDefaultVendor(policyID, settingName, value, defaultVendor); } goBack(); }, - [defaultVendor, policyID, settingName, goBack], + [defaultVendor, policyID, settingName, goBack, canClearByReSelecting], ); const listEmptyContent = useMemo( diff --git a/src/pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableVendorSelectPage.tsx b/src/pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableVendorSelectPage.tsx index f8cd812f8c64..fe3f564fa5a1 100644 --- a/src/pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableVendorSelectPage.tsx +++ b/src/pages/workspace/accounting/qbo/export/QuickbooksNonReimbursableVendorSelectPage.tsx @@ -58,8 +58,15 @@ function QuickbooksNonReimbursableVendorSelectPage({policy, configKey, updateVen isSelected: vendor.id === currentVendor, })) ?? []; + // Blank vendor only has a defined meaning for the CC/DC export path (falls back to "Credit Card Misc"). For Vendor Bill export, blank falls back to the report submitter — but the user can already leave that setting disabled from the parent page, so re-tapping to clear is out of scope here. + const canClearByReSelecting = configKey === CONST.QUICKBOOKS_CONFIG.NON_REIMBURSABLE_CREDIT_CARD_DEFAULT_VENDOR; + const selectVendor = (row: CardListItem) => { - if (row.value !== currentVendor) { + if (row.value === currentVendor) { + if (canClearByReSelecting) { + updateVendor(policyID, CONST.INTEGRATION_ENTITY_MAP_TYPES.NONE, currentVendor); + } + } else { updateVendor(policyID, row.value, currentVendor); } Navigation.goBack();