Skip to content

Commit

Permalink
codinguser#876 - Create AccountUtils
Browse files Browse the repository at this point in the history
  • Loading branch information
JeanGarf committed Mar 3, 2020
1 parent 6615458 commit 4c84125
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions app/src/main/java/org/gnucash/android/ui/util/AccountUtils.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.gnucash.android.ui.util;

import org.gnucash.android.db.DatabaseSchema;
import org.gnucash.android.model.AccountType;

/**
* Utilities for Accounts UI
*
* @author JeanGarf
*/
public class AccountUtils {

/**
* Build the where clause to select Accounts allowed for Transfer
* for the given accountUID
*
* @param accountUID
* The account UID for which we want to collect account allowed for transfer
* May be null (to allow all non special accounts)
*
* @return
* the where clause
*
* @author JeanGarf
*/
public static String getTransfertAccountWhereClause(final String accountUID) {

return "("
+ DatabaseSchema.AccountEntry.COLUMN_UID
+ " != '"
+ ((accountUID != null) ? accountUID : "")
+ "' AND "
+ DatabaseSchema.AccountEntry.COLUMN_TYPE
+ " != '"
+ AccountType.ROOT.name()
+ "' AND "
+ DatabaseSchema.AccountEntry.COLUMN_PLACEHOLDER
+ " = 0"
+ " AND "
+ DatabaseSchema.AccountEntry.COLUMN_HIDDEN
+ " = 0"
+ ")";
}
}

0 comments on commit 4c84125

Please sign in to comment.