From ce74c4817bbaab40ddfada8d959f53032c7e209c Mon Sep 17 00:00:00 2001 From: MaysWind Date: Thu, 18 Sep 2025 22:42:30 +0800 Subject: [PATCH] fix transaction type was not checked when replacing transaction categories using batch rules (#248) --- .../import/tabs/ImportTransactionCheckDataTab.vue | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/views/desktop/transactions/import/tabs/ImportTransactionCheckDataTab.vue b/src/views/desktop/transactions/import/tabs/ImportTransactionCheckDataTab.vue index f50e2583..3d04dfa8 100644 --- a/src/views/desktop/transactions/import/tabs/ImportTransactionCheckDataTab.vue +++ b/src/views/desktop/transactions/import/tabs/ImportTransactionCheckDataTab.vue @@ -1720,8 +1720,16 @@ function showReplaceAllTypesDialog(): void { if (rule.dataType === 'expenseCategory' || rule.dataType === 'incomeCategory' || rule.dataType === 'transferCategory') { if (importTransaction.type !== TransactionType.ModifyBalance && importTransaction.originalCategoryName === rule.sourceValue) { - importTransaction.categoryId = rule.targetId; - updated = true; + if (rule.dataType === 'expenseCategory' && importTransaction.type === TransactionType.Expense) { + importTransaction.categoryId = rule.targetId; + updated = true; + } else if (rule.dataType === 'incomeCategory' && importTransaction.type === TransactionType.Income) { + importTransaction.categoryId = rule.targetId; + updated = true; + } else if (rule.dataType === 'transferCategory' && importTransaction.type === TransactionType.Transfer) { + importTransaction.categoryId = rule.targetId; + updated = true; + } } } else if (rule.dataType === 'account') { if (importTransaction.originalSourceAccountName === rule.sourceValue) {