implemented dropping transaction by clearing amount, source or destination field

Signed-off-by: Stephan Richter <s.richter@srsoftware.de>
This commit is contained in:
2026-05-04 15:27:51 +02:00
parent a261d8eb9b
commit dee494f7ca
2 changed files with 9 additions and 2 deletions
@@ -295,7 +295,7 @@ public class SqliteDb extends BaseDb implements AccountDb {
}
} else if (transaction.isDirty()) {
try {
if (transaction.amount() == 0) {
if (transaction.amount() == 0 || transaction.source().isEmpty() || transaction.destination().isEmpty()) {
delete().from(TABLE_TRANSACTIONS).where(Field.ID, equal(transaction.id())).where(ACCOUNT, equal(transaction.accountId())).execute(db);
} else {
replaceInto(TABLE_TRANSACTIONS, Field.ID, Field.ACCOUNT, Field.TIMESTAMP, Field.SOURCE, Field.DESTINATION, Field.AMOUNT, Field.DESCRIPTION)