Skip to content

Commit 032b9b7

Browse files
committed
delete all splits of a transaction
1 parent ca4f145 commit 032b9b7

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

app/src/org/gnucash/android/db/AccountsDbAdapter.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,11 @@ public boolean destructiveDeleteAccount(long rowId){
281281
}
282282
//delete splits in this account
283283
mDb.delete(SplitEntry.TABLE_NAME,
284-
SplitEntry.COLUMN_ACCOUNT_UID + "=?",
284+
SplitEntry.COLUMN_TRANSACTION_UID + " IN ( SELECT DISTINCT "
285+
+ TransactionEntry.TABLE_NAME + "_" + TransactionEntry.COLUMN_UID
286+
+ " FROM trans_split_acct WHERE "
287+
+ AccountEntry.TABLE_NAME + "_" + AccountEntry.COLUMN_UID
288+
+ " = ? )",
285289
new String[]{getAccountUID(rowId)});
286290
deleteRecord(AccountEntry.TABLE_NAME, rowId);
287291
mDb.setTransactionSuccessful();

0 commit comments

Comments
 (0)