Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,7 @@ export function ImportTransactions({ modalProps, options }) {
const [outValue, setOutValue] = useState('');
const [flipAmount, setFlipAmount] = useState(false);
const [multiplierEnabled, setMultiplierEnabled] = useState(false);
const [reconcile, setReconcile] = useState(true);
const { accountId, categories, onImported } = options;

// This cannot be set after parsing the file, because changing it
Expand Down Expand Up @@ -980,7 +981,11 @@ export function ImportTransactions({ modalProps, options }) {
savePrefs({ [`flip-amount-${accountId}-${filetype}`]: flipAmount });
}

const didChange = await importTransactions(accountId, finalTransactions);
const didChange = await importTransactions(
accountId,
finalTransactions,
reconcile,
);
if (didChange) {
await getPayees();
}
Expand Down Expand Up @@ -1105,21 +1110,32 @@ export function ImportTransactions({ modalProps, options }) {
)}

{isOfxFile(filetype) && (
<CheckboxOption
id="form_fallback_missing_payee"
checked={fallbackMissingPayeeToMemo}
onChange={() => {
setFallbackMissingPayeeToMemo(state => !state);
parse(
filename,
getParseOptions('ofx', {
fallbackMissingPayeeToMemo: !fallbackMissingPayeeToMemo,
}),
);
}}
>
Use Memo as a fallback for empty Payees
</CheckboxOption>
<>
<CheckboxOption
id="form_fallback_missing_payee"
checked={fallbackMissingPayeeToMemo}
onChange={() => {
setFallbackMissingPayeeToMemo(state => !state);
parse(
filename,
getParseOptions('ofx', {
fallbackMissingPayeeToMemo: !fallbackMissingPayeeToMemo,
}),
);
}}
>
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 */}
Expand Down
13 changes: 11 additions & 2 deletions packages/loot-core/src/client/actions/account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,8 +203,17 @@ export function parseTransactions(filepath, options) {
};
}

export function importTransactions(id, transactions) {
return async (dispatch: Dispatch) => {
export function importTransactions(id: string, transactions, reconcile = true) {
return async (dispatch: Dispatch): Promise<boolean> => {
if (!reconcile) {
await send('api/transactions-add', {
accountId: id,
transactions,
});

return true;
}

const {
errors = [],
added,
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/2564.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Features
authors: [keriati]
---

Add options to disable reconciliation when importing OFX files.
Loading