diff --git a/src/CONST/index.ts b/src/CONST/index.ts index 7c7b810bf5a27..c278d09e77c39 100755 --- a/src/CONST/index.ts +++ b/src/CONST/index.ts @@ -3274,6 +3274,7 @@ const CONST = { XERO: 'xero', NETSUITE: 'netsuite', SAGE_INTACCT: 'intacct', + CERTINIA: 'certinia', }, SUPPORTED_ONLY_ON_OLDDOT: { FINANCIALFORCE: 'financialForce', @@ -3287,6 +3288,7 @@ const CONST = { NETSUITE: 'netsuite', SAGE_INTACCT: 'sage-intacct', QBD: 'quickbooks-desktop', + CERTINIA: 'certinia', }, NAME_USER_FRIENDLY: { netsuite: 'NetSuite', @@ -3295,6 +3297,7 @@ const CONST = { xero: 'Xero', intacct: 'Sage Intacct', financialForce: 'FinancialForce', + certinia: 'Certinia', billCom: 'Bill.com', zenefits: 'Zenefits', sap: 'SAP', @@ -7225,6 +7228,7 @@ const CONST = { ATTENDEE: 'attendee', IS: 'is', REPORT_FIELD: 'reportField', + EXPORTED_TO: 'exportedTo', }, REPORT_FIELD: { // All report fields start with this, so use this to check if a search key is a report field @@ -7291,6 +7295,7 @@ const CONST = { ATTENDEE: 'attendee', IS: 'is', REPORT_FIELD: 'report-field', + EXPORTED_TO: 'exported-to', COLUMNS: 'columns', LIMIT: 'limit', }, @@ -7404,6 +7409,7 @@ const CONST = { }, TODO_BADGE_MAX_COUNT: 50, TOP_SEARCH_LIMIT: 10, + PREDEFINED_INTEGRATION_FILTER_VALUES: ['xero', 'qbo', 'qbd', 'netsuite', 'intacct', 'certinia'], }, SEARCH_SELECTOR: { SELECTION_MODE_SINGLE: 'single', diff --git a/src/SCREENS.ts b/src/SCREENS.ts index 1871a47bc9c17..b76da7dd9a48d 100644 --- a/src/SCREENS.ts +++ b/src/SCREENS.ts @@ -60,6 +60,7 @@ const SCREENS = { ADVANCED_FILTERS_APPROVED_RHP: 'Search_Advanced_Filters_Approved_RHP', ADVANCED_FILTERS_PAID_RHP: 'Search_Advanced_Filters_Paid_RHP', ADVANCED_FILTERS_EXPORTED_RHP: 'Search_Advanced_Filters_Exported_RHP', + ADVANCED_FILTERS_EXPORTED_TO_RHP: 'Search_Advanced_Filters_Exported_To_RHP', ADVANCED_FILTERS_POSTED_RHP: 'Search_Advanced_Filters_Posted_RHP', ADVANCED_FILTERS_WITHDRAWN_RHP: 'Search_Advanced_Filters_Withdrawn_RHP', ADVANCED_FILTERS_CURRENCY_RHP: 'Search_Advanced_Filters_Currency_RHP', diff --git a/src/components/ImportedFromAccountingSoftware.tsx b/src/components/ImportedFromAccountingSoftware.tsx index b82186f0129ba..6a95106f23128 100644 --- a/src/components/ImportedFromAccountingSoftware.tsx +++ b/src/components/ImportedFromAccountingSoftware.tsx @@ -34,7 +34,7 @@ function ImportedFromAccountingSoftware({policyID, currentConnectionName, transl const StyleUtils = useStyleUtils(); const {translate} = useLocalize(); const {environmentURL} = useEnvironment(); - const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare']); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare', 'CertiniaSquare']); const icon = getIntegrationIcon(connectedIntegration, expensifyIcons); return ( diff --git a/src/components/MoneyReportHeader.tsx b/src/components/MoneyReportHeader.tsx index e0f7270c6dfbd..b5a95123774d2 100644 --- a/src/components/MoneyReportHeader.tsx +++ b/src/components/MoneyReportHeader.tsx @@ -249,6 +249,7 @@ function MoneyReportHeader({ 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare', + 'CertiniaSquare', 'Feed', 'Close', 'Location', diff --git a/src/components/ReportActionItem/ExportWithDropdownMenu.tsx b/src/components/ReportActionItem/ExportWithDropdownMenu.tsx index 0ddf931bb40b2..7433d6d3d9139 100644 --- a/src/components/ReportActionItem/ExportWithDropdownMenu.tsx +++ b/src/components/ReportActionItem/ExportWithDropdownMenu.tsx @@ -53,7 +53,7 @@ function ExportWithDropdownMenu({ const {shouldUseNarrowLayout} = useResponsiveLayout(); const [modalStatus, setModalStatus] = useState(null); const [exportMethods] = useOnyx(ONYXKEYS.LAST_EXPORT_METHOD, {canBeMissing: true}); - const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare']); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare', 'CertiniaSquare']); const iconToDisplay = getIntegrationIcon(connectionName, expensifyIcons); const canBeExported = canBeExportedUtils(report); diff --git a/src/components/Search/SearchAutocompleteList.tsx b/src/components/Search/SearchAutocompleteList.tsx index e839504b4989a..9556764c51e58 100644 --- a/src/components/Search/SearchAutocompleteList.tsx +++ b/src/components/Search/SearchAutocompleteList.tsx @@ -17,6 +17,7 @@ import useLocalize from '@hooks/useLocalize'; import useOnyx from '@hooks/useOnyx'; import useResponsiveLayout from '@hooks/useResponsiveLayout'; import useThemeStyles from '@hooks/useThemeStyles'; +import {getExportTemplates} from '@libs/actions/Search'; import {getCardFeedsForDisplay} from '@libs/CardFeedUtils'; import {getCardDescription, isCard, isCardHiddenFromSearch} from '@libs/CardUtils'; import {getDecodedCategoryName} from '@libs/CategoryUtils'; @@ -340,6 +341,15 @@ function SearchAutocompleteList({ }, [allPoliciesTags]); const recentTagsAutocompleteList = useMemo(() => getAutocompleteRecentTags(allRecentTags), [allRecentTags]); + const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES, {canBeMissing: true}); + const [csvExportLayouts] = useOnyx(ONYXKEYS.NVP_CSV_EXPORT_LAYOUTS, {canBeMissing: true}); + const exportedToAutocompleteList = useMemo(() => { + const predefinedValues = CONST.SEARCH.PREDEFINED_INTEGRATION_FILTER_VALUES; + const exportTemplates = getExportTemplates(integrationsExportTemplates ?? [], csvExportLayouts ?? {}, translate, undefined, true); + const customNames = exportTemplates.map((t) => t.templateName).filter(Boolean); + return [...new Set([...predefinedValues, ...customNames])]; + }, [integrationsExportTemplates, csvExportLayouts, translate]); + const [autocompleteParsedQuery, autocompleteQueryWithoutFilters] = useMemo(() => { const queryWithoutFilters = getQueryWithoutFilters(autocompleteQueryValue); return [parsedQuery, queryWithoutFilters]; @@ -629,6 +639,17 @@ function SearchAutocompleteList({ return filteredIsValues.map((isValue) => ({filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.IS, text: isValue})); } + case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO: { + const filteredExportedTo = exportedToAutocompleteList + .filter((value) => value.toLowerCase().includes(autocompleteValue.toLowerCase()) && !alreadyAutocompletedKeys.has(value.toLowerCase())) + .sort() + .slice(0, 10); + return filteredExportedTo.map((value) => ({ + filterKey: CONST.SEARCH.SEARCH_USER_FRIENDLY_KEYS.EXPORTED_TO, + text: value, + mapKey: CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO, + })); + } case CONST.SEARCH.SYNTAX_FILTER_KEYS.DATE: case CONST.SEARCH.SYNTAX_FILTER_KEYS.SUBMITTED: case CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED: @@ -674,6 +695,7 @@ function SearchAutocompleteList({ hasAutocompleteList, isAutocompleteList, visibleReportActionsData, + exportedToAutocompleteList, ]); const sortedRecentSearches = useMemo(() => { diff --git a/src/components/Search/SearchMultipleSelectionPicker.tsx b/src/components/Search/SearchMultipleSelectionPicker.tsx index 1cae120f349c6..515288beed93a 100644 --- a/src/components/Search/SearchMultipleSelectionPicker.tsx +++ b/src/components/Search/SearchMultipleSelectionPicker.tsx @@ -13,6 +13,7 @@ import SearchFilterPageFooterButtons from './SearchFilterPageFooterButtons'; type SearchMultipleSelectionPickerItem = { name: string; value: string | string[]; + leftElement?: React.ReactNode; }; type SearchMultipleSelectionPickerProps = { @@ -42,6 +43,7 @@ function SearchMultipleSelectionPicker({items, initiallySelectedItems, pickerTit keyForList: item.name, isSelected: true, value: item.value, + leftElement: item.leftElement, })); const remainingItemsSection = items .filter( @@ -54,6 +56,7 @@ function SearchMultipleSelectionPicker({items, initiallySelectedItems, pickerTit keyForList: item.name, isSelected: false, value: item.value, + leftElement: item.leftElement, })); const isEmpty = !selectedItemsSection.length && !remainingItemsSection.length; return { @@ -83,7 +86,7 @@ function SearchMultipleSelectionPicker({items, initiallySelectedItems, pickerTit if (item.isSelected) { setSelectedItems(selectedItems?.filter((selectedItem) => selectedItem.name !== item.keyForList)); } else { - setSelectedItems([...(selectedItems ?? []), {name: item.text, value: item.value}]); + setSelectedItems([...(selectedItems ?? []), {name: item.text, value: item.value, leftElement: item.leftElement}]); } }, [selectedItems], diff --git a/src/hooks/useAdvancedSearchFilters.ts b/src/hooks/useAdvancedSearchFilters.ts index 107a7b90c6c68..48a0445a751fb 100644 --- a/src/hooks/useAdvancedSearchFilters.ts +++ b/src/hooks/useAdvancedSearchFilters.ts @@ -55,6 +55,7 @@ const typeFiltersKeys = { CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED, CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID, CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED, + CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_ID, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN, @@ -79,6 +80,7 @@ const typeFiltersKeys = { CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED, CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID, CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED, + CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_TYPE, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_ID, CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN, @@ -154,6 +156,7 @@ const typeFiltersKeys = { CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED, CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID, CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED, + CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO, CONST.SEARCH.SYNTAX_FILTER_KEYS.TITLE, ], ], diff --git a/src/libs/AccountingUtils.ts b/src/libs/AccountingUtils.ts index 7516048241d6a..600b49aaf1228 100644 --- a/src/libs/AccountingUtils.ts +++ b/src/libs/AccountingUtils.ts @@ -8,6 +8,7 @@ const ROUTE_NAME_MAPPING = { [CONST.POLICY.CONNECTIONS.ROUTE.SAGE_INTACCT]: CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT, [CONST.POLICY.CONNECTIONS.ROUTE.NETSUITE]: CONST.POLICY.CONNECTIONS.NAME.NETSUITE, [CONST.POLICY.CONNECTIONS.ROUTE.QBD]: CONST.POLICY.CONNECTIONS.NAME.QBD, + [CONST.POLICY.CONNECTIONS.ROUTE.CERTINIA]: CONST.POLICY.CONNECTIONS.NAME.CERTINIA, }; const NAME_ROUTE_MAPPING = { @@ -16,6 +17,16 @@ const NAME_ROUTE_MAPPING = { [CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: CONST.POLICY.CONNECTIONS.ROUTE.SAGE_INTACCT, [CONST.POLICY.CONNECTIONS.NAME.NETSUITE]: CONST.POLICY.CONNECTIONS.ROUTE.NETSUITE, [CONST.POLICY.CONNECTIONS.NAME.QBD]: CONST.POLICY.CONNECTIONS.ROUTE.QBD, + [CONST.POLICY.CONNECTIONS.NAME.CERTINIA]: CONST.POLICY.CONNECTIONS.ROUTE.CERTINIA, +}; + +const CONNECTION_NAME_TO_EXPORTED_TO_SEARCH_VALUE: Record = { + [CONST.POLICY.CONNECTIONS.NAME.XERO]: 'xero', + [CONST.POLICY.CONNECTIONS.NAME.QBO]: 'qbo', + [CONST.POLICY.CONNECTIONS.NAME.QBD]: 'qbd', + [CONST.POLICY.CONNECTIONS.NAME.NETSUITE]: 'netsuite', + [CONST.POLICY.CONNECTIONS.NAME.SAGE_INTACCT]: 'intacct', + [CONST.POLICY.CONNECTIONS.NAME.CERTINIA]: 'certinia', }; function getConnectionNameFromRouteParam(routeParam: ValueOf) { @@ -26,4 +37,12 @@ function getRouteParamForConnection(connectionName: ConnectionName) { return NAME_ROUTE_MAPPING[connectionName]; } -export {getConnectionNameFromRouteParam, getRouteParamForConnection}; +function getSearchValueForConnection(connectionName: ConnectionName): string { + return CONNECTION_NAME_TO_EXPORTED_TO_SEARCH_VALUE[connectionName]; +} + +function getPredefinedConnectionNamesForSearch(): ConnectionName[] { + return Object.keys(CONNECTION_NAME_TO_EXPORTED_TO_SEARCH_VALUE) as ConnectionName[]; +} + +export {getConnectionNameFromRouteParam, getRouteParamForConnection, getSearchValueForConnection, getPredefinedConnectionNamesForSearch}; diff --git a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx index 9ed54065bb215..843d6799c9357 100644 --- a/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx +++ b/src/libs/Navigation/AppNavigator/ModalStackNavigators/index.tsx @@ -952,6 +952,7 @@ const SearchAdvancedFiltersModalStackNavigator = createModalStackNavigator require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersApprovedPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_PAID_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersPaidPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersExportedPage').default, + [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_TO_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersExportedToPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_POSTED_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersPostedPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWN_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersWithdrawnPage').default, [SCREENS.SEARCH.ADVANCED_FILTERS_CURRENCY_RHP]: () => require('../../../../pages/Search/SearchAdvancedFiltersPage/SearchFiltersCurrencyPage').default, diff --git a/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts b/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts index fb3964849ea89..40391e4cb926d 100644 --- a/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts +++ b/src/libs/Navigation/linkingConfig/RELATIONS/SEARCH_TO_RHP.ts @@ -22,6 +22,7 @@ const SEARCH_TO_RHP: Partial['config'] = { [SCREENS.SEARCH.ADVANCED_FILTERS_APPROVED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.APPROVED), [SCREENS.SEARCH.ADVANCED_FILTERS_PAID_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.PAID), [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED), + [SCREENS.SEARCH.ADVANCED_FILTERS_EXPORTED_TO_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO), [SCREENS.SEARCH.ADVANCED_FILTERS_POSTED_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.POSTED), [SCREENS.SEARCH.ADVANCED_FILTERS_WITHDRAWN_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWN), [SCREENS.SEARCH.ADVANCED_FILTERS_CURRENCY_RHP]: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.CURRENCY), diff --git a/src/libs/ReportUtils.ts b/src/libs/ReportUtils.ts index a108a3773df06..965a1cada2e99 100644 --- a/src/libs/ReportUtils.ts +++ b/src/libs/ReportUtils.ts @@ -12355,7 +12355,10 @@ function getSourceIDFromReportAction(reportAction: OnyxEntry): str return sourceID; } -function getIntegrationIcon(connectionName?: ConnectionName, expensifyIcons?: Record<'XeroSquare' | 'QBOSquare' | 'NetSuiteSquare' | 'IntacctSquare' | 'QBDSquare', IconAsset> | undefined) { +function getIntegrationIcon( + connectionName?: ConnectionName, + expensifyIcons?: Record<'XeroSquare' | 'QBOSquare' | 'NetSuiteSquare' | 'IntacctSquare' | 'QBDSquare' | 'CertiniaSquare', IconAsset> | undefined, +) { if (connectionName === CONST.POLICY.CONNECTIONS.NAME.XERO) { return expensifyIcons?.XeroSquare; } @@ -12371,6 +12374,9 @@ function getIntegrationIcon(connectionName?: ConnectionName, expensifyIcons?: Re if (connectionName === CONST.POLICY.CONNECTIONS.NAME.QBD) { return expensifyIcons?.QBDSquare; } + if (connectionName === CONST.POLICY.CONNECTIONS.NAME.CERTINIA) { + return expensifyIcons?.CertiniaSquare; + } return undefined; } diff --git a/src/libs/SearchAutocompleteUtils.ts b/src/libs/SearchAutocompleteUtils.ts index e6e0aa7387ed6..71003cbd46b73 100644 --- a/src/libs/SearchAutocompleteUtils.ts +++ b/src/libs/SearchAutocompleteUtils.ts @@ -229,6 +229,8 @@ function filterOutRangesWithCorrectValue( case CONST.SEARCH.SYNTAX_FILTER_KEYS.DESCRIPTION: case CONST.SEARCH.SYNTAX_FILTER_KEYS.TITLE: return range.value.length > 0; + case CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO: + return (CONST.SEARCH.PREDEFINED_INTEGRATION_FILTER_VALUES as readonly string[]).includes(range.value.toLowerCase()); case CONST.SEARCH.SYNTAX_FILTER_KEYS.WITHDRAWAL_ID: case CONST.SEARCH.SYNTAX_FILTER_KEYS.REPORT_ID: return !['', 'null', 'undefined', '0', '-1'].includes(range.value); diff --git a/src/libs/SearchParser/autocompleteParser.js b/src/libs/SearchParser/autocompleteParser.js index 4f8f6d7b4fb99..f094632b8447f 100644 --- a/src/libs/SearchParser/autocompleteParser.js +++ b/src/libs/SearchParser/autocompleteParser.js @@ -257,33 +257,34 @@ function peg$parse(input, options) { var peg$c71 = "policy-name"; var peg$c72 = "bank-account"; var peg$c73 = "long-report-id"; - var peg$c74 = "exported-to"; - var peg$c75 = "exchange-rate"; - var peg$c76 = "reimbursable-total"; - var peg$c77 = "non-reimbursable-total"; - var peg$c78 = "group-from"; - var peg$c79 = "group-expenses"; - var peg$c80 = "group-total"; - var peg$c81 = "group-card"; - var peg$c82 = "group-feed"; - var peg$c83 = "group-bank-account"; - var peg$c84 = "group-withdrawn"; - var peg$c85 = "group-withdrawal-id"; - var peg$c86 = "group-category"; - var peg$c87 = "group-tag"; - var peg$c88 = "group-merchant"; - var peg$c89 = "group-month"; - var peg$c90 = "group-week"; - var peg$c91 = "group-year"; - var peg$c92 = "group-quarter"; - var peg$c93 = "!="; - var peg$c94 = ">="; - var peg$c95 = ">"; - var peg$c96 = "<="; - var peg$c97 = "<"; - var peg$c98 = "\u201C"; - var peg$c99 = "\u201D"; - var peg$c100 = "\""; + var peg$c74 = "exportedto"; + var peg$c75 = "exported-to"; + var peg$c76 = "exchange-rate"; + var peg$c77 = "reimbursable-total"; + var peg$c78 = "non-reimbursable-total"; + var peg$c79 = "group-from"; + var peg$c80 = "group-expenses"; + var peg$c81 = "group-total"; + var peg$c82 = "group-card"; + var peg$c83 = "group-feed"; + var peg$c84 = "group-bank-account"; + var peg$c85 = "group-withdrawn"; + var peg$c86 = "group-withdrawal-id"; + var peg$c87 = "group-category"; + var peg$c88 = "group-tag"; + var peg$c89 = "group-merchant"; + var peg$c90 = "group-month"; + var peg$c91 = "group-week"; + var peg$c92 = "group-year"; + var peg$c93 = "group-quarter"; + var peg$c94 = "!="; + var peg$c95 = ">="; + var peg$c96 = ">"; + var peg$c97 = "<="; + var peg$c98 = "<"; + var peg$c99 = "\u201C"; + var peg$c100 = "\u201D"; + var peg$c101 = "\""; var peg$r0 = /^[ \t\r\n\xA0,:=<>!]/; var peg$r1 = /^[:=]/; @@ -297,7 +298,7 @@ function peg$parse(input, options) { var peg$r9 = /^[ \t\n\r\xA0]/; var peg$r10 = /^[ \t\n\r\xA0a-zA-Z]/; var peg$r11 = /^[,]/; - var peg$r12 = /^[ \t\n\r\xA0,]/; + var peg$r12 = /^[ \t\n\r\xA0,:=<>!]/; var peg$e0 = peg$literalExpectation("-", false); var peg$e1 = peg$literalExpectation("report-field", true); @@ -376,49 +377,50 @@ function peg$parse(input, options) { var peg$e74 = peg$literalExpectation("policy-name", true); var peg$e75 = peg$literalExpectation("bank-account", true); var peg$e76 = peg$literalExpectation("long-report-id", true); - var peg$e77 = peg$literalExpectation("exported-to", true); - var peg$e78 = peg$literalExpectation("exchange-rate", true); - var peg$e79 = peg$literalExpectation("reimbursable-total", true); - var peg$e80 = peg$literalExpectation("non-reimbursable-total", true); - var peg$e81 = peg$literalExpectation("group-from", true); - var peg$e82 = peg$literalExpectation("group-expenses", true); - var peg$e83 = peg$literalExpectation("group-total", true); - var peg$e84 = peg$literalExpectation("group-card", true); - var peg$e85 = peg$literalExpectation("group-feed", true); - var peg$e86 = peg$literalExpectation("group-bank-account", true); - var peg$e87 = peg$literalExpectation("group-withdrawn", true); - var peg$e88 = peg$literalExpectation("group-withdrawal-id", true); - var peg$e89 = peg$literalExpectation("group-category", true); - var peg$e90 = peg$literalExpectation("group-tag", true); - var peg$e91 = peg$literalExpectation("group-merchant", true); - var peg$e92 = peg$literalExpectation("group-month", true); - var peg$e93 = peg$literalExpectation("group-week", true); - var peg$e94 = peg$literalExpectation("group-year", true); - var peg$e95 = peg$literalExpectation("group-quarter", true); - var peg$e96 = peg$otherExpectation("operator"); - var peg$e97 = peg$classExpectation([":", "="], false, false); - var peg$e98 = peg$literalExpectation("!=", false); - var peg$e99 = peg$literalExpectation(">=", false); - var peg$e100 = peg$literalExpectation(">", false); - var peg$e101 = peg$literalExpectation("<=", false); - var peg$e102 = peg$literalExpectation("<", false); - var peg$e103 = peg$otherExpectation("word"); - var peg$e104 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e105 = peg$otherExpectation("whitespace"); - var peg$e106 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); - var peg$e107 = peg$otherExpectation("quote"); - var peg$e108 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e109 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); - var peg$e110 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); - var peg$e111 = peg$literalExpectation("\u201C", false); - var peg$e112 = peg$literalExpectation("\u201D", false); - var peg$e113 = peg$literalExpectation("\"", false); - var peg$e114 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e115 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e116 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); - var peg$e117 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); - var peg$e118 = peg$classExpectation([","], false, false); - var peg$e119 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); + var peg$e77 = peg$literalExpectation("exportedTo", true); + var peg$e78 = peg$literalExpectation("exported-to", true); + var peg$e79 = peg$literalExpectation("exchange-rate", true); + var peg$e80 = peg$literalExpectation("reimbursable-total", true); + var peg$e81 = peg$literalExpectation("non-reimbursable-total", true); + var peg$e82 = peg$literalExpectation("group-from", true); + var peg$e83 = peg$literalExpectation("group-expenses", true); + var peg$e84 = peg$literalExpectation("group-total", true); + var peg$e85 = peg$literalExpectation("group-card", true); + var peg$e86 = peg$literalExpectation("group-feed", true); + var peg$e87 = peg$literalExpectation("group-bank-account", true); + var peg$e88 = peg$literalExpectation("group-withdrawn", true); + var peg$e89 = peg$literalExpectation("group-withdrawal-id", true); + var peg$e90 = peg$literalExpectation("group-category", true); + var peg$e91 = peg$literalExpectation("group-tag", true); + var peg$e92 = peg$literalExpectation("group-merchant", true); + var peg$e93 = peg$literalExpectation("group-month", true); + var peg$e94 = peg$literalExpectation("group-week", true); + var peg$e95 = peg$literalExpectation("group-year", true); + var peg$e96 = peg$literalExpectation("group-quarter", true); + var peg$e97 = peg$otherExpectation("operator"); + var peg$e98 = peg$classExpectation([":", "="], false, false); + var peg$e99 = peg$literalExpectation("!=", false); + var peg$e100 = peg$literalExpectation(">=", false); + var peg$e101 = peg$literalExpectation(">", false); + var peg$e102 = peg$literalExpectation("<=", false); + var peg$e103 = peg$literalExpectation("<", false); + var peg$e104 = peg$otherExpectation("word"); + var peg$e105 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e106 = peg$otherExpectation("whitespace"); + var peg$e107 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$e108 = peg$otherExpectation("quote"); + var peg$e109 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e110 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); + var peg$e111 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); + var peg$e112 = peg$literalExpectation("\u201C", false); + var peg$e113 = peg$literalExpectation("\u201D", false); + var peg$e114 = peg$literalExpectation("\"", false); + var peg$e115 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e116 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e117 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); + var peg$e118 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); + var peg$e119 = peg$classExpectation([","], false, false); + var peg$e120 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ",", ":", "=", "<", ">", "!"], false, false); var peg$f0 = function(ranges) { return { autocomplete, ranges }; }; var peg$f1 = function(filters) { return filters.filter(Boolean).flat(); }; @@ -544,7 +546,7 @@ function peg$parse(input, options) { var peg$f63 = function() { return "bankAccount"; }; var peg$f64 = function() { return "reportID"; }; var peg$f65 = function() { return "base62ReportID"; }; - var peg$f66 = function() { return "exportedto"; }; + var peg$f66 = function() { return "exportedTo"; }; var peg$f67 = function() { return "exchangeRate"; }; var peg$f68 = function() { return "reimbursableTotal"; }; var peg$f69 = function() { return "nonReimbursableTotal"; }; @@ -1061,37 +1063,40 @@ function peg$parse(input, options) { if (s1 === peg$FAILED) { s1 = peg$parsepaid(); if (s1 === peg$FAILED) { - s1 = peg$parseexported(); + s1 = peg$parseexportedTo(); if (s1 === peg$FAILED) { - s1 = peg$parsewithdrawn(); + s1 = peg$parseexported(); if (s1 === peg$FAILED) { - s1 = peg$parseposted(); + s1 = peg$parsewithdrawn(); if (s1 === peg$FAILED) { - s1 = peg$parsehas(); + s1 = peg$parseposted(); if (s1 === peg$FAILED) { - s1 = peg$parseis(); + s1 = peg$parsehas(); if (s1 === peg$FAILED) { - s1 = peg$parsepurchaseCurrency(); + s1 = peg$parseis(); if (s1 === peg$FAILED) { - s1 = peg$parsepurchaseAmount(); + s1 = peg$parsepurchaseCurrency(); if (s1 === peg$FAILED) { - s1 = peg$parseamount(); + s1 = peg$parsepurchaseAmount(); if (s1 === peg$FAILED) { - s1 = peg$parsemerchant(); + s1 = peg$parseamount(); if (s1 === peg$FAILED) { - s1 = peg$parsedescription(); + s1 = peg$parsemerchant(); if (s1 === peg$FAILED) { - s1 = peg$parsereportID(); + s1 = peg$parsedescription(); if (s1 === peg$FAILED) { - s1 = peg$parsewithdrawalID(); + s1 = peg$parsereportID(); if (s1 === peg$FAILED) { - s1 = peg$parsetitle(); + s1 = peg$parsewithdrawalID(); if (s1 === peg$FAILED) { - s1 = peg$parsereportFieldDynamic(); + s1 = peg$parsetitle(); if (s1 === peg$FAILED) { - s1 = peg$parsecolumns(); + s1 = peg$parsereportFieldDynamic(); if (s1 === peg$FAILED) { - s1 = peg$parselimit(); + s1 = peg$parsecolumns(); + if (s1 === peg$FAILED) { + s1 = peg$parselimit(); + } } } } @@ -2814,37 +2819,29 @@ function peg$parse(input, options) { } function peg$parseexportedTo() { - var s0, s1, s2, s3; + var s0, s1; - s0 = peg$currPos; - s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c74) { - peg$currPos += 11; + s0 = input.substr(peg$currPos, 10); + if (s0.toLowerCase() === peg$c74) { + peg$currPos += 10; } else { - s1 = peg$FAILED; + s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e77); } } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parsewordBoundary(); - peg$silentFails--; - if (s3 !== peg$FAILED) { - peg$currPos = s2; - s2 = undefined; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = input.substr(peg$currPos, 11); + if (s1.toLowerCase() === peg$c75) { + peg$currPos += 11; } else { - s2 = peg$FAILED; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e78); } } - if (s2 !== peg$FAILED) { + if (s1 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f66(); - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s1 = peg$f66(); } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s0 = s1; } return s0; @@ -2855,11 +2852,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c75) { + if (s1.toLowerCase() === peg$c76) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e78); } + if (peg$silentFails === 0) { peg$fail(peg$e79); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2892,11 +2889,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c76) { + if (s1.toLowerCase() === peg$c77) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e79); } + if (peg$silentFails === 0) { peg$fail(peg$e80); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2929,11 +2926,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 22); - if (s1.toLowerCase() === peg$c77) { + if (s1.toLowerCase() === peg$c78) { peg$currPos += 22; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -2966,11 +2963,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c78) { + if (s1.toLowerCase() === peg$c79) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3003,11 +3000,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c79) { + if (s1.toLowerCase() === peg$c80) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3040,11 +3037,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c80) { + if (s1.toLowerCase() === peg$c81) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e83); } + if (peg$silentFails === 0) { peg$fail(peg$e84); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3077,11 +3074,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c81) { + if (s1.toLowerCase() === peg$c82) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3114,11 +3111,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c82) { + if (s1.toLowerCase() === peg$c83) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e85); } + if (peg$silentFails === 0) { peg$fail(peg$e86); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3151,11 +3148,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c83) { + if (s1.toLowerCase() === peg$c84) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e86); } + if (peg$silentFails === 0) { peg$fail(peg$e87); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3188,11 +3185,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c84) { + if (s1.toLowerCase() === peg$c85) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3225,11 +3222,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 19); - if (s1.toLowerCase() === peg$c85) { + if (s1.toLowerCase() === peg$c86) { peg$currPos += 19; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3262,11 +3259,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c86) { + if (s1.toLowerCase() === peg$c87) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e89); } + if (peg$silentFails === 0) { peg$fail(peg$e90); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3299,11 +3296,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 9); - if (s1.toLowerCase() === peg$c87) { + if (s1.toLowerCase() === peg$c88) { peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e90); } + if (peg$silentFails === 0) { peg$fail(peg$e91); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3336,11 +3333,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c88) { + if (s1.toLowerCase() === peg$c89) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e91); } + if (peg$silentFails === 0) { peg$fail(peg$e92); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3373,11 +3370,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c89) { + if (s1.toLowerCase() === peg$c90) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3410,11 +3407,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c90) { + if (s1.toLowerCase() === peg$c91) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3447,11 +3444,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c91) { + if (s1.toLowerCase() === peg$c92) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e94); } + if (peg$silentFails === 0) { peg$fail(peg$e95); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3484,11 +3481,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c92) { + if (s1.toLowerCase() === peg$c93) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e95); } + if (peg$silentFails === 0) { peg$fail(peg$e96); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3526,7 +3523,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e97); } + if (peg$silentFails === 0) { peg$fail(peg$e98); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3535,12 +3532,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c93) { - s1 = peg$c93; + if (input.substr(peg$currPos, 2) === peg$c94) { + s1 = peg$c94; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3549,12 +3546,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c94) { - s1 = peg$c94; + if (input.substr(peg$currPos, 2) === peg$c95) { + s1 = peg$c95; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e99); } + if (peg$silentFails === 0) { peg$fail(peg$e100); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3564,11 +3561,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c95; + s1 = peg$c96; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3577,12 +3574,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c96) { - s1 = peg$c96; + if (input.substr(peg$currPos, 2) === peg$c97) { + s1 = peg$c97; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3592,11 +3589,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c97; + s1 = peg$c98; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3611,7 +3608,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } return s0; @@ -3642,7 +3639,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { @@ -3652,7 +3649,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } } } else { @@ -3666,7 +3663,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } return s0; @@ -3694,7 +3691,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } while (s1 !== peg$FAILED) { s0.push(s1); @@ -3703,12 +3700,12 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } } peg$silentFails--; s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } return s0; } @@ -3755,7 +3752,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3764,7 +3761,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } } s2 = input.charAt(peg$currPos); @@ -3772,7 +3769,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3781,7 +3778,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -3790,7 +3787,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } } s4 = input.charAt(peg$currPos); @@ -3798,7 +3795,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } if (s4 !== peg$FAILED) { s5 = []; @@ -3807,7 +3804,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } while (s6 !== peg$FAILED) { s5.push(s6); @@ -3816,7 +3813,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } } peg$savedPos = s0; @@ -3832,7 +3829,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } return s0; @@ -3849,7 +3846,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3858,7 +3855,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } } s2 = input.charAt(peg$currPos); @@ -3866,7 +3863,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3875,7 +3872,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3891,11 +3888,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c98; + s6 = peg$c99; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -3922,11 +3919,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c99; + s6 = peg$c100; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -3953,11 +3950,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c100; + s6 = peg$c101; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e113); } + if (peg$silentFails === 0) { peg$fail(peg$e114); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -3980,7 +3977,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -3996,11 +3993,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c98; + s6 = peg$c99; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4027,11 +4024,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c99; + s6 = peg$c100; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4058,11 +4055,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c100; + s6 = peg$c101; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e113); } + if (peg$silentFails === 0) { peg$fail(peg$e114); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4094,7 +4091,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } } return s0; @@ -4109,7 +4106,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -4147,7 +4144,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e114); } + if (peg$silentFails === 0) { peg$fail(peg$e115); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4156,7 +4153,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e114); } + if (peg$silentFails === 0) { peg$fail(peg$e115); } } } s2 = []; @@ -4165,7 +4162,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e115); } + if (peg$silentFails === 0) { peg$fail(peg$e116); } } while (s3 !== peg$FAILED) { s2.push(s3); @@ -4174,7 +4171,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e115); } + if (peg$silentFails === 0) { peg$fail(peg$e116); } } } s3 = []; @@ -4183,7 +4180,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e116); } + if (peg$silentFails === 0) { peg$fail(peg$e117); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -4192,7 +4189,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e116); } + if (peg$silentFails === 0) { peg$fail(peg$e117); } } } s4 = peg$parseoperator(); @@ -4211,7 +4208,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e117); } + if (peg$silentFails === 0) { peg$fail(peg$e118); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4220,7 +4217,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e117); } + if (peg$silentFails === 0) { peg$fail(peg$e118); } } } s2 = peg$currPos; @@ -4267,7 +4264,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e118); } + if (peg$silentFails === 0) { peg$fail(peg$e119); } } } } @@ -4283,7 +4280,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e119); } + if (peg$silentFails === 0) { peg$fail(peg$e120); } } if (s0 === peg$FAILED) { s0 = peg$currPos; diff --git a/src/libs/SearchParser/autocompleteParser.peggy b/src/libs/SearchParser/autocompleteParser.peggy index 2299252b119d2..25207e4acba27 100644 --- a/src/libs/SearchParser/autocompleteParser.peggy +++ b/src/libs/SearchParser/autocompleteParser.peggy @@ -105,6 +105,7 @@ autocompleteKey "key" / submitted / approved / paid + / exportedTo / exported / withdrawn / posted diff --git a/src/libs/SearchParser/baseRules.peggy b/src/libs/SearchParser/baseRules.peggy index 884aab360f4fc..5089313d52de1 100644 --- a/src/libs/SearchParser/baseRules.peggy +++ b/src/libs/SearchParser/baseRules.peggy @@ -131,7 +131,9 @@ withdrawalId = "withdrawal-id"i &wordBoundary { return "wi bankAccount = "bank-account"i &wordBoundary { return "bankAccount"; } reportId = "long-report-id"i &wordBoundary { return "reportID"; } base62ReportId = "report-id"i &wordBoundary { return "base62ReportID"; } -exportedTo = "exported-to"i &wordBoundary { return "exportedto"; } +exportedTo + = "exportedTo"i + / "exported-to"i { return "exportedTo"; } exchangeRate = "exchange-rate"i &wordBoundary { return "exchangeRate"; } reimbursableTotal = "reimbursable-total"i &wordBoundary { return "reimbursableTotal"; } nonReimbursableTotal = "non-reimbursable-total"i &wordBoundary { return "nonReimbursableTotal"; } @@ -207,5 +209,5 @@ validClosingCondition / [,] // Case 3: Followed by a comma wordBoundary - = [ \t\n\r\xA0,] // whitespace or comma + = [ \t\n\r\xA0,:=<>!] // whitespace, comma, or operator (so "exported-to:" is recognized) / !. // or end of input diff --git a/src/libs/SearchParser/searchParser.js b/src/libs/SearchParser/searchParser.js index 69589aabb68da..17c98f5a78c96 100644 --- a/src/libs/SearchParser/searchParser.js +++ b/src/libs/SearchParser/searchParser.js @@ -258,33 +258,34 @@ function peg$parse(input, options) { var peg$c71 = "policy-name"; var peg$c72 = "bank-account"; var peg$c73 = "long-report-id"; - var peg$c74 = "exported-to"; - var peg$c75 = "exchange-rate"; - var peg$c76 = "reimbursable-total"; - var peg$c77 = "non-reimbursable-total"; - var peg$c78 = "group-from"; - var peg$c79 = "group-expenses"; - var peg$c80 = "group-total"; - var peg$c81 = "group-card"; - var peg$c82 = "group-feed"; - var peg$c83 = "group-bank-account"; - var peg$c84 = "group-withdrawn"; - var peg$c85 = "group-withdrawal-id"; - var peg$c86 = "group-category"; - var peg$c87 = "group-tag"; - var peg$c88 = "group-merchant"; - var peg$c89 = "group-month"; - var peg$c90 = "group-week"; - var peg$c91 = "group-year"; - var peg$c92 = "group-quarter"; - var peg$c93 = "!="; - var peg$c94 = ">="; - var peg$c95 = ">"; - var peg$c96 = "<="; - var peg$c97 = "<"; - var peg$c98 = "\u201C"; - var peg$c99 = "\u201D"; - var peg$c100 = "\""; + var peg$c74 = "exportedto"; + var peg$c75 = "exported-to"; + var peg$c76 = "exchange-rate"; + var peg$c77 = "reimbursable-total"; + var peg$c78 = "non-reimbursable-total"; + var peg$c79 = "group-from"; + var peg$c80 = "group-expenses"; + var peg$c81 = "group-total"; + var peg$c82 = "group-card"; + var peg$c83 = "group-feed"; + var peg$c84 = "group-bank-account"; + var peg$c85 = "group-withdrawn"; + var peg$c86 = "group-withdrawal-id"; + var peg$c87 = "group-category"; + var peg$c88 = "group-tag"; + var peg$c89 = "group-merchant"; + var peg$c90 = "group-month"; + var peg$c91 = "group-week"; + var peg$c92 = "group-year"; + var peg$c93 = "group-quarter"; + var peg$c94 = "!="; + var peg$c95 = ">="; + var peg$c96 = ">"; + var peg$c97 = "<="; + var peg$c98 = "<"; + var peg$c99 = "\u201C"; + var peg$c100 = "\u201D"; + var peg$c101 = "\""; var peg$r0 = /^[^ \t\r\n\xA0]/; var peg$r1 = /^[ \t\r\n\xA0,:=<>!]/; @@ -299,7 +300,7 @@ function peg$parse(input, options) { var peg$r10 = /^[ \t\n\r\xA0]/; var peg$r11 = /^[ \t\n\r\xA0a-zA-Z]/; var peg$r12 = /^[,]/; - var peg$r13 = /^[ \t\n\r\xA0,]/; + var peg$r13 = /^[ \t\n\r\xA0,:=<>!]/; var peg$e0 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], true, false); var peg$e1 = peg$literalExpectation("-", false); @@ -380,49 +381,50 @@ function peg$parse(input, options) { var peg$e76 = peg$literalExpectation("policy-name", true); var peg$e77 = peg$literalExpectation("bank-account", true); var peg$e78 = peg$literalExpectation("long-report-id", true); - var peg$e79 = peg$literalExpectation("exported-to", true); - var peg$e80 = peg$literalExpectation("exchange-rate", true); - var peg$e81 = peg$literalExpectation("reimbursable-total", true); - var peg$e82 = peg$literalExpectation("non-reimbursable-total", true); - var peg$e83 = peg$literalExpectation("group-from", true); - var peg$e84 = peg$literalExpectation("group-expenses", true); - var peg$e85 = peg$literalExpectation("group-total", true); - var peg$e86 = peg$literalExpectation("group-card", true); - var peg$e87 = peg$literalExpectation("group-feed", true); - var peg$e88 = peg$literalExpectation("group-bank-account", true); - var peg$e89 = peg$literalExpectation("group-withdrawn", true); - var peg$e90 = peg$literalExpectation("group-withdrawal-id", true); - var peg$e91 = peg$literalExpectation("group-category", true); - var peg$e92 = peg$literalExpectation("group-tag", true); - var peg$e93 = peg$literalExpectation("group-merchant", true); - var peg$e94 = peg$literalExpectation("group-month", true); - var peg$e95 = peg$literalExpectation("group-week", true); - var peg$e96 = peg$literalExpectation("group-year", true); - var peg$e97 = peg$literalExpectation("group-quarter", true); - var peg$e98 = peg$otherExpectation("operator"); - var peg$e99 = peg$classExpectation([":", "="], false, false); - var peg$e100 = peg$literalExpectation("!=", false); - var peg$e101 = peg$literalExpectation(">=", false); - var peg$e102 = peg$literalExpectation(">", false); - var peg$e103 = peg$literalExpectation("<=", false); - var peg$e104 = peg$literalExpectation("<", false); - var peg$e105 = peg$otherExpectation("word"); - var peg$e106 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e107 = peg$otherExpectation("whitespace"); - var peg$e108 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); - var peg$e109 = peg$otherExpectation("quote"); - var peg$e110 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); - var peg$e111 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); - var peg$e112 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); - var peg$e113 = peg$literalExpectation("\u201C", false); - var peg$e114 = peg$literalExpectation("\u201D", false); - var peg$e115 = peg$literalExpectation("\"", false); - var peg$e116 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e117 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); - var peg$e118 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); - var peg$e119 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); - var peg$e120 = peg$classExpectation([","], false, false); - var peg$e121 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ","], false, false); + var peg$e79 = peg$literalExpectation("exportedTo", true); + var peg$e80 = peg$literalExpectation("exported-to", true); + var peg$e81 = peg$literalExpectation("exchange-rate", true); + var peg$e82 = peg$literalExpectation("reimbursable-total", true); + var peg$e83 = peg$literalExpectation("non-reimbursable-total", true); + var peg$e84 = peg$literalExpectation("group-from", true); + var peg$e85 = peg$literalExpectation("group-expenses", true); + var peg$e86 = peg$literalExpectation("group-total", true); + var peg$e87 = peg$literalExpectation("group-card", true); + var peg$e88 = peg$literalExpectation("group-feed", true); + var peg$e89 = peg$literalExpectation("group-bank-account", true); + var peg$e90 = peg$literalExpectation("group-withdrawn", true); + var peg$e91 = peg$literalExpectation("group-withdrawal-id", true); + var peg$e92 = peg$literalExpectation("group-category", true); + var peg$e93 = peg$literalExpectation("group-tag", true); + var peg$e94 = peg$literalExpectation("group-merchant", true); + var peg$e95 = peg$literalExpectation("group-month", true); + var peg$e96 = peg$literalExpectation("group-week", true); + var peg$e97 = peg$literalExpectation("group-year", true); + var peg$e98 = peg$literalExpectation("group-quarter", true); + var peg$e99 = peg$otherExpectation("operator"); + var peg$e100 = peg$classExpectation([":", "="], false, false); + var peg$e101 = peg$literalExpectation("!=", false); + var peg$e102 = peg$literalExpectation(">=", false); + var peg$e103 = peg$literalExpectation(">", false); + var peg$e104 = peg$literalExpectation("<=", false); + var peg$e105 = peg$literalExpectation("<", false); + var peg$e106 = peg$otherExpectation("word"); + var peg$e107 = peg$classExpectation([" ", ",", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e108 = peg$otherExpectation("whitespace"); + var peg$e109 = peg$classExpectation([" ", "\t", "\r", "\n", "\xA0"], false, false); + var peg$e110 = peg$otherExpectation("quote"); + var peg$e111 = peg$classExpectation([" ", ",", "\"", "\u201D", "\u201C", "\t", "\n", "\r", "\xA0"], true, false); + var peg$e112 = peg$classExpectation(["\"", ["\u201C", "\u201D"]], false, false); + var peg$e113 = peg$classExpectation(["\"", "\u201D", "\u201C", "\r", "\n"], true, false); + var peg$e114 = peg$literalExpectation("\u201C", false); + var peg$e115 = peg$literalExpectation("\u201D", false); + var peg$e116 = peg$literalExpectation("\"", false); + var peg$e117 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e118 = peg$classExpectation([["a", "z"], ["A", "Z"], ["0", "9"]], false, false); + var peg$e119 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0"], false, false); + var peg$e120 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ["a", "z"], ["A", "Z"]], false, false); + var peg$e121 = peg$classExpectation([","], false, false); + var peg$e122 = peg$classExpectation([" ", "\t", "\n", "\r", "\xA0", ",", ":", "=", "<", ">", "!"], false, false); var peg$f0 = function(filters) { return applyDefaults(filters); }; var peg$f1 = function(head, tail) { @@ -571,7 +573,7 @@ function peg$parse(input, options) { var peg$f64 = function() { return "bankAccount"; }; var peg$f65 = function() { return "reportID"; }; var peg$f66 = function() { return "base62ReportID"; }; - var peg$f67 = function() { return "exportedto"; }; + var peg$f67 = function() { return "exportedTo"; }; var peg$f68 = function() { return "exchangeRate"; }; var peg$f69 = function() { return "reimbursableTotal"; }; var peg$f70 = function() { return "nonReimbursableTotal"; }; @@ -1147,35 +1149,38 @@ function peg$parse(input, options) { if (s1 === peg$FAILED) { s1 = peg$parsepaid(); if (s1 === peg$FAILED) { - s1 = peg$parseexported(); + s1 = peg$parseexportedTo(); if (s1 === peg$FAILED) { - s1 = peg$parseposted(); + s1 = peg$parseexported(); if (s1 === peg$FAILED) { - s1 = peg$parsewithdrawn(); + s1 = peg$parseposted(); if (s1 === peg$FAILED) { - s1 = peg$parsefeed(); + s1 = peg$parsewithdrawn(); if (s1 === peg$FAILED) { - s1 = peg$parsetitle(); + s1 = peg$parsefeed(); if (s1 === peg$FAILED) { - s1 = peg$parseassignee(); + s1 = peg$parsetitle(); if (s1 === peg$FAILED) { - s1 = peg$parsecreatedBy(); + s1 = peg$parseassignee(); if (s1 === peg$FAILED) { - s1 = peg$parsereimbursable(); + s1 = peg$parsecreatedBy(); if (s1 === peg$FAILED) { - s1 = peg$parsebillable(); + s1 = peg$parsereimbursable(); if (s1 === peg$FAILED) { - s1 = peg$parseaction(); + s1 = peg$parsebillable(); if (s1 === peg$FAILED) { - s1 = peg$parsehas(); + s1 = peg$parseaction(); if (s1 === peg$FAILED) { - s1 = peg$parseis(); + s1 = peg$parsehas(); if (s1 === peg$FAILED) { - s1 = peg$parsepurchaseCurrency(); + s1 = peg$parseis(); if (s1 === peg$FAILED) { - s1 = peg$parsepurchaseAmount(); + s1 = peg$parsepurchaseCurrency(); if (s1 === peg$FAILED) { - s1 = peg$parsereportFieldDynamic(); + s1 = peg$parsepurchaseAmount(); + if (s1 === peg$FAILED) { + s1 = peg$parsereportFieldDynamic(); + } } } } @@ -2998,37 +3003,29 @@ function peg$parse(input, options) { } function peg$parseexportedTo() { - var s0, s1, s2, s3; + var s0, s1; - s0 = peg$currPos; - s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c74) { - peg$currPos += 11; + s0 = input.substr(peg$currPos, 10); + if (s0.toLowerCase() === peg$c74) { + peg$currPos += 10; } else { - s1 = peg$FAILED; + s0 = peg$FAILED; if (peg$silentFails === 0) { peg$fail(peg$e79); } } - if (s1 !== peg$FAILED) { - s2 = peg$currPos; - peg$silentFails++; - s3 = peg$parsewordBoundary(); - peg$silentFails--; - if (s3 !== peg$FAILED) { - peg$currPos = s2; - s2 = undefined; + if (s0 === peg$FAILED) { + s0 = peg$currPos; + s1 = input.substr(peg$currPos, 11); + if (s1.toLowerCase() === peg$c75) { + peg$currPos += 11; } else { - s2 = peg$FAILED; + s1 = peg$FAILED; + if (peg$silentFails === 0) { peg$fail(peg$e80); } } - if (s2 !== peg$FAILED) { + if (s1 !== peg$FAILED) { peg$savedPos = s0; - s0 = peg$f67(); - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s1 = peg$f67(); } - } else { - peg$currPos = s0; - s0 = peg$FAILED; + s0 = s1; } return s0; @@ -3039,11 +3036,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c75) { + if (s1.toLowerCase() === peg$c76) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e80); } + if (peg$silentFails === 0) { peg$fail(peg$e81); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3076,11 +3073,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c76) { + if (s1.toLowerCase() === peg$c77) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e81); } + if (peg$silentFails === 0) { peg$fail(peg$e82); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3113,11 +3110,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 22); - if (s1.toLowerCase() === peg$c77) { + if (s1.toLowerCase() === peg$c78) { peg$currPos += 22; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e82); } + if (peg$silentFails === 0) { peg$fail(peg$e83); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3150,11 +3147,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c78) { + if (s1.toLowerCase() === peg$c79) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e83); } + if (peg$silentFails === 0) { peg$fail(peg$e84); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3187,11 +3184,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c79) { + if (s1.toLowerCase() === peg$c80) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e84); } + if (peg$silentFails === 0) { peg$fail(peg$e85); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3224,11 +3221,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c80) { + if (s1.toLowerCase() === peg$c81) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e85); } + if (peg$silentFails === 0) { peg$fail(peg$e86); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3261,11 +3258,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c81) { + if (s1.toLowerCase() === peg$c82) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e86); } + if (peg$silentFails === 0) { peg$fail(peg$e87); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3298,11 +3295,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c82) { + if (s1.toLowerCase() === peg$c83) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e87); } + if (peg$silentFails === 0) { peg$fail(peg$e88); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3335,11 +3332,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 18); - if (s1.toLowerCase() === peg$c83) { + if (s1.toLowerCase() === peg$c84) { peg$currPos += 18; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e88); } + if (peg$silentFails === 0) { peg$fail(peg$e89); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3372,11 +3369,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 15); - if (s1.toLowerCase() === peg$c84) { + if (s1.toLowerCase() === peg$c85) { peg$currPos += 15; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e89); } + if (peg$silentFails === 0) { peg$fail(peg$e90); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3409,11 +3406,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 19); - if (s1.toLowerCase() === peg$c85) { + if (s1.toLowerCase() === peg$c86) { peg$currPos += 19; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e90); } + if (peg$silentFails === 0) { peg$fail(peg$e91); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3446,11 +3443,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c86) { + if (s1.toLowerCase() === peg$c87) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e91); } + if (peg$silentFails === 0) { peg$fail(peg$e92); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3483,11 +3480,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 9); - if (s1.toLowerCase() === peg$c87) { + if (s1.toLowerCase() === peg$c88) { peg$currPos += 9; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e92); } + if (peg$silentFails === 0) { peg$fail(peg$e93); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3520,11 +3517,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 14); - if (s1.toLowerCase() === peg$c88) { + if (s1.toLowerCase() === peg$c89) { peg$currPos += 14; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e93); } + if (peg$silentFails === 0) { peg$fail(peg$e94); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3557,11 +3554,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 11); - if (s1.toLowerCase() === peg$c89) { + if (s1.toLowerCase() === peg$c90) { peg$currPos += 11; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e94); } + if (peg$silentFails === 0) { peg$fail(peg$e95); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3594,11 +3591,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c90) { + if (s1.toLowerCase() === peg$c91) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e95); } + if (peg$silentFails === 0) { peg$fail(peg$e96); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3631,11 +3628,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 10); - if (s1.toLowerCase() === peg$c91) { + if (s1.toLowerCase() === peg$c92) { peg$currPos += 10; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e96); } + if (peg$silentFails === 0) { peg$fail(peg$e97); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3668,11 +3665,11 @@ function peg$parse(input, options) { s0 = peg$currPos; s1 = input.substr(peg$currPos, 13); - if (s1.toLowerCase() === peg$c92) { + if (s1.toLowerCase() === peg$c93) { peg$currPos += 13; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e97); } + if (peg$silentFails === 0) { peg$fail(peg$e98); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -3710,7 +3707,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e99); } + if (peg$silentFails === 0) { peg$fail(peg$e100); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3719,12 +3716,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c93) { - s1 = peg$c93; + if (input.substr(peg$currPos, 2) === peg$c94) { + s1 = peg$c94; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e100); } + if (peg$silentFails === 0) { peg$fail(peg$e101); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3733,12 +3730,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c94) { - s1 = peg$c94; + if (input.substr(peg$currPos, 2) === peg$c95) { + s1 = peg$c95; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e101); } + if (peg$silentFails === 0) { peg$fail(peg$e102); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3748,11 +3745,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 62) { - s1 = peg$c95; + s1 = peg$c96; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e102); } + if (peg$silentFails === 0) { peg$fail(peg$e103); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3761,12 +3758,12 @@ function peg$parse(input, options) { s0 = s1; if (s0 === peg$FAILED) { s0 = peg$currPos; - if (input.substr(peg$currPos, 2) === peg$c96) { - s1 = peg$c96; + if (input.substr(peg$currPos, 2) === peg$c97) { + s1 = peg$c97; peg$currPos += 2; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e103); } + if (peg$silentFails === 0) { peg$fail(peg$e104); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3776,11 +3773,11 @@ function peg$parse(input, options) { if (s0 === peg$FAILED) { s0 = peg$currPos; if (input.charCodeAt(peg$currPos) === 60) { - s1 = peg$c97; + s1 = peg$c98; peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e104); } + if (peg$silentFails === 0) { peg$fail(peg$e105); } } if (s1 !== peg$FAILED) { peg$savedPos = s0; @@ -3795,7 +3792,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e98); } + if (peg$silentFails === 0) { peg$fail(peg$e99); } } return s0; @@ -3826,7 +3823,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } if (s2 !== peg$FAILED) { while (s2 !== peg$FAILED) { @@ -3836,7 +3833,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } } } else { @@ -3850,7 +3847,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e105); } + if (peg$silentFails === 0) { peg$fail(peg$e106); } } return s0; @@ -3878,7 +3875,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } while (s1 !== peg$FAILED) { s0.push(s1); @@ -3887,12 +3884,12 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e108); } + if (peg$silentFails === 0) { peg$fail(peg$e109); } } } peg$silentFails--; s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e107); } + if (peg$silentFails === 0) { peg$fail(peg$e108); } return s0; } @@ -3939,7 +3936,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -3948,7 +3945,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } } s2 = input.charAt(peg$currPos); @@ -3956,7 +3953,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s2 !== peg$FAILED) { s3 = []; @@ -3965,7 +3962,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -3974,7 +3971,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } } s4 = input.charAt(peg$currPos); @@ -3982,7 +3979,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s4 !== peg$FAILED) { s5 = []; @@ -3991,7 +3988,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } while (s6 !== peg$FAILED) { s5.push(s6); @@ -4000,7 +3997,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e106); } + if (peg$silentFails === 0) { peg$fail(peg$e107); } } } peg$savedPos = s0; @@ -4016,7 +4013,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } return s0; @@ -4033,7 +4030,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4042,7 +4039,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e110); } + if (peg$silentFails === 0) { peg$fail(peg$e111); } } } s2 = input.charAt(peg$currPos); @@ -4050,7 +4047,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s2 !== peg$FAILED) { s3 = []; @@ -4059,7 +4056,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -4075,11 +4072,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c98; + s6 = peg$c99; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e113); } + if (peg$silentFails === 0) { peg$fail(peg$e114); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4106,11 +4103,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c99; + s6 = peg$c100; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e114); } + if (peg$silentFails === 0) { peg$fail(peg$e115); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4137,11 +4134,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c100; + s6 = peg$c101; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e115); } + if (peg$silentFails === 0) { peg$fail(peg$e116); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4164,7 +4161,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e112); } + if (peg$silentFails === 0) { peg$fail(peg$e113); } } if (s4 === peg$FAILED) { s4 = peg$currPos; @@ -4180,11 +4177,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8220) { - s6 = peg$c98; + s6 = peg$c99; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e113); } + if (peg$silentFails === 0) { peg$fail(peg$e114); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4211,11 +4208,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 8221) { - s6 = peg$c99; + s6 = peg$c100; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e114); } + if (peg$silentFails === 0) { peg$fail(peg$e115); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4242,11 +4239,11 @@ function peg$parse(input, options) { } if (s5 !== peg$FAILED) { if (input.charCodeAt(peg$currPos) === 34) { - s6 = peg$c100; + s6 = peg$c101; peg$currPos++; } else { s6 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e115); } + if (peg$silentFails === 0) { peg$fail(peg$e116); } } if (s6 !== peg$FAILED) { peg$savedPos = s4; @@ -4278,7 +4275,7 @@ function peg$parse(input, options) { peg$silentFails--; if (s0 === peg$FAILED) { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e109); } + if (peg$silentFails === 0) { peg$fail(peg$e110); } } return s0; @@ -4293,7 +4290,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s1 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e111); } + if (peg$silentFails === 0) { peg$fail(peg$e112); } } if (s1 !== peg$FAILED) { s2 = peg$currPos; @@ -4331,7 +4328,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e116); } + if (peg$silentFails === 0) { peg$fail(peg$e117); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4340,7 +4337,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e116); } + if (peg$silentFails === 0) { peg$fail(peg$e117); } } } s2 = []; @@ -4349,7 +4346,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e117); } + if (peg$silentFails === 0) { peg$fail(peg$e118); } } while (s3 !== peg$FAILED) { s2.push(s3); @@ -4358,7 +4355,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s3 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e117); } + if (peg$silentFails === 0) { peg$fail(peg$e118); } } } s3 = []; @@ -4367,7 +4364,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e118); } + if (peg$silentFails === 0) { peg$fail(peg$e119); } } while (s4 !== peg$FAILED) { s3.push(s4); @@ -4376,7 +4373,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s4 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e118); } + if (peg$silentFails === 0) { peg$fail(peg$e119); } } } s4 = peg$parseoperator(); @@ -4395,7 +4392,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e119); } + if (peg$silentFails === 0) { peg$fail(peg$e120); } } while (s2 !== peg$FAILED) { s1.push(s2); @@ -4404,7 +4401,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s2 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e119); } + if (peg$silentFails === 0) { peg$fail(peg$e120); } } } s2 = peg$currPos; @@ -4451,7 +4448,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e120); } + if (peg$silentFails === 0) { peg$fail(peg$e121); } } } } @@ -4467,7 +4464,7 @@ function peg$parse(input, options) { peg$currPos++; } else { s0 = peg$FAILED; - if (peg$silentFails === 0) { peg$fail(peg$e121); } + if (peg$silentFails === 0) { peg$fail(peg$e122); } } if (s0 === peg$FAILED) { s0 = peg$currPos; diff --git a/src/libs/SearchParser/searchParser.peggy b/src/libs/SearchParser/searchParser.peggy index 3a8c8a1c4d2db..9fc895b8ca731 100644 --- a/src/libs/SearchParser/searchParser.peggy +++ b/src/libs/SearchParser/searchParser.peggy @@ -252,6 +252,7 @@ key "key" / submitted / approved / paid + / exportedTo / exported / posted / withdrawn diff --git a/src/libs/SearchQueryUtils.ts b/src/libs/SearchQueryUtils.ts index 6d3688c3e5baf..a3c667b641c62 100644 --- a/src/libs/SearchQueryUtils.ts +++ b/src/libs/SearchQueryUtils.ts @@ -728,6 +728,7 @@ function buildQueryStringFromFilterFormValues(filterValues: Partial personalDetails?.[id]); } + if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO) { + filtersForm[key as typeof filterKey] = filterValues; + } if (filterKey === CONST.SEARCH.SYNTAX_FILTER_KEYS.PAYER) { filtersForm[key as typeof filterKey] = filterValues.find((id) => personalDetails?.[id]); @@ -1109,6 +1113,15 @@ function getFilterDisplayValue( if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.POLICY_ID) { return getPolicyNameWithFallback(filterValue, policies, reports); } + if (filterName === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO) { + if (filterValue === CONST.REPORT.EXPORT_OPTIONS.REPORT_LEVEL_EXPORT) { + return CONST.REPORT.EXPORT_OPTION_LABELS.REPORT_LEVEL_EXPORT; + } + if (filterValue === CONST.REPORT.EXPORT_OPTIONS.EXPENSE_LEVEL_EXPORT) { + return CONST.REPORT.EXPORT_OPTION_LABELS.EXPENSE_LEVEL_EXPORT; + } + return filterValue; + } return filterValue; } diff --git a/src/pages/Search/AdvancedSearchFilters.tsx b/src/pages/Search/AdvancedSearchFilters.tsx index 8c77d9f28cb02..75f4657e2f489 100644 --- a/src/pages/Search/AdvancedSearchFilters.tsx +++ b/src/pages/Search/AdvancedSearchFilters.tsx @@ -107,6 +107,11 @@ const baseFilterConfig = { description: 'search.filters.exported' as const, route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED), }, + exportedTo: { + getTitle: getFilterDisplayTitle, + description: 'search.exportedTo' as const, + route: ROUTES.SEARCH_ADVANCED_FILTERS.getRoute(CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO), + }, posted: { getTitle: getFilterDisplayTitle, description: 'search.filters.posted' as const, @@ -491,6 +496,24 @@ function getFilterDisplayTitle( return filterValue ? filterValue.map((value) => translate(`common.${value as ValueOf}`)).join(', ') : undefined; } + if (key === CONST.SEARCH.SYNTAX_FILTER_KEYS.EXPORTED_TO) { + const filterValue = filters[key]; + if (!filterValue) { + return undefined; + } + return (Array.isArray(filterValue) ? filterValue : [filterValue]) + .map((value) => { + if (value === CONST.REPORT.EXPORT_OPTIONS.REPORT_LEVEL_EXPORT) { + return CONST.REPORT.EXPORT_OPTION_LABELS.REPORT_LEVEL_EXPORT; + } + if (value === CONST.REPORT.EXPORT_OPTIONS.EXPENSE_LEVEL_EXPORT) { + return CONST.REPORT.EXPORT_OPTION_LABELS.EXPENSE_LEVEL_EXPORT; + } + return value; + }) + .join(', '); + } + const filterValue = filters[key]; return Array.isArray(filterValue) ? filterValue.join(', ') : filterValue; } diff --git a/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersExportedToPage.tsx b/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersExportedToPage.tsx new file mode 100644 index 0000000000000..bff802d45897d --- /dev/null +++ b/src/pages/Search/SearchAdvancedFiltersPage/SearchFiltersExportedToPage.tsx @@ -0,0 +1,147 @@ +import React, {useCallback, useMemo} from 'react'; +import {View} from 'react-native'; +import HeaderWithBackButton from '@components/HeaderWithBackButton'; +import Icon from '@components/Icon'; +import ScreenWrapper from '@components/ScreenWrapper'; +import SearchMultipleSelectionPicker from '@components/Search/SearchMultipleSelectionPicker'; +import type {SearchMultipleSelectionPickerItem} from '@components/Search/SearchMultipleSelectionPicker'; +import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset'; +import useLocalize from '@hooks/useLocalize'; +import useOnyx from '@hooks/useOnyx'; +import useStyleUtils from '@hooks/useStyleUtils'; +import useTheme from '@hooks/useTheme'; +import useThemeStyles from '@hooks/useThemeStyles'; +import {getPredefinedConnectionNamesForSearch, getSearchValueForConnection} from '@libs/AccountingUtils'; +import Navigation from '@libs/Navigation/Navigation'; +import {getIntegrationIcon} from '@libs/ReportUtils'; +import {getExportTemplates, updateAdvancedFilters} from '@userActions/Search'; +import CONST from '@src/CONST'; +import ONYXKEYS from '@src/ONYXKEYS'; +import ROUTES from '@src/ROUTES'; +import type {ConnectionName} from '@src/types/onyx/Policy'; + +const EXPORT_OPTION_TO_QUERY_LABEL: Record = { + [CONST.REPORT.EXPORT_OPTIONS.REPORT_LEVEL_EXPORT]: CONST.REPORT.EXPORT_OPTION_LABELS.REPORT_LEVEL_EXPORT, + [CONST.REPORT.EXPORT_OPTIONS.EXPENSE_LEVEL_EXPORT]: CONST.REPORT.EXPORT_OPTION_LABELS.EXPENSE_LEVEL_EXPORT, +}; + +function SearchFiltersExportedToPage() { + const styles = useThemeStyles(); + const {translate} = useLocalize(); + const StyleUtils = useStyleUtils(); + const theme = useTheme(); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare', 'CertiniaSquare', 'Table']); + + const [searchAdvancedFiltersForm] = useOnyx(ONYXKEYS.FORMS.SEARCH_ADVANCED_FILTERS_FORM, {canBeMissing: true}); + const [integrationsExportTemplates] = useOnyx(ONYXKEYS.NVP_INTEGRATION_SERVER_EXPORT_TEMPLATES, {canBeMissing: true}); + const [csvExportLayouts] = useOnyx(ONYXKEYS.NVP_CSV_EXPORT_LAYOUTS, {canBeMissing: true}); + const policyIDs = searchAdvancedFiltersForm?.policyID ?? []; + const [policies] = useOnyx(ONYXKEYS.COLLECTION.POLICY, {canBeMissing: true}); + const policy = policyIDs?.length === 1 ? policies?.[`${ONYXKEYS.COLLECTION.POLICY}${policyIDs[0]}`] : undefined; + + const items = useMemo((): SearchMultipleSelectionPickerItem[] => { + const predefinedConnectionNamesList = getPredefinedConnectionNamesForSearch(); + const predefinedConnectionNamesSet = new Set(predefinedConnectionNamesList); + + const defaultExportOptionIcon = ( + + + + ); + + const integrationItems: SearchMultipleSelectionPickerItem[] = predefinedConnectionNamesList.map((connectionName) => { + const icon = getIntegrationIcon(connectionName, expensifyIcons); + const leftElement = icon ? ( + + + + ) : ( + defaultExportOptionIcon + ); + return { + name: CONST.POLICY.CONNECTIONS.NAME_USER_FRIENDLY[connectionName], + value: getSearchValueForConnection(connectionName), + leftElement, + }; + }); + const exportTemplates = getExportTemplates(integrationsExportTemplates ?? [], csvExportLayouts ?? {}, translate, policy, true); + + const customItems: SearchMultipleSelectionPickerItem[] = []; + const standardItems: SearchMultipleSelectionPickerItem[] = []; + + exportTemplates.forEach((template) => { + if (!template.templateName || predefinedConnectionNamesSet.has(template.templateName)) { + return; + } + + const name = template.name ?? template.templateName ?? ''; + const value = EXPORT_OPTION_TO_QUERY_LABEL[template.templateName] ?? template.templateName; + const item: SearchMultipleSelectionPickerItem = { + name, + value, + leftElement: defaultExportOptionIcon, + }; + + if (EXPORT_OPTION_TO_QUERY_LABEL[template.templateName]) { + standardItems.push(item); + } else { + customItems.push(item); + } + }); + + customItems.sort((a, b) => a.name.localeCompare(b.name)); + + return [...integrationItems, ...customItems, ...standardItems]; + }, [integrationsExportTemplates, csvExportLayouts, policy, expensifyIcons, styles, StyleUtils, theme, translate]); + + const initiallySelectedItems = useMemo((): SearchMultipleSelectionPickerItem[] | undefined => { + const selectedValues = searchAdvancedFiltersForm?.exportedTo ?? []; + if (selectedValues.length === 0) { + return undefined; + } + const normalizedSet = new Set(selectedValues.map((selectedValue) => selectedValue.toLowerCase())); + return items.filter((item) => { + const value = typeof item.value === 'string' ? item.value : (item.value[0] ?? ''); + return normalizedSet.has(value.toLowerCase()); + }); + }, [searchAdvancedFiltersForm?.exportedTo, items]); + + const onSaveSelection = useCallback((values: string[]) => updateAdvancedFilters({exportedTo: values}), []); + + return ( + + { + Navigation.goBack(ROUTES.SEARCH_ADVANCED_FILTERS.getRoute()); + }} + /> + + + + + ); +} + +export default SearchFiltersExportedToPage; diff --git a/src/pages/inbox/report/ReportDetailsExportPage.tsx b/src/pages/inbox/report/ReportDetailsExportPage.tsx index efd0e362040a0..e4e5f1edbf6c4 100644 --- a/src/pages/inbox/report/ReportDetailsExportPage.tsx +++ b/src/pages/inbox/report/ReportDetailsExportPage.tsx @@ -40,7 +40,7 @@ function ReportDetailsExportPage({route}: ReportDetailsExportPageProps) { const {showConfirmModal} = useConfirmModal(); const styles = useThemeStyles(); const lazyIllustrations = useMemoizedLazyIllustrations(['LaptopWithSecondScreenAndHourglass']); - const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare']); + const expensifyIcons = useMemoizedLazyExpensifyIcons(['XeroSquare', 'QBOSquare', 'NetSuiteSquare', 'IntacctSquare', 'QBDSquare', 'CertiniaSquare']); const iconToDisplay = getIntegrationIcon(connectionName, expensifyIcons); const canBeExported = canBeExportedUtil(report); diff --git a/src/types/form/SearchAdvancedFiltersForm.ts b/src/types/form/SearchAdvancedFiltersForm.ts index 54c33c46ab913..839f878f637bd 100644 --- a/src/types/form/SearchAdvancedFiltersForm.ts +++ b/src/types/form/SearchAdvancedFiltersForm.ts @@ -128,6 +128,9 @@ const FILTER_KEYS = { EXPORTER_NOT: 'exporterNot', EXPORTER: 'exporter', + EXPORTED_TO_NOT: 'exportedToNot', + EXPORTED_TO: 'exportedTo', + IN_NOT: 'inNot', IN: 'in', @@ -249,6 +252,8 @@ const ALLOWED_TYPE_FILTERS = { FILTER_KEYS.EXPORTED_BEFORE, FILTER_KEYS.EXPORTER, FILTER_KEYS.EXPORTER_NOT, + FILTER_KEYS.EXPORTED_TO, + FILTER_KEYS.EXPORTED_TO_NOT, FILTER_KEYS.GROUP_BY, FILTER_KEYS.VIEW, FILTER_KEYS.ACTION, @@ -318,6 +323,8 @@ const ALLOWED_TYPE_FILTERS = { FILTER_KEYS.EXPORTED_ON, FILTER_KEYS.EXPORTED_NOT, FILTER_KEYS.EXPORTER, + FILTER_KEYS.EXPORTED_TO, + FILTER_KEYS.EXPORTED_TO_NOT, FILTER_KEYS.ACTION, FILTER_KEYS.ACTION_NOT, FILTER_KEYS.WITHDRAWAL_ID, @@ -476,6 +483,8 @@ const ALLOWED_TYPE_FILTERS = { FILTER_KEYS.EXPORTED_BEFORE, FILTER_KEYS.EXPORTER, FILTER_KEYS.EXPORTER_NOT, + FILTER_KEYS.EXPORTED_TO, + FILTER_KEYS.EXPORTED_TO_NOT, FILTER_KEYS.ACTION, FILTER_KEYS.ACTION_NOT, FILTER_KEYS.PURCHASE_AMOUNT_EQUAL_TO, @@ -636,6 +645,9 @@ type SearchAdvancedFiltersForm = Form< [FILTER_KEYS.EXPORTER]: string[]; [FILTER_KEYS.EXPORTER_NOT]: string[]; + [FILTER_KEYS.EXPORTED_TO]: string[]; + [FILTER_KEYS.EXPORTED_TO_NOT]: string[]; + [FILTER_KEYS.TO]: string[]; [FILTER_KEYS.TO_NOT]: string[]; diff --git a/src/types/onyx/Policy.ts b/src/types/onyx/Policy.ts index a70079302a1c1..feffbb8a9e8ce 100644 --- a/src/types/onyx/Policy.ts +++ b/src/types/onyx/Policy.ts @@ -1463,6 +1463,9 @@ type Connections = { /** QuickBooks Desktop integration connection */ [CONST.POLICY.CONNECTIONS.NAME.QBD]: Connection; + + /** Certinia integration connection */ + [CONST.POLICY.CONNECTIONS.NAME.CERTINIA]: Connection, Record>; }; /** All integration connections, including unsupported ones */