Skip to content
Snippets Groups Projects
Unverified Commit 915c5625 authored by Attila Kerekes's avatar Attila Kerekes Committed by GitHub
Browse files

Add option to disable reconciliation when importing OFX files. (#2564)

parent 770d8625
No related branches found
No related tags found
No related merge requests found
...@@ -755,6 +755,7 @@ export function ImportTransactions({ modalProps, options }) { ...@@ -755,6 +755,7 @@ export function ImportTransactions({ modalProps, options }) {
const [outValue, setOutValue] = useState(''); const [outValue, setOutValue] = useState('');
const [flipAmount, setFlipAmount] = useState(false); const [flipAmount, setFlipAmount] = useState(false);
const [multiplierEnabled, setMultiplierEnabled] = useState(false); const [multiplierEnabled, setMultiplierEnabled] = useState(false);
const [reconcile, setReconcile] = useState(true);
const { accountId, categories, onImported } = options; const { accountId, categories, onImported } = options;
// This cannot be set after parsing the file, because changing it // This cannot be set after parsing the file, because changing it
...@@ -980,7 +981,11 @@ export function ImportTransactions({ modalProps, options }) { ...@@ -980,7 +981,11 @@ export function ImportTransactions({ modalProps, options }) {
savePrefs({ [`flip-amount-${accountId}-${filetype}`]: flipAmount }); savePrefs({ [`flip-amount-${accountId}-${filetype}`]: flipAmount });
} }
const didChange = await importTransactions(accountId, finalTransactions); const didChange = await importTransactions(
accountId,
finalTransactions,
reconcile,
);
if (didChange) { if (didChange) {
await getPayees(); await getPayees();
} }
...@@ -1105,21 +1110,32 @@ export function ImportTransactions({ modalProps, options }) { ...@@ -1105,21 +1110,32 @@ export function ImportTransactions({ modalProps, options }) {
)} )}
{isOfxFile(filetype) && ( {isOfxFile(filetype) && (
<CheckboxOption <>
id="form_fallback_missing_payee" <CheckboxOption
checked={fallbackMissingPayeeToMemo} id="form_fallback_missing_payee"
onChange={() => { checked={fallbackMissingPayeeToMemo}
setFallbackMissingPayeeToMemo(state => !state); onChange={() => {
parse( setFallbackMissingPayeeToMemo(state => !state);
filename, parse(
getParseOptions('ofx', { filename,
fallbackMissingPayeeToMemo: !fallbackMissingPayeeToMemo, getParseOptions('ofx', {
}), fallbackMissingPayeeToMemo: !fallbackMissingPayeeToMemo,
); }),
}} );
> }}
Use Memo as a fallback for empty Payees >
</CheckboxOption> Use Memo as a fallback for empty Payees
</CheckboxOption>
<CheckboxOption
id="form_dont_reconcile"
checked={reconcile}
onChange={() => {
setReconcile(state => !state);
}}
>
Reconcile transactions
</CheckboxOption>
</>
)} )}
{/*Import Options */} {/*Import Options */}
......
...@@ -183,8 +183,17 @@ export function parseTransactions(filepath, options) { ...@@ -183,8 +183,17 @@ export function parseTransactions(filepath, options) {
}; };
} }
export function importTransactions(id, transactions) { export function importTransactions(id: string, transactions, reconcile = true) {
return async (dispatch: Dispatch) => { return async (dispatch: Dispatch): Promise<boolean> => {
if (!reconcile) {
await send('api/transactions-add', {
accountId: id,
transactions,
});
return true;
}
const { const {
errors = [], errors = [],
added, added,
......
---
category: Features
authors: [keriati]
---
Add options to disable reconciliation when importing OFX files.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment