Skip to content

Commit 8fd7813

Browse files
committed
Fixed: cyclic account hierarchies created by accounts setting parent to self
1 parent 0fdb76c commit 8fd7813

1 file changed

Lines changed: 2 additions & 2 deletions

File tree

app/src/main/java/org/gnucash/android/ui/account/AccountFormFragment.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -559,9 +559,9 @@ private void loadParentAccountList(AccountType accountType){
559559

560560
if (mAccount != null){ //if editing an account
561561
mDescendantAccountUIDs = mAccountsDbAdapter.getDescendantAccountUIDs(mAccount.getUID(), null, null);
562+
mDescendantAccountUIDs.add(mAccountsDbAdapter.getGnuCashRootAccountUID());
562563
// limit cyclic account hierarchies.
563-
condition += " AND (" + DatabaseSchema.AccountEntry.COLUMN_PARENT_ACCOUNT_UID + " IS NULL "
564-
+ " OR " + DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ( '"
564+
condition += " AND (" + DatabaseSchema.AccountEntry.COLUMN_UID + " NOT IN ( '"
565565
+ TextUtils.join("','", mDescendantAccountUIDs) + "','" + mAccountUID + "' ) )";
566566
}
567567

0 commit comments

Comments
 (0)