mirror of
https://github.com/actualbudget/actual.git
synced 2026-04-30 10:14:53 -05:00
feat: fix categories being set on offbudget transactions (#3705)
* chore: release note * feat: fix categories being set on offbudget transactions * fix: #2266 * fix: small mistake * chore: update comment
This commit is contained in:
committed by
GitHub
parent
a3256f5686
commit
a91a8859ab
@@ -77,7 +77,13 @@ export async function batchUpdateTransactions({
|
|||||||
await batchMessages(async () => {
|
await batchMessages(async () => {
|
||||||
if (added) {
|
if (added) {
|
||||||
addedIds = await Promise.all(
|
addedIds = await Promise.all(
|
||||||
added.map(async t => db.insertTransaction(t)),
|
added.map(async t => {
|
||||||
|
const account = accounts.find(acct => acct.id === t.account);
|
||||||
|
if (account.offbudget === 1) {
|
||||||
|
t.category = null;
|
||||||
|
}
|
||||||
|
return db.insertTransaction(t);
|
||||||
|
}),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -26,11 +26,16 @@ async function clearCategory(transaction, transferAcct) {
|
|||||||
[transferAcct],
|
[transferAcct],
|
||||||
);
|
);
|
||||||
|
|
||||||
// We should clear the category to make sure it's not being
|
// If the transfer is between two on-budget or two off-budget accounts,
|
||||||
// accounted for in the budget, unless it should be in the case of
|
// we should clear the category, because the category is not relevant
|
||||||
// transferring from an on-budget to off-budget account
|
|
||||||
if (fromOffBudget === toOffBudget) {
|
if (fromOffBudget === toOffBudget) {
|
||||||
await db.updateTransaction({ id: transaction.id, category: null });
|
await db.updateTransaction({ id: transaction.id, category: null });
|
||||||
|
if (transaction.transfer_id) {
|
||||||
|
await db.updateTransaction({
|
||||||
|
id: transaction.transfer_id,
|
||||||
|
category: null,
|
||||||
|
});
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
6
upcoming-release-notes/3705.md
Normal file
6
upcoming-release-notes/3705.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Bugfix
|
||||||
|
authors: [UnderKoen]
|
||||||
|
---
|
||||||
|
|
||||||
|
Fix category being set on off-budget accounts
|
||||||
Reference in New Issue
Block a user