mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Regularize the account type names into the form ACCT_TYPE_xxx.
git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@14599 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
2006-08-06 David Hampton <hampton@employees.org>
|
||||
|
||||
* various: Regularize the account type names into the form
|
||||
ACCT_TYPE_xxx.
|
||||
|
||||
2006-08-05 David Hampton <hampton@employees.org>
|
||||
|
||||
* import-backend.c: gnc_import_process_trans_item() should return
|
||||
|
||||
@@ -117,18 +117,18 @@ gnc_configure_reverse_balance (void)
|
||||
}
|
||||
else if (safe_strcmp (choice, "income_expense") == 0)
|
||||
{
|
||||
reverse_type[INCOME] = TRUE;
|
||||
reverse_type[EXPENSE] = TRUE;
|
||||
reverse_type[ACCT_TYPE_INCOME] = TRUE;
|
||||
reverse_type[ACCT_TYPE_EXPENSE] = TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (safe_strcmp (choice, "credit") != 0)
|
||||
PERR("bad value '%s'", choice);
|
||||
reverse_type[LIABILITY] = TRUE;
|
||||
reverse_type[PAYABLE] = TRUE;
|
||||
reverse_type[EQUITY] = TRUE;
|
||||
reverse_type[INCOME] = TRUE;
|
||||
reverse_type[CREDIT] = TRUE;
|
||||
reverse_type[ACCT_TYPE_LIABILITY] = TRUE;
|
||||
reverse_type[ACCT_TYPE_PAYABLE] = TRUE;
|
||||
reverse_type[ACCT_TYPE_EQUITY] = TRUE;
|
||||
reverse_type[ACCT_TYPE_INCOME] = TRUE;
|
||||
reverse_type[ACCT_TYPE_CREDIT] = TRUE;
|
||||
}
|
||||
|
||||
if (choice != NULL)
|
||||
@@ -450,14 +450,14 @@ gnc_ui_account_get_tax_info_string (const Account *account)
|
||||
return NULL;
|
||||
|
||||
atype = xaccAccountGetType (account);
|
||||
if (atype != INCOME && atype != EXPENSE)
|
||||
if (atype != ACCT_TYPE_INCOME && atype != ACCT_TYPE_EXPENSE)
|
||||
return NULL;
|
||||
|
||||
code = xaccAccountGetTaxUSCode (account);
|
||||
if (!code)
|
||||
return NULL;
|
||||
|
||||
category = scm_c_eval_string (atype == INCOME ?
|
||||
category = scm_c_eval_string (atype == ACCT_TYPE_INCOME ?
|
||||
"txf-income-categories" :
|
||||
"txf-expense-categories");
|
||||
|
||||
@@ -592,7 +592,7 @@ gnc_find_or_create_equity_account (AccountGroup *group,
|
||||
base_name = equity_base_name (equity_type);
|
||||
|
||||
account = xaccGetAccountFromName (group, base_name);
|
||||
if (account && xaccAccountGetType (account) != EQUITY)
|
||||
if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
|
||||
account = NULL;
|
||||
|
||||
if (!account)
|
||||
@@ -600,7 +600,7 @@ gnc_find_or_create_equity_account (AccountGroup *group,
|
||||
base_name = base_name && *base_name ? _(base_name) : "";
|
||||
|
||||
account = xaccGetAccountFromName (group, base_name);
|
||||
if (account && xaccAccountGetType (account) != EQUITY)
|
||||
if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
|
||||
account = NULL;
|
||||
}
|
||||
|
||||
@@ -613,7 +613,7 @@ gnc_find_or_create_equity_account (AccountGroup *group,
|
||||
name = g_strconcat (base_name, " - ",
|
||||
gnc_commodity_get_mnemonic (currency), NULL);
|
||||
account = xaccGetAccountFromName (group, name);
|
||||
if (account && xaccAccountGetType (account) != EQUITY)
|
||||
if (account && xaccAccountGetType (account) != ACCT_TYPE_EQUITY)
|
||||
account = NULL;
|
||||
|
||||
name_exists = (account != NULL);
|
||||
@@ -638,7 +638,7 @@ gnc_find_or_create_equity_account (AccountGroup *group,
|
||||
}
|
||||
|
||||
parent = xaccGetAccountFromName (group, _("Equity"));
|
||||
if (parent && xaccAccountGetType (parent) != EQUITY)
|
||||
if (parent && xaccAccountGetType (parent) != ACCT_TYPE_EQUITY)
|
||||
parent = NULL;
|
||||
|
||||
account = xaccMallocAccount (book);
|
||||
@@ -646,7 +646,7 @@ gnc_find_or_create_equity_account (AccountGroup *group,
|
||||
xaccAccountBeginEdit (account);
|
||||
|
||||
xaccAccountSetName (account, name);
|
||||
xaccAccountSetType (account, EQUITY);
|
||||
xaccAccountSetType (account, ACCT_TYPE_EQUITY);
|
||||
xaccAccountSetCommodity (account, currency);
|
||||
|
||||
if (parent)
|
||||
|
||||
@@ -1098,8 +1098,8 @@ gnc_get_debit_string(GNCAccountType account_type)
|
||||
if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL))
|
||||
return g_strdup(_("Debit"));
|
||||
|
||||
if ((account_type < NO_TYPE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = NO_TYPE;
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = ACCT_TYPE_NONE;
|
||||
|
||||
type_string = xaccAccountTypeEnumAsString(account_type);
|
||||
|
||||
@@ -1136,8 +1136,8 @@ gnc_get_credit_string(GNCAccountType account_type)
|
||||
if (gnc_gconf_get_bool(GCONF_GENERAL, KEY_ACCOUNTING_LABELS, NULL))
|
||||
return g_strdup(_("Credit"));
|
||||
|
||||
if ((account_type < NO_TYPE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = NO_TYPE;
|
||||
if ((account_type < ACCT_TYPE_NONE) || (account_type >= NUM_ACCOUNT_TYPES))
|
||||
account_type = ACCT_TYPE_NONE;
|
||||
|
||||
type_string = xaccAccountTypeEnumAsString(account_type);
|
||||
|
||||
|
||||
@@ -64,36 +64,36 @@
|
||||
;;;;;; Create config vars
|
||||
|
||||
(define gnc:*debit-strings*
|
||||
(list (cons 'NO_TYPE (N_ "Funds In"))
|
||||
(cons 'BANK (N_ "Deposit"))
|
||||
(cons 'CASH (N_ "Receive"))
|
||||
(cons 'CREDIT (N_ "Payment"))
|
||||
(cons 'ASSET (N_ "Increase"))
|
||||
(cons 'LIABILITY (N_ "Decrease"))
|
||||
(cons 'STOCK (N_ "Buy"))
|
||||
(cons 'MUTUAL (N_ "Buy"))
|
||||
(cons 'CURRENCY (N_ "Buy"))
|
||||
(cons 'INCOME (N_ "Charge"))
|
||||
(cons 'EXPENSE (N_ "Expense"))
|
||||
(cons 'PAYABLE (N_ "Payment"))
|
||||
(cons 'RECEIVABLE (N_ "Invoice"))
|
||||
(cons 'EQUITY (N_ "Decrease"))))
|
||||
(list (cons 'ACCT_TYPE_NONE (N_ "Funds In"))
|
||||
(cons 'ACCT_TYPE_BANK (N_ "Deposit"))
|
||||
(cons 'ACCT_TYPE_CASH (N_ "Receive"))
|
||||
(cons 'ACCT_TYPE_CREDIT (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_ASSET (N_ "Increase"))
|
||||
(cons 'ACCT_TYPE_LIABILITY (N_ "Decrease"))
|
||||
(cons 'ACCT_TYPE_STOCK (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_MUTUAL (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_CURRENCY (N_ "Buy"))
|
||||
(cons 'ACCT_TYPE_INCOME (N_ "Charge"))
|
||||
(cons 'ACCT_TYPE_EXPENSE (N_ "Expense"))
|
||||
(cons 'ACCT_TYPE_PAYABLE (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_RECEIVABLE (N_ "Invoice"))
|
||||
(cons 'ACCT_TYPE_EQUITY (N_ "Decrease"))))
|
||||
|
||||
(define gnc:*credit-strings*
|
||||
(list (cons 'NO_TYPE (N_ "Funds Out"))
|
||||
(cons 'BANK (N_ "Withdrawal"))
|
||||
(cons 'CASH (N_ "Spend"))
|
||||
(cons 'CREDIT (N_ "Charge"))
|
||||
(cons 'ASSET (N_ "Decrease"))
|
||||
(cons 'LIABILITY (N_ "Increase"))
|
||||
(cons 'STOCK (N_ "Sell"))
|
||||
(cons 'MUTUAL (N_ "Sell"))
|
||||
(cons 'CURRENCY (N_ "Sell"))
|
||||
(cons 'INCOME (N_ "Income"))
|
||||
(cons 'EXPENSE (N_ "Rebate"))
|
||||
(cons 'PAYABLE (N_ "Bill"))
|
||||
(cons 'RECEIVABLE (N_ "Payment"))
|
||||
(cons 'EQUITY (N_ "Increase"))))
|
||||
(list (cons 'ACCT_TYPE_NONE (N_ "Funds Out"))
|
||||
(cons 'ACCT_TYPE_BANK (N_ "Withdrawal"))
|
||||
(cons 'ACCT_TYPE_CASH (N_ "Spend"))
|
||||
(cons 'ACCT_TYPE_CREDIT (N_ "Charge"))
|
||||
(cons 'ACCT_TYPE_ASSET (N_ "Decrease"))
|
||||
(cons 'ACCT_TYPE_LIABILITY (N_ "Increase"))
|
||||
(cons 'ACCT_TYPE_STOCK (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_MUTUAL (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_CURRENCY (N_ "Sell"))
|
||||
(cons 'ACCT_TYPE_INCOME (N_ "Income"))
|
||||
(cons 'ACCT_TYPE_EXPENSE (N_ "Rebate"))
|
||||
(cons 'ACCT_TYPE_PAYABLE (N_ "Bill"))
|
||||
(cons 'ACCT_TYPE_RECEIVABLE (N_ "Payment"))
|
||||
(cons 'ACCT_TYPE_EQUITY (N_ "Increase"))))
|
||||
|
||||
(define (gnc:get-debit-string type)
|
||||
(_ (assoc-ref gnc:*debit-strings* type)))
|
||||
|
||||
@@ -129,7 +129,8 @@ gnc_account_dom_tree_create(Account *act, gboolean exporting)
|
||||
|
||||
com = xaccAccountGetCommodity(act);
|
||||
if (com &&
|
||||
(!gnc_commodity_is_iso(com) || xaccAccountGetType(act) == CURRENCY) &&
|
||||
(!gnc_commodity_is_iso(com) ||
|
||||
xaccAccountGetType(act) == ACCT_TYPE_CURRENCY) &&
|
||||
gnc_commodity_get_quote_flag(com)) {
|
||||
if (!kvpnode)
|
||||
kvpnode= xmlNewNode(NULL, BAD_CAST act_slots_string);
|
||||
|
||||
@@ -675,21 +675,21 @@ readAccount( QofBook *book, int fd, AccountGroup *grp, int token )
|
||||
err = read( fd, &(ff_acctype), sizeof(char) );
|
||||
if( err != sizeof(char) ) { return NULL; }
|
||||
switch (ff_acctype) {
|
||||
case FF_BANK: { acctype = BANK; break; }
|
||||
case FF_CASH: { acctype = CASH; break; }
|
||||
case FF_ASSET: { acctype = ASSET; break; }
|
||||
case FF_CREDIT: { acctype = CREDIT; break; }
|
||||
case FF_LIABILITY: { acctype = LIABILITY; break; }
|
||||
case FF_STOCK: { acctype = STOCK; break; }
|
||||
case FF_MUTUAL: { acctype = MUTUAL; break; }
|
||||
case FF_INCOME: { acctype = INCOME; break; }
|
||||
case FF_EXPENSE: { acctype = EXPENSE; break; }
|
||||
case FF_EQUITY: { acctype = EQUITY; break; }
|
||||
case FF_CHECKING: { acctype = CHECKING; break; }
|
||||
case FF_SAVINGS: { acctype = SAVINGS; break; }
|
||||
case FF_MONEYMRKT: { acctype = MONEYMRKT; break; }
|
||||
case FF_CREDITLINE: { acctype = CREDITLINE; break; }
|
||||
case FF_CURRENCY: { acctype = CURRENCY; break; }
|
||||
case FF_BANK: { acctype = ACCT_TYPE_BANK; break; }
|
||||
case FF_CASH: { acctype = ACCT_TYPE_CASH; break; }
|
||||
case FF_ASSET: { acctype = ACCT_TYPE_ASSET; break; }
|
||||
case FF_CREDIT: { acctype = ACCT_TYPE_CREDIT; break; }
|
||||
case FF_LIABILITY: { acctype = ACCT_TYPE_LIABILITY; break; }
|
||||
case FF_STOCK: { acctype = ACCT_TYPE_STOCK; break; }
|
||||
case FF_MUTUAL: { acctype = ACCT_TYPE_MUTUAL; break; }
|
||||
case FF_INCOME: { acctype = ACCT_TYPE_INCOME; break; }
|
||||
case FF_EXPENSE: { acctype = ACCT_TYPE_EXPENSE; break; }
|
||||
case FF_EQUITY: { acctype = ACCT_TYPE_EQUITY; break; }
|
||||
case FF_CHECKING: { acctype = ACCT_TYPE_CHECKING; break; }
|
||||
case FF_SAVINGS: { acctype = ACCT_TYPE_SAVINGS; break; }
|
||||
case FF_MONEYMRKT: { acctype = ACCT_TYPE_MONEYMRKT; break; }
|
||||
case FF_CREDITLINE: { acctype = ACCT_TYPE_CREDITLINE; break; }
|
||||
case FF_CURRENCY: { acctype = ACCT_TYPE_CURRENCY; break; }
|
||||
default: return NULL;
|
||||
}
|
||||
xaccAccountSetType (acc, acctype);
|
||||
@@ -872,7 +872,7 @@ readAccInfo(int fd, Account *acc, int token) {
|
||||
if(!acc) return(FALSE);
|
||||
|
||||
acc_type = xaccAccountGetType(acc);
|
||||
if ((acc_type == STOCK) || (acc_type == MUTUAL)) {
|
||||
if ((acc_type == ACCT_TYPE_STOCK) || (acc_type == ACCT_TYPE_MUTUAL)) {
|
||||
const char *tmp = readString( fd, token );
|
||||
if(NULL == tmp) return(FALSE);
|
||||
if(strlen(tmp) > 0) dxaccAccountSetPriceSrc(acc, tmp);
|
||||
|
||||
@@ -357,13 +357,13 @@ gnc_business_account_types (GncOwner *owner)
|
||||
|
||||
switch (gncOwnerGetType (owner)) {
|
||||
case GNC_OWNER_CUSTOMER:
|
||||
return (g_list_prepend (NULL, (gpointer)RECEIVABLE));
|
||||
return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_RECEIVABLE));
|
||||
case GNC_OWNER_VENDOR:
|
||||
case GNC_OWNER_EMPLOYEE:
|
||||
return (g_list_prepend (NULL, (gpointer)PAYABLE));
|
||||
return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_PAYABLE));
|
||||
break;
|
||||
default:
|
||||
return (g_list_prepend (NULL, (gpointer)NO_TYPE));
|
||||
return (g_list_prepend (NULL, (gpointer)ACCT_TYPE_NONE));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -473,7 +473,7 @@ gnc_employee_new_window (GNCBook *bookp,
|
||||
ew->ccard_acct_check = glade_xml_get_widget (xml, "ccard_check");
|
||||
|
||||
edit = gnc_account_sel_new();
|
||||
acct_types = g_list_prepend(NULL, (gpointer)CREDIT);
|
||||
acct_types = g_list_prepend(NULL, (gpointer)ACCT_TYPE_CREDIT);
|
||||
gnc_account_sel_set_acct_filters (GNC_ACCOUNT_SEL(edit), acct_types);
|
||||
g_list_free (acct_types);
|
||||
|
||||
|
||||
@@ -320,11 +320,11 @@ gnc_payment_set_account_types (GncTreeViewAccount *tree)
|
||||
|
||||
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
|
||||
switch (i) {
|
||||
case BANK:
|
||||
case CASH:
|
||||
case CREDIT:
|
||||
case ASSET:
|
||||
case LIABILITY:
|
||||
case ACCT_TYPE_BANK:
|
||||
case ACCT_TYPE_CASH:
|
||||
case ACCT_TYPE_CREDIT:
|
||||
case ACCT_TYPE_ASSET:
|
||||
case ACCT_TYPE_LIABILITY:
|
||||
avi.include_type[i] = TRUE;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -922,25 +922,25 @@ gnc_plugin_business_cmd_test_init_data (GtkAction *action,
|
||||
gncOwnerInitJob(owner, job);
|
||||
|
||||
// Create the A/R account
|
||||
xaccAccountSetType(ar_acct, RECEIVABLE);
|
||||
xaccAccountSetType(ar_acct, ACCT_TYPE_RECEIVABLE);
|
||||
xaccAccountSetName(ar_acct, "A/R");
|
||||
xaccAccountSetCommodity(ar_acct, gnc_default_currency());
|
||||
xaccGroupInsertAccount(group, ar_acct);
|
||||
|
||||
// Create the Income account
|
||||
xaccAccountSetType(inc_acct, INCOME);
|
||||
xaccAccountSetType(inc_acct, ACCT_TYPE_INCOME);
|
||||
xaccAccountSetName(inc_acct, "Income");
|
||||
xaccAccountSetCommodity(inc_acct, gnc_default_currency());
|
||||
xaccGroupInsertAccount(group, inc_acct);
|
||||
|
||||
// Create the Bank account
|
||||
xaccAccountSetType(bank_acct, BANK);
|
||||
xaccAccountSetType(bank_acct, ACCT_TYPE_BANK);
|
||||
xaccAccountSetName(bank_acct, "Bank");
|
||||
xaccAccountSetCommodity(bank_acct, gnc_default_currency());
|
||||
xaccGroupInsertAccount(group, bank_acct);
|
||||
|
||||
// Create the Tax account
|
||||
xaccAccountSetType(tax_acct, LIABILITY);
|
||||
xaccAccountSetType(tax_acct, ACCT_TYPE_LIABILITY);
|
||||
xaccAccountSetName(tax_acct, "Tax-Holding");
|
||||
xaccAccountSetCommodity(tax_acct, gnc_default_currency());
|
||||
xaccGroupInsertAccount(group, tax_acct);
|
||||
|
||||
@@ -132,14 +132,15 @@ skip_expense_acct_cb (Account *account, gpointer user_data)
|
||||
|
||||
/* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
|
||||
type = xaccAccountGetType (account);
|
||||
if (type == PAYABLE || type == RECEIVABLE ||
|
||||
type == CASH || type == BANK || type == EQUITY)
|
||||
if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
|
||||
type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
|
||||
type == ACCT_TYPE_EQUITY)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If this is an ORDER or INVOICE, then leave out the expenses. */
|
||||
if (type == EXPENSE) return TRUE;
|
||||
if (type == ACCT_TYPE_EXPENSE) return TRUE;
|
||||
|
||||
/* Don't add placeholder accounts */
|
||||
if (xaccAccountGetPlaceholder (account)) return TRUE;
|
||||
@@ -154,14 +155,15 @@ skip_income_acct_cb (Account *account, gpointer user_data)
|
||||
|
||||
/* Don't add A/R, A/P, Bank, Cash, or Equity accounts */
|
||||
type = xaccAccountGetType (account);
|
||||
if (type == PAYABLE || type == RECEIVABLE ||
|
||||
type == CASH || type == BANK || type == EQUITY)
|
||||
if (type == ACCT_TYPE_PAYABLE || type == ACCT_TYPE_RECEIVABLE ||
|
||||
type == ACCT_TYPE_CASH || type == ACCT_TYPE_BANK ||
|
||||
type == ACCT_TYPE_EQUITY)
|
||||
{
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* If this is a BILL, then leave out the incomes */
|
||||
if (type == INCOME) return TRUE;
|
||||
if (type == ACCT_TYPE_INCOME) return TRUE;
|
||||
|
||||
/* Don't add placeholder accounts */
|
||||
if (xaccAccountGetPlaceholder (account)) return TRUE;
|
||||
|
||||
@@ -124,7 +124,7 @@ xaccInitAccount (Account * acc, QofBook *book)
|
||||
acc->starting_cleared_balance = gnc_numeric_zero();
|
||||
acc->starting_reconciled_balance = gnc_numeric_zero();
|
||||
|
||||
acc->type = NO_TYPE;
|
||||
acc->type = ACCT_TYPE_NONE;
|
||||
|
||||
acc->accountName = CACHE_INSERT("");
|
||||
acc->accountCode = CACHE_INSERT("");
|
||||
@@ -293,7 +293,7 @@ xaccFreeAccount (Account *acc)
|
||||
acc->cleared_balance = gnc_numeric_zero();
|
||||
acc->reconciled_balance = gnc_numeric_zero();
|
||||
|
||||
acc->type = NO_TYPE;
|
||||
acc->type = ACCT_TYPE_NONE;
|
||||
acc->commodity = NULL;
|
||||
|
||||
acc->version = 0;
|
||||
@@ -986,8 +986,10 @@ xaccAccountSetStartingBalance(Account *acc,
|
||||
* order for report generation */
|
||||
|
||||
static int typeorder[NUM_ACCOUNT_TYPES] = {
|
||||
BANK, STOCK, MUTUAL, CURRENCY, CASH, ASSET, RECEIVABLE,
|
||||
CREDIT, LIABILITY, PAYABLE, INCOME, EXPENSE, EQUITY };
|
||||
ACCT_TYPE_BANK, ACCT_TYPE_STOCK, ACCT_TYPE_MUTUAL, ACCT_TYPE_CURRENCY,
|
||||
ACCT_TYPE_CASH, ACCT_TYPE_ASSET, ACCT_TYPE_RECEIVABLE,
|
||||
ACCT_TYPE_CREDIT, ACCT_TYPE_LIABILITY, ACCT_TYPE_PAYABLE,
|
||||
ACCT_TYPE_INCOME, ACCT_TYPE_EXPENSE, ACCT_TYPE_EQUITY };
|
||||
|
||||
static int revorder[NUM_ACCOUNT_TYPES] = {
|
||||
-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 };
|
||||
@@ -1283,7 +1285,7 @@ xaccAccountGetDescendants (const Account *acc)
|
||||
GNCAccountType
|
||||
xaccAccountGetType (const Account *acc)
|
||||
{
|
||||
return acc ? acc->type : NO_TYPE;
|
||||
return acc ? acc->type : ACCT_TYPE_NONE;
|
||||
}
|
||||
|
||||
static const char*
|
||||
@@ -2044,14 +2046,14 @@ xaccAccountHasAncestor (const Account *acc, const Account * ancestor)
|
||||
/* You must edit the functions in this block in tandem. KEEP THEM IN
|
||||
SYNC! */
|
||||
|
||||
#define GNC_RETURN_ENUM_AS_STRING(x) case (x): return #x;
|
||||
#define GNC_RETURN_ENUM_AS_STRING(x) case (ACCT_TYPE_ ## x): return #x;
|
||||
|
||||
const char *
|
||||
xaccAccountTypeEnumAsString(GNCAccountType type)
|
||||
{
|
||||
switch(type)
|
||||
{
|
||||
GNC_RETURN_ENUM_AS_STRING(NO_TYPE);
|
||||
GNC_RETURN_ENUM_AS_STRING(NONE);
|
||||
GNC_RETURN_ENUM_AS_STRING(BANK);
|
||||
GNC_RETURN_ENUM_AS_STRING(CASH);
|
||||
GNC_RETURN_ENUM_AS_STRING(CREDIT);
|
||||
@@ -2079,13 +2081,13 @@ xaccAccountTypeEnumAsString(GNCAccountType type)
|
||||
#undef GNC_RETURN_ENUM_AS_STRING
|
||||
|
||||
#define GNC_RETURN_ON_MATCH(x) \
|
||||
if(safe_strcmp(#x, (str)) == 0) { *type = x; return(TRUE); }
|
||||
if(safe_strcmp(#x, (str)) == 0) { *type = ACCT_TYPE_ ## x; return(TRUE); }
|
||||
|
||||
gboolean
|
||||
xaccAccountStringToType(const char* str, GNCAccountType *type)
|
||||
{
|
||||
|
||||
GNC_RETURN_ON_MATCH(NO_TYPE);
|
||||
GNC_RETURN_ON_MATCH(NONE);
|
||||
GNC_RETURN_ON_MATCH(BANK);
|
||||
GNC_RETURN_ON_MATCH(CASH);
|
||||
GNC_RETURN_ON_MATCH(CREDIT);
|
||||
@@ -2119,7 +2121,7 @@ xaccAccountStringToEnum(const char* str)
|
||||
GNCAccountType type;
|
||||
gboolean rc;
|
||||
rc = xaccAccountStringToType(str, &type);
|
||||
if (FALSE == rc) return BAD_TYPE;
|
||||
if (FALSE == rc) return ACCT_TYPE_INVALID;
|
||||
return type;
|
||||
}
|
||||
|
||||
@@ -2169,7 +2171,7 @@ xaccAccountGetTypeFromStr (const gchar *str)
|
||||
PERR("asked to translate unknown account type string %s.\n",
|
||||
str ? str : "(null)");
|
||||
|
||||
return BAD_TYPE;
|
||||
return ACCT_TYPE_INVALID;
|
||||
}
|
||||
|
||||
|
||||
@@ -2184,34 +2186,34 @@ xaccAccountTypesCompatible (GNCAccountType parent_type,
|
||||
|
||||
switch(parent_type)
|
||||
{
|
||||
case BANK:
|
||||
case CASH:
|
||||
case ASSET:
|
||||
case STOCK:
|
||||
case MUTUAL:
|
||||
case CURRENCY:
|
||||
case CREDIT:
|
||||
case LIABILITY:
|
||||
case RECEIVABLE:
|
||||
case PAYABLE:
|
||||
compatible = ((child_type == BANK) ||
|
||||
(child_type == CASH) ||
|
||||
(child_type == ASSET) ||
|
||||
(child_type == STOCK) ||
|
||||
(child_type == MUTUAL) ||
|
||||
(child_type == CURRENCY) ||
|
||||
(child_type == CREDIT) ||
|
||||
(child_type == LIABILITY)||
|
||||
(child_type == RECEIVABLE)||
|
||||
(child_type == PAYABLE));
|
||||
case ACCT_TYPE_BANK:
|
||||
case ACCT_TYPE_CASH:
|
||||
case ACCT_TYPE_ASSET:
|
||||
case ACCT_TYPE_STOCK:
|
||||
case ACCT_TYPE_MUTUAL:
|
||||
case ACCT_TYPE_CURRENCY:
|
||||
case ACCT_TYPE_CREDIT:
|
||||
case ACCT_TYPE_LIABILITY:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
compatible = ((child_type == ACCT_TYPE_BANK) ||
|
||||
(child_type == ACCT_TYPE_CASH) ||
|
||||
(child_type == ACCT_TYPE_ASSET) ||
|
||||
(child_type == ACCT_TYPE_STOCK) ||
|
||||
(child_type == ACCT_TYPE_MUTUAL) ||
|
||||
(child_type == ACCT_TYPE_CURRENCY) ||
|
||||
(child_type == ACCT_TYPE_CREDIT) ||
|
||||
(child_type == ACCT_TYPE_LIABILITY)||
|
||||
(child_type == ACCT_TYPE_RECEIVABLE)||
|
||||
(child_type == ACCT_TYPE_PAYABLE));
|
||||
break;
|
||||
case INCOME:
|
||||
case EXPENSE:
|
||||
compatible = ((child_type == INCOME) ||
|
||||
(child_type == EXPENSE));
|
||||
case ACCT_TYPE_INCOME:
|
||||
case ACCT_TYPE_EXPENSE:
|
||||
compatible = ((child_type == ACCT_TYPE_INCOME) ||
|
||||
(child_type == ACCT_TYPE_EXPENSE));
|
||||
break;
|
||||
case EQUITY:
|
||||
compatible = (child_type == EQUITY);
|
||||
case ACCT_TYPE_EQUITY:
|
||||
compatible = (child_type == ACCT_TYPE_EQUITY);
|
||||
break;
|
||||
default:
|
||||
PERR("bad account type: %d", parent_type);
|
||||
@@ -2225,7 +2227,7 @@ guint32
|
||||
xaccAccountTypesValid(void)
|
||||
{
|
||||
guint32 mask = (1 << NUM_ACCOUNT_TYPES) - 1;
|
||||
mask &= ~(1 << CURRENCY); /* DEPRECATED */
|
||||
mask &= ~(1 << ACCT_TYPE_CURRENCY); /* DEPRECATED */
|
||||
|
||||
return mask;
|
||||
}
|
||||
@@ -2235,8 +2237,8 @@ xaccAccountIsPriced(const Account *acc)
|
||||
{
|
||||
if (!acc) return FALSE;
|
||||
|
||||
return (acc->type == STOCK || acc->type == MUTUAL ||
|
||||
acc->type == CURRENCY);
|
||||
return (acc->type == ACCT_TYPE_STOCK || acc->type == ACCT_TYPE_MUTUAL ||
|
||||
acc->type == ACCT_TYPE_CURRENCY);
|
||||
}
|
||||
|
||||
/********************************************************************\
|
||||
|
||||
@@ -72,49 +72,67 @@ typedef gnc_numeric (*xaccGetBalanceAsOfDateFn) (
|
||||
|
||||
typedef enum
|
||||
{
|
||||
BAD_TYPE = -1, /**< Not a type */
|
||||
NO_TYPE = -1,/**< Not a type */
|
||||
ACCT_TYPE_INVALID = -1, /**< Not a type */
|
||||
ACCT_TYPE_NONE = -1,/**< Not a type */
|
||||
|
||||
BANK = 0, /**< The bank account type denotes a savings or checking account
|
||||
* held at a bank. Often interest bearing. */
|
||||
CASH = 1,/**< The cash account type is used to denote a shoe-box or pillowcase
|
||||
* stuffed with cash. */
|
||||
CREDIT = 3, /**< The Credit card account is used to denote credit (e.g. amex)
|
||||
* and debit (e.g. visa, mastercard) card accounts */
|
||||
ASSET = 2, /**< asset (and liability) accounts indicate generic, generalized accounts
|
||||
* that are none of the above. */
|
||||
LIABILITY = 4, /**< liability (and asset) accounts indicate generic, generalized accounts
|
||||
* that are none of the above. */
|
||||
STOCK = 5, /**< Stock accounts will typically be shown in registers
|
||||
* which show three columns: price, number of shares, and value. */
|
||||
MUTUAL= 6, /**< Mutual Fund accounts will typically be shown in registers
|
||||
* which show three columns: price, number of shares, and value. */
|
||||
CURRENCY = 7, /**< The currency account type indicates that the
|
||||
* account is a currency trading account. In many
|
||||
* ways, a currency trading account is like a stock
|
||||
* trading account. It is shown in the register with
|
||||
* three columns: price, number of shares, and
|
||||
* value. Note: Since version 1.7.0, this account is
|
||||
* no longer needed to exchange currencies between
|
||||
* accounts, so this type is DEPRECATED. */
|
||||
INCOME = 8, /**< Income accounts are used to denote income */
|
||||
ACCT_TYPE_BANK = 0, /**< The bank account type denotes a savings
|
||||
* or checking account held at a bank.
|
||||
* Often * interest * bearing. */
|
||||
ACCT_TYPE_CASH = 1, /**< The cash account type is used to denote a
|
||||
* shoe-box or pillowcase stuffed with *
|
||||
* cash. */
|
||||
ACCT_TYPE_CREDIT = 3, /**< The Credit card account is used to denote
|
||||
* credit (e.g. amex) and debit (e.g. visa,
|
||||
* mastercard) * card accounts */
|
||||
ACCT_TYPE_ASSET = 2, /**< asset (and liability) accounts indicate
|
||||
* generic, generalized accounts that are
|
||||
* none of the * above. */
|
||||
ACCT_TYPE_LIABILITY = 4,/**< liability (and asset) accounts indicate
|
||||
* generic, generalized accounts that are
|
||||
* none of the * above. */
|
||||
ACCT_TYPE_STOCK = 5, /**< Stock accounts will typically be shown in
|
||||
* registers which show three columns:
|
||||
* price, number of * shares, and value. */
|
||||
ACCT_TYPE_MUTUAL= 6, /**< Mutual Fund accounts will typically be
|
||||
* shown in registers which show three
|
||||
* columns: price, * number of shares, and
|
||||
* value. */
|
||||
ACCT_TYPE_CURRENCY = 7,/**< The currency account type indicates that
|
||||
* the account is a currency trading
|
||||
* account. In many * ways, a currency
|
||||
* trading account is like a stock *
|
||||
* trading account. It is shown in the
|
||||
* register with * three columns: price,
|
||||
* number of shares, and * value. Note:
|
||||
* Since version 1.7.0, this account is *
|
||||
* no longer needed to exchange currencies
|
||||
* between * accounts, so this type is
|
||||
* DEPRECATED. */
|
||||
ACCT_TYPE_INCOME = 8, /**< Income accounts are used to denote
|
||||
* income */
|
||||
|
||||
EXPENSE = 9,/**< Expense accounts are used to denote expenses. */
|
||||
ACCT_TYPE_EXPENSE = 9,/**< Expense accounts are used to denote
|
||||
* expenses. */
|
||||
|
||||
EQUITY = 10,/**< Equity account is used to balance the balance sheet. */
|
||||
ACCT_TYPE_EQUITY = 10,/**< Equity account is used to balance the
|
||||
* balance sheet. */
|
||||
|
||||
RECEIVABLE = 11, /**< A/R account type */
|
||||
ACCT_TYPE_RECEIVABLE = 11,/**< A/R account type */
|
||||
|
||||
PAYABLE = 12, /**< A/P account type */
|
||||
ACCT_TYPE_PAYABLE = 12, /**< A/P account type */
|
||||
|
||||
NUM_ACCOUNT_TYPES = 13, /**< stop here; the following types
|
||||
* just aren't ready for prime time */
|
||||
|
||||
/* bank account types */
|
||||
CHECKING = 13, /**< bank account type -- don't use this for now, see NUM_ACCOUNT_TYPES */
|
||||
SAVINGS = 14, /**< bank account type -- don't use this for now, see NUM_ACCOUNT_TYPES */
|
||||
MONEYMRKT = 15, /**< bank account type -- don't use this for now, see NUM_ACCOUNT_TYPES */
|
||||
CREDITLINE = 16, /**< line of credit -- don't use this for now, see NUM_ACCOUNT_TYPES */
|
||||
ACCT_TYPE_CHECKING = 13, /**< bank account type -- don't use this
|
||||
* for now, see NUM_ACCOUNT_TYPES */
|
||||
ACCT_TYPE_SAVINGS = 14, /**< bank account type -- don't use this for
|
||||
* now, see NUM_ACCOUNT_TYPES */
|
||||
ACCT_TYPE_MONEYMRKT = 15, /**< bank account type -- don't use this
|
||||
* for now, see NUM_ACCOUNT_TYPES */
|
||||
ACCT_TYPE_CREDITLINE = 16, /**< line of credit -- don't use this for
|
||||
* now, see NUM_ACCOUNT_TYPES */
|
||||
} GNCAccountType;
|
||||
|
||||
|
||||
@@ -481,19 +499,19 @@ gboolean xaccAccountHasAncestor(const Account *acc, const Account *ancestor);
|
||||
* Conversion routines for the account types to/from strings
|
||||
* that are used in persistant storage, communications. These
|
||||
* strings should *not* be translated to the local language.
|
||||
* Typical converstion is INCOME -> "INCOME". */
|
||||
* Typical converstion is ACCT_TYPE_INCOME -> "INCOME". */
|
||||
const char * xaccAccountTypeEnumAsString (GNCAccountType type);
|
||||
/**
|
||||
* Conversion routines for the account types to/from strings
|
||||
* that are used in persistant storage, communications. These
|
||||
* strings should *not* be translated to the local language.
|
||||
* Typical converstion is INCOME -> "INCOME". */
|
||||
* Typical converstion is "INCOME" -> ACCT_TYPE_INCOME. */
|
||||
gboolean xaccAccountStringToType (const char* str, GNCAccountType *type);
|
||||
/**
|
||||
* Conversion routines for the account types to/from strings
|
||||
* that are used in persistant storage, communications. These
|
||||
* strings should *not* be translated to the local language.
|
||||
* Typical converstion is INCOME -> "INCOME". */
|
||||
* Typical converstion is "INCOME" -> ACCT_TYPE_INCOME. */
|
||||
GNCAccountType xaccAccountStringToEnum (const char* str);
|
||||
|
||||
/** The xaccAccountGetTypeStr() routine returns a string suitable for
|
||||
|
||||
@@ -78,10 +78,11 @@ struct account_s
|
||||
*/
|
||||
char *description;
|
||||
|
||||
/* The type field is the account type, picked from the enumerated
|
||||
* list that includes BANK, STOCK, CREDIT, INCOME, etc. Its
|
||||
* intended use is to be a hint to the GUI as to how to display
|
||||
* and format the transaction data.
|
||||
/* The type field is the account type, picked from the enumerated
|
||||
* list that includes ACCT_TYPE_BANK, ACCT_TYPE_STOCK,
|
||||
* ACCT_TYPE_CREDIT, ACCT_TYPE_INCOME, etc. Its intended use is to
|
||||
* be a hint to the GUI as to how to display and format the
|
||||
* transaction data.
|
||||
*/
|
||||
GNCAccountType type;
|
||||
|
||||
|
||||
@@ -624,7 +624,7 @@ find_nearest_equity_acct (Account *acc)
|
||||
for (node=acc_list; node; node=node->next)
|
||||
{
|
||||
candidate = (Account *) node->data;
|
||||
if ((EQUITY == xaccAccountGetType (candidate)) &&
|
||||
if ((ACCT_TYPE_EQUITY == xaccAccountGetType (candidate)) &&
|
||||
gnc_commodity_equiv(xaccAccountGetCommodity(acc),
|
||||
xaccAccountGetCommodity(candidate)))
|
||||
{
|
||||
@@ -647,8 +647,8 @@ find_nearest_equity_acct (Account *acc)
|
||||
candidate = xaccMallocAccount (xaccGroupGetBook(parent));
|
||||
xaccAccountBeginEdit (candidate);
|
||||
xaccGroupInsertAccount (parent, candidate);
|
||||
xaccAccountSetType (candidate, EQUITY);
|
||||
xaccAccountSetName (candidate, xaccAccountGetTypeStr(EQUITY));
|
||||
xaccAccountSetType (candidate, ACCT_TYPE_EQUITY);
|
||||
xaccAccountSetName (candidate, xaccAccountGetTypeStr(ACCT_TYPE_EQUITY));
|
||||
xaccAccountSetCommodity (candidate, xaccAccountGetCommodity(acc));
|
||||
xaccAccountCommitEdit (candidate);
|
||||
|
||||
@@ -710,7 +710,8 @@ add_closing_balances (AccountGroup *closed_grp,
|
||||
/* -------------------------------- */
|
||||
/* We need to carry a balance on any account that is not
|
||||
* and income or expense or equity account */
|
||||
if ((INCOME != tip) && (EXPENSE != tip) && (EQUITY != tip))
|
||||
if ((ACCT_TYPE_INCOME != tip) && (ACCT_TYPE_EXPENSE != tip) &&
|
||||
(ACCT_TYPE_EQUITY != tip))
|
||||
{
|
||||
gnc_numeric baln;
|
||||
baln = xaccAccountGetBalance (candidate);
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
* balances will be placed. This argument may be NULL,
|
||||
* if it is NULL, then a search algorithm will be used to
|
||||
* find a suitable equity account. If NULL, this routine
|
||||
* searches for the 'nearest' account of GNCAccountType EQUITY
|
||||
* searches for the 'nearest' account of GNCAccountType ACCT_TYPE_EQUITY
|
||||
* among its siblings, or the siblings of its parents. It
|
||||
* does not search downwards. If it does not find such an
|
||||
* account, it will create one, hanging off the top-most group.
|
||||
|
||||
@@ -78,7 +78,7 @@ xaccSchedXactionInit(SchedXaction *sx, QofBook *book)
|
||||
gnc_commodity_new( book,
|
||||
"template", "template",
|
||||
"template", "template", 1 ) );
|
||||
xaccAccountSetType( sx->template_acct, BANK );
|
||||
xaccAccountSetType( sx->template_acct, ACCT_TYPE_BANK );
|
||||
ag = gnc_book_get_template_group( book );
|
||||
xaccGroupInsertAccount( ag, sx->template_acct );
|
||||
}
|
||||
|
||||
@@ -902,7 +902,7 @@ xaccScrubUtilityGetOrMakeAccount (AccountGroup *root, gnc_commodity * currency,
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountSetName (acc, accname);
|
||||
xaccAccountSetCommodity (acc, currency);
|
||||
xaccAccountSetType (acc, BANK);
|
||||
xaccAccountSetType (acc, ACCT_TYPE_BANK);
|
||||
|
||||
/* Hang the account off the root. */
|
||||
xaccGroupInsertAccount (root, acc);
|
||||
|
||||
@@ -247,7 +247,7 @@ GetOrMakeLotOrphanAccount (AccountGroup *root, gnc_commodity * currency)
|
||||
xaccAccountBeginEdit (acc);
|
||||
xaccAccountSetName (acc, accname);
|
||||
xaccAccountSetCommodity (acc, currency);
|
||||
xaccAccountSetType (acc, INCOME);
|
||||
xaccAccountSetType (acc, ACCT_TYPE_INCOME);
|
||||
xaccAccountSetDescription (acc, _("Realized Gain/Loss"));
|
||||
xaccAccountSetNotes (acc,
|
||||
_("Realized Gains or Losses from "
|
||||
|
||||
@@ -150,7 +150,8 @@ make_kvpd_on_list(GList *account_list)
|
||||
|
||||
current_account = iter->data;
|
||||
type = xaccAccountGetType(current_account);
|
||||
g_return_val_if_fail(type == INCOME || type == EXPENSE, NULL);
|
||||
g_return_val_if_fail(type == ACCT_TYPE_INCOME || type == ACCT_TYPE_EXPENSE,
|
||||
NULL);
|
||||
|
||||
acc_id = xaccAccountGetGUID(current_account);
|
||||
guid_kvp = kvp_value_new_guid(acc_id);
|
||||
@@ -423,7 +424,7 @@ gnc_tracking_dissociate_account(Account *inc_or_expense_account)
|
||||
|
||||
type = xaccAccountGetType(inc_or_expense_account);
|
||||
|
||||
g_return_if_fail(type == INCOME || type == EXPENSE);
|
||||
g_return_if_fail(type == ACCT_TYPE_INCOME || type == ACCT_TYPE_EXPENSE);
|
||||
|
||||
current_account_kvpframe = xaccAccountGetSlots(inc_or_expense_account);
|
||||
|
||||
|
||||
@@ -191,26 +191,26 @@
|
||||
|
||||
(let ((we (gw:wrap-enumeration ws '<gnc:AccountType> "GNCAccountType")))
|
||||
;; From Account.h
|
||||
(gw:enum-add-value! we "BAD_TYPE" 'bad-type)
|
||||
(gw:enum-add-value! we "NO_TYPE" 'no-type)
|
||||
(gw:enum-add-value! we "BANK" 'bank)
|
||||
(gw:enum-add-value! we "CASH" 'cash)
|
||||
(gw:enum-add-value! we "CREDIT" 'credit)
|
||||
(gw:enum-add-value! we "ASSET" 'asset)
|
||||
(gw:enum-add-value! we "LIABILITY" 'liability)
|
||||
(gw:enum-add-value! we "STOCK" 'stock)
|
||||
(gw:enum-add-value! we "MUTUAL" 'mutual-fund)
|
||||
(gw:enum-add-value! we "CURRENCY" 'currency)
|
||||
(gw:enum-add-value! we "INCOME" 'income)
|
||||
(gw:enum-add-value! we "EXPENSE" 'expense)
|
||||
(gw:enum-add-value! we "EQUITY" 'equity)
|
||||
(gw:enum-add-value! we "RECEIVABLE" 'receivable)
|
||||
(gw:enum-add-value! we "PAYABLE" 'payable)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_INVALID" 'bad-type)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_NONE" 'no-type)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_BANK" 'bank)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_CASH" 'cash)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_CREDIT" 'credit)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_ASSET" 'asset)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_LIABILITY" 'liability)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_STOCK" 'stock)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_MUTUAL" 'mutual-fund)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_CURRENCY" 'currency)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_INCOME" 'income)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_EXPENSE" 'expense)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_EQUITY" 'equity)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_RECEIVABLE" 'receivable)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_PAYABLE" 'payable)
|
||||
(gw:enum-add-value! we "NUM_ACCOUNT_TYPES" 'num-account-types)
|
||||
(gw:enum-add-value! we "CHECKING" 'checking)
|
||||
(gw:enum-add-value! we "SAVINGS" 'savings)
|
||||
(gw:enum-add-value! we "MONEYMRKT" 'money-market)
|
||||
(gw:enum-add-value! we "CREDITLINE" 'credit-line)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_CHECKING" 'checking)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_SAVINGS" 'savings)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_MONEYMRKT" 'money-market)
|
||||
(gw:enum-add-value! we "ACCT_TYPE_CREDITLINE" 'credit-line)
|
||||
#t)
|
||||
|
||||
(let ((we (gw:wrap-enumeration ws '<gnc:BackendError> "QofBackendError")))
|
||||
|
||||
@@ -1214,7 +1214,7 @@ get_random_account(QofBook *book)
|
||||
set_account_random_string_from_array(ret, xaccAccountSetName,
|
||||
sane_account_names);
|
||||
|
||||
tmp_int = get_random_int_in_range(BANK, NUM_ACCOUNT_TYPES - 1);
|
||||
tmp_int = get_random_int_in_range(ACCT_TYPE_BANK, NUM_ACCOUNT_TYPES - 1);
|
||||
xaccAccountSetType(ret, tmp_int);
|
||||
|
||||
set_account_random_string(ret, xaccAccountSetCode);
|
||||
@@ -1247,7 +1247,7 @@ make_random_changes_to_account (QofBook *book, Account *account)
|
||||
|
||||
set_account_random_string (account, xaccAccountSetName);
|
||||
|
||||
tmp_int = get_random_int_in_range (BANK, CREDITLINE);
|
||||
tmp_int = get_random_int_in_range (ACCT_TYPE_BANK, ACCT_TYPE_CREDITLINE);
|
||||
xaccAccountSetType (account, tmp_int);
|
||||
|
||||
set_account_random_string (account, xaccAccountSetCode);
|
||||
|
||||
@@ -129,7 +129,7 @@ typedef struct _RenumberDialog
|
||||
/** Static Globals *******************************************************/
|
||||
static QofLogModule log_module = GNC_MOD_GUI;
|
||||
|
||||
static int last_used_account_type = BANK;
|
||||
static int last_used_account_type = ACCT_TYPE_BANK;
|
||||
|
||||
static GList *ac_destroy_cb_list = NULL;
|
||||
|
||||
@@ -169,7 +169,7 @@ gnc_account_commodity_from_type (AccountWindow * aw, gboolean update)
|
||||
{
|
||||
dialog_commodity_mode new_mode;
|
||||
|
||||
if ((aw->type == STOCK) || (aw->type == MUTUAL))
|
||||
if ((aw->type == ACCT_TYPE_STOCK) || (aw->type == ACCT_TYPE_MUTUAL))
|
||||
new_mode = DIAG_COMM_NON_CURRENCY;
|
||||
else
|
||||
new_mode = DIAG_COMM_CURRENCY;
|
||||
@@ -803,7 +803,7 @@ gnc_common_ok (AccountWindow *aw)
|
||||
}
|
||||
|
||||
/* check for valid type */
|
||||
if (aw->type == BAD_TYPE) {
|
||||
if (aw->type == ACCT_TYPE_INVALID) {
|
||||
const char *message = _("You must select an account type.");
|
||||
gnc_error_dialog(aw->dialog, message);
|
||||
LEAVE("invalid type");
|
||||
@@ -1121,18 +1121,18 @@ gnc_account_type_changed_cb (GtkTreeSelection *selection, gpointer data)
|
||||
sensitive = FALSE;
|
||||
|
||||
type_id = gnc_tree_model_account_types_get_selection_single(selection);
|
||||
if (type_id == NO_TYPE) {
|
||||
aw->type = BAD_TYPE;
|
||||
if (type_id == ACCT_TYPE_NONE) {
|
||||
aw->type = ACCT_TYPE_INVALID;
|
||||
} else {
|
||||
aw->type = type_id;
|
||||
last_used_account_type = type_id;
|
||||
|
||||
gnc_account_commodity_from_type (aw, TRUE);
|
||||
|
||||
sensitive = (aw->type != EQUITY &&
|
||||
aw->type != CURRENCY &&
|
||||
aw->type != STOCK &&
|
||||
aw->type != MUTUAL);
|
||||
sensitive = (aw->type != ACCT_TYPE_EQUITY &&
|
||||
aw->type != ACCT_TYPE_CURRENCY &&
|
||||
aw->type != ACCT_TYPE_STOCK &&
|
||||
aw->type != ACCT_TYPE_MUTUAL);
|
||||
}
|
||||
|
||||
gtk_widget_set_sensitive (aw->opening_balance_page, sensitive);
|
||||
@@ -1557,7 +1557,7 @@ gnc_ui_new_account_window_internal (Account *base_account,
|
||||
|
||||
if (default_commodity != NULL) {
|
||||
commodity = default_commodity;
|
||||
} else if ((aw->type != STOCK) && (aw->type != MUTUAL)) {
|
||||
} else if ((aw->type != ACCT_TYPE_STOCK) && (aw->type != ACCT_TYPE_MUTUAL)) {
|
||||
commodity = parent_commodity;
|
||||
} else {
|
||||
commodity = NULL;
|
||||
|
||||
@@ -437,7 +437,7 @@ gnc_xfer_dialog_show_inc_exp_visible_cb (Account *account,
|
||||
}
|
||||
|
||||
type = xaccAccountGetType(account);
|
||||
return ((type != INCOME) && (type != EXPENSE));
|
||||
return ((type != ACCT_TYPE_INCOME) && (type != ACCT_TYPE_EXPENSE));
|
||||
}
|
||||
|
||||
static void
|
||||
@@ -638,7 +638,7 @@ gnc_xfer_dialog_quickfill( XferDialog *xferData )
|
||||
/* Don't want to deactivate the button just because this
|
||||
* isn't an income or expense account
|
||||
*/
|
||||
if( (other_type == EXPENSE) || (other_type == INCOME) )
|
||||
if( (other_type == ACCT_TYPE_EXPENSE) || (other_type == ACCT_TYPE_INCOME) )
|
||||
gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(other_button), TRUE);
|
||||
|
||||
gnc_transfer_dialog_set_selected_account (xferData, other_acct, xferData->quickfill);
|
||||
@@ -2138,7 +2138,8 @@ gnc_transfer_dialog_set_selected_account (XferDialog *dialog,
|
||||
|
||||
type = xaccAccountGetType (account);
|
||||
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (show_button),
|
||||
(type == EXPENSE) || (type == INCOME));
|
||||
(type == ACCT_TYPE_EXPENSE) ||
|
||||
(type == ACCT_TYPE_INCOME));
|
||||
|
||||
gnc_tree_view_account_set_selected_account (GNC_TREE_VIEW_ACCOUNT (tree_view),
|
||||
account);
|
||||
|
||||
@@ -252,7 +252,7 @@ gnc_tree_model_account_types_get_selection_single(GtkTreeSelection *sel)
|
||||
for (i = 0; i < NUM_ACCOUNT_TYPES; i++)
|
||||
if (selected & (1 << i))
|
||||
return i;
|
||||
return NO_TYPE;
|
||||
return ACCT_TYPE_NONE;
|
||||
}
|
||||
|
||||
void
|
||||
@@ -334,7 +334,7 @@ gnc_tree_model_account_types_get_iter (GtkTreeModel * tree_model,
|
||||
|
||||
i = gtk_tree_path_get_indices (path)[0];
|
||||
|
||||
if (i > NO_TYPE && i < NUM_ACCOUNT_TYPES) {
|
||||
if (i > ACCT_TYPE_NONE && i < NUM_ACCOUNT_TYPES) {
|
||||
iter->stamp = model->stamp;
|
||||
iter->user_data = GINT_TO_POINTER (i);
|
||||
return TRUE;
|
||||
@@ -468,7 +468,7 @@ gnc_tree_model_account_types_iter_nth_child (GtkTreeModel * tree_model,
|
||||
|
||||
model = GNC_TREE_MODEL_ACCOUNT_TYPES (tree_model);
|
||||
|
||||
if (n > NO_TYPE && n < NUM_ACCOUNT_TYPES) {
|
||||
if (n > ACCT_TYPE_NONE && n < NUM_ACCOUNT_TYPES) {
|
||||
iter->stamp = model->stamp;
|
||||
iter->user_data = GINT_TO_POINTER (n);
|
||||
return TRUE;
|
||||
|
||||
@@ -121,8 +121,8 @@ guint32 gnc_tree_model_account_types_get_selection(GtkTreeSelection *sel);
|
||||
|
||||
/* Gets the selected account type. Use the function if your view
|
||||
allows the selection of only one account type. If no types are
|
||||
selected, returns NO_TYPE. If more than one type is selected,
|
||||
arbitrarily returns one of the selected types. */
|
||||
selected, returns ACCT_TYPE_NONE. If more than one type is
|
||||
selected, arbitrarily returns one of the selected types. */
|
||||
GNCAccountType
|
||||
gnc_tree_model_account_types_get_selection_single(GtkTreeSelection *sel);
|
||||
|
||||
|
||||
@@ -507,7 +507,7 @@ gnc_tree_view_account_new_with_group (AccountGroup *group, gboolean show_root)
|
||||
/* Set default visibilities */
|
||||
gtk_tree_view_set_headers_visible (GTK_TREE_VIEW(view), FALSE);
|
||||
|
||||
sample_type = xaccAccountGetTypeStr(CREDIT);
|
||||
sample_type = xaccAccountGetTypeStr(ACCT_TYPE_CREDIT);
|
||||
sample_commodity = gnc_commodity_get_fullname(gnc_default_currency());
|
||||
|
||||
priv->name_column
|
||||
|
||||
@@ -181,15 +181,15 @@ gnc_ui_accounts_recurse (AccountGroup *group, GList **currency_list,
|
||||
|
||||
switch (account_type)
|
||||
{
|
||||
case BANK:
|
||||
case CASH:
|
||||
case ASSET:
|
||||
case STOCK:
|
||||
case MUTUAL:
|
||||
case CREDIT:
|
||||
case LIABILITY:
|
||||
case PAYABLE:
|
||||
case RECEIVABLE:
|
||||
case ACCT_TYPE_BANK:
|
||||
case ACCT_TYPE_CASH:
|
||||
case ACCT_TYPE_ASSET:
|
||||
case ACCT_TYPE_STOCK:
|
||||
case ACCT_TYPE_MUTUAL:
|
||||
case ACCT_TYPE_CREDIT:
|
||||
case ACCT_TYPE_LIABILITY:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
end_amount = xaccAccountGetBalanceAsOfDate(account, options.end_date);
|
||||
timespecFromTime_t(&end_timespec, options.end_date);
|
||||
end_amount_default_currency =
|
||||
@@ -229,8 +229,8 @@ gnc_ui_accounts_recurse (AccountGroup *group, GList **currency_list,
|
||||
if (children != NULL)
|
||||
gnc_ui_accounts_recurse(children, currency_list, options);
|
||||
break;
|
||||
case INCOME:
|
||||
case EXPENSE:
|
||||
case ACCT_TYPE_INCOME:
|
||||
case ACCT_TYPE_EXPENSE:
|
||||
start_amount = xaccAccountGetBalanceAsOfDate(account, options.start_date);
|
||||
timespecFromTime_t(&start_timespec, options.start_date);
|
||||
start_amount_default_currency =
|
||||
@@ -295,10 +295,10 @@ gnc_ui_accounts_recurse (AccountGroup *group, GList **currency_list,
|
||||
if (children != NULL)
|
||||
gnc_ui_accounts_recurse(children, currency_list, options);
|
||||
break;
|
||||
case EQUITY:
|
||||
case ACCT_TYPE_EQUITY:
|
||||
/* no-op, see comments at top about summing assets */
|
||||
break;
|
||||
case CURRENCY:
|
||||
case ACCT_TYPE_CURRENCY:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ chart_collection_cb(QofEntity *ent, gpointer user_data)
|
||||
data = (chart_data*)user_data;
|
||||
acc = (Account*)ent;
|
||||
if(0 == safe_strcmp(EQUITY_ACCOUNT_NAME, xaccAccountGetName(acc))
|
||||
&& (xaccAccountGetType(acc) == EQUITY))
|
||||
&& (xaccAccountGetType(acc) == ACCT_TYPE_EQUITY))
|
||||
{
|
||||
success = qof_entity_copy_to_session(data->chart_session, ent);
|
||||
if(!success) { return; }
|
||||
@@ -248,7 +248,7 @@ on_dateok_clicked (chart_data *data)
|
||||
xaccAccountBeginEdit (data->equity_account);
|
||||
xaccAccountSetName (data->equity_account, EQUITY_ACCOUNT_NAME);
|
||||
xaccAccountSetDescription(data->equity_account, EQUITY_ACCOUNT_NAME);
|
||||
xaccAccountSetType (data->equity_account, EQUITY);
|
||||
xaccAccountSetType (data->equity_account, ACCT_TYPE_EQUITY);
|
||||
xaccAccountSetCommodity (data->equity_account, gnc_default_currency());
|
||||
}
|
||||
qof_object_foreach(GNC_ID_ACCOUNT, book, chart_entity_cb, data);
|
||||
|
||||
@@ -474,7 +474,7 @@ tax_info_show_income_accounts (TaxInfoDialog *ti_dialog, gboolean show_income)
|
||||
ti_dialog->income = show_income;
|
||||
|
||||
tree = GNC_TREE_VIEW_ACCOUNT (ti_dialog->account_treeview);
|
||||
show_type = show_income ? INCOME : EXPENSE;
|
||||
show_type = show_income ? ACCT_TYPE_INCOME : ACCT_TYPE_EXPENSE;
|
||||
|
||||
gnc_tree_view_account_get_view_info (tree, &info);
|
||||
|
||||
@@ -523,7 +523,7 @@ gnc_tax_info_income_cb (GtkWidget *w, gpointer data)
|
||||
|
||||
tax_info_show_income_accounts (ti_dialog, show_income);
|
||||
|
||||
ti_dialog->account_type = show_income ? INCOME : EXPENSE;
|
||||
ti_dialog->account_type = show_income ? ACCT_TYPE_INCOME : ACCT_TYPE_EXPENSE;
|
||||
gnc_tree_view_account_refilter (GNC_TREE_VIEW_ACCOUNT (ti_dialog->account_treeview));
|
||||
|
||||
gnc_tax_info_update_accounts (ti_dialog);
|
||||
@@ -670,7 +670,7 @@ gnc_tax_info_dialog_create (GtkWidget * parent, TaxInfoDialog *ti_dialog)
|
||||
ti_dialog->dialog = dialog;
|
||||
tido = GTK_OBJECT (dialog);
|
||||
|
||||
ti_dialog->account_type = EXPENSE;
|
||||
ti_dialog->account_type = ACCT_TYPE_EXPENSE;
|
||||
ti_dialog->income_txf_infos = load_txf_info (TRUE);
|
||||
ti_dialog->expense_txf_infos = load_txf_info (FALSE);
|
||||
|
||||
|
||||
@@ -698,7 +698,7 @@ balance_cell_data_func (GtkTreeViewColumn *tree_column,
|
||||
string = xaccPrintAmount (balance, print_info);
|
||||
}
|
||||
|
||||
if (xaccAccountGetType(account) == EQUITY) {
|
||||
if (xaccAccountGetType(account) == ACCT_TYPE_EQUITY) {
|
||||
allow_value = FALSE;
|
||||
string=_("zero");
|
||||
} else {
|
||||
|
||||
@@ -425,23 +425,26 @@ gnc_ui_sx_loan_druid_create(void)
|
||||
/* non-gladeable widget setup */
|
||||
{
|
||||
int i;
|
||||
// LIABILITY
|
||||
// ACCT_TYPE_LIABILITY
|
||||
GList *liabilityAcct;
|
||||
// BANK, CASH, CREDIT, ASSET + LIABILITY
|
||||
// ACCT_TYPE_BANK, ACCT_TYPE_CASH, ACCT_TYPE_CREDIT,
|
||||
// ACCT_TYPE_ASSET + ACCT_TYPE_LIABILITY
|
||||
GList *paymentFromAccts;
|
||||
// EXPENSE, LIABILITY, + payment-froms.
|
||||
// ACCT_TYPE_EXPENSE, ACCT_TYPE_LIABILITY, + payment-froms.
|
||||
GList *paymentToAccts;
|
||||
int fromLen = 5;
|
||||
GNCAccountType paymentFroms[] = { BANK, CASH, CREDIT, ASSET, LIABILITY };
|
||||
GNCAccountType paymentFroms[] = { ACCT_TYPE_BANK, ACCT_TYPE_CASH,
|
||||
ACCT_TYPE_CREDIT, ACCT_TYPE_ASSET,
|
||||
ACCT_TYPE_LIABILITY };
|
||||
int toLen = 2;
|
||||
GNCAccountType paymentTos[] = { EXPENSE };
|
||||
GNCAccountType paymentTos[] = { ACCT_TYPE_EXPENSE };
|
||||
|
||||
liabilityAcct = NULL;
|
||||
paymentFromAccts = NULL;
|
||||
paymentToAccts = NULL;
|
||||
|
||||
liabilityAcct = g_list_append( liabilityAcct,
|
||||
GINT_TO_POINTER( LIABILITY ) );
|
||||
GINT_TO_POINTER( ACCT_TYPE_LIABILITY ) );
|
||||
for ( i = 0; i < fromLen; i++ )
|
||||
{
|
||||
paymentFromAccts
|
||||
|
||||
@@ -557,7 +557,7 @@ gnc_stock_split_druid_view_filter_income (Account *account,
|
||||
GNCAccountType type;
|
||||
|
||||
type = xaccAccountGetType(account);
|
||||
return (type == INCOME);
|
||||
return (type == ACCT_TYPE_INCOME);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
@@ -567,7 +567,8 @@ gnc_stock_split_druid_view_filter_asset (Account *account,
|
||||
GNCAccountType type;
|
||||
|
||||
type = xaccAccountGetType(account);
|
||||
return ((type == BANK) || (type == CASH) || (type == ASSET));
|
||||
return ((type == ACCT_TYPE_BANK) || (type == ACCT_TYPE_CASH) ||
|
||||
(type == ACCT_TYPE_ASSET));
|
||||
}
|
||||
|
||||
static void
|
||||
|
||||
@@ -117,14 +117,14 @@ typedef struct _startRecnWindowData
|
||||
* change! These macros define the account types for which an auto interest
|
||||
* xfer dialog could pop up, if the user's preferences allow it.
|
||||
*/
|
||||
#define account_type_has_auto_interest_charge(type) (((type) == CREDIT) || \
|
||||
((type) == LIABILITY) ||\
|
||||
((type) == PAYABLE))
|
||||
#define account_type_has_auto_interest_charge(type) (((type) == ACCT_TYPE_CREDIT) || \
|
||||
((type) == ACCT_TYPE_LIABILITY) ||\
|
||||
((type) == ACCT_TYPE_PAYABLE))
|
||||
|
||||
#define account_type_has_auto_interest_payment(type) (((type) == BANK) || \
|
||||
((type) == ASSET) || \
|
||||
((type) == MUTUAL) || \
|
||||
((type) == RECEIVABLE))
|
||||
#define account_type_has_auto_interest_payment(type) (((type) == ACCT_TYPE_BANK) || \
|
||||
((type) == ACCT_TYPE_ASSET) || \
|
||||
((type) == ACCT_TYPE_MUTUAL) || \
|
||||
((type) == ACCT_TYPE_RECEIVABLE))
|
||||
|
||||
#define account_type_has_auto_interest_xfer(type) \
|
||||
( account_type_has_auto_interest_charge(type) || \
|
||||
@@ -980,7 +980,7 @@ gnc_reconcile_window_set_titles(RecnWindow *recnData)
|
||||
if (formal)
|
||||
title = _("Debits");
|
||||
else
|
||||
title = gnc_get_debit_string(NO_TYPE);
|
||||
title = gnc_get_debit_string(ACCT_TYPE_NONE);
|
||||
|
||||
gtk_frame_set_label(GTK_FRAME(recnData->debit_frame), title);
|
||||
|
||||
@@ -990,7 +990,7 @@ gnc_reconcile_window_set_titles(RecnWindow *recnData)
|
||||
if (formal)
|
||||
title = _("Credits");
|
||||
else
|
||||
title = gnc_get_credit_string(NO_TYPE);
|
||||
title = gnc_get_credit_string(ACCT_TYPE_NONE);
|
||||
|
||||
gtk_frame_set_label(GTK_FRAME(recnData->credit_frame), title);
|
||||
|
||||
@@ -1847,7 +1847,8 @@ find_payment_account(Account *account)
|
||||
continue;
|
||||
|
||||
type = xaccAccountGetType(a);
|
||||
if ((type == BANK) || (type == CASH) || (type == ASSET))
|
||||
if ((type == ACCT_TYPE_BANK) || (type == ACCT_TYPE_CASH) ||
|
||||
(type == ACCT_TYPE_ASSET))
|
||||
return a;
|
||||
}
|
||||
}
|
||||
@@ -1897,7 +1898,7 @@ recnFinishCB (GtkAction *action, RecnWindow *recnData)
|
||||
xaccAccountSetReconcileLastDate (account, date);
|
||||
|
||||
if (auto_payment &&
|
||||
(xaccAccountGetType (account) == CREDIT) &&
|
||||
(xaccAccountGetType (account) == ACCT_TYPE_CREDIT) &&
|
||||
(gnc_numeric_negative_p (recnData->new_ending)))
|
||||
{
|
||||
Account *payment_account;
|
||||
|
||||
@@ -365,8 +365,8 @@ on_accountlist_changed (GtkTreeSelection *selection,
|
||||
}
|
||||
|
||||
gnc_acc = gnc_import_select_account(info->window,
|
||||
NULL, TRUE, longname, currency, BANK,
|
||||
old_value, NULL);
|
||||
NULL, TRUE, longname, currency,
|
||||
ACCT_TYPE_BANK, old_value, NULL);
|
||||
g_free(longname);
|
||||
|
||||
if (gnc_acc) {
|
||||
|
||||
@@ -99,7 +99,7 @@ gnc_import_add_account(struct _accountpickerdialog * picker)
|
||||
GList * valid_types = NULL;
|
||||
/*DEBUG("Begin"); */
|
||||
|
||||
if(picker->new_account_default_type!=NO_TYPE)
|
||||
if(picker->new_account_default_type!=ACCT_TYPE_NONE)
|
||||
{
|
||||
/*Yes, this is weird, but we really DO want to pass the value instead of the pointer...*/
|
||||
valid_types = g_list_prepend(valid_types, (gpointer)picker->new_account_default_type);
|
||||
|
||||
@@ -65,10 +65,10 @@
|
||||
|
||||
@param new_account_default_type
|
||||
Default account type of a
|
||||
new account. Can be NULL. If not NO_TYPE, it will be the
|
||||
account's type if a new account is created. If not NO_TYPE, the
|
||||
function will also warn the user if the found or created account's
|
||||
commodity doesn't match.
|
||||
new account. Can be NULL. If not ACCT_TYPE_NONE, it will be the
|
||||
account's type if a new account is created. If not
|
||||
ACCT_TYPE_NONE, the function will also warn the user if the found
|
||||
or created account's commodity doesn't match.
|
||||
|
||||
@param auto_create
|
||||
Only active if no account with the
|
||||
|
||||
@@ -207,7 +207,7 @@ run_account_picker_dialog (GNCImportMainMatcher *info,
|
||||
TRUE,
|
||||
_("Destination account for the auto-balance split."),
|
||||
xaccTransGetCurrency(gnc_import_TransInfo_get_trans(trans_info)),
|
||||
NO_TYPE,
|
||||
ACCT_TYPE_NONE,
|
||||
old_acc,
|
||||
&ok_pressed);
|
||||
if(ok_pressed)
|
||||
|
||||
@@ -276,7 +276,7 @@ accountinfolist_cb(AB_IMEXPORTER_ACCOUNTINFO *accinfo, void *user_data) {
|
||||
|
||||
gnc_acc = gnc_import_select_account(NULL,
|
||||
online_id, 1, account_name, NULL,
|
||||
NO_TYPE, NULL, NULL);
|
||||
ACCT_TYPE_NONE, NULL, NULL);
|
||||
g_free(online_id);
|
||||
if (gnc_acc) {
|
||||
/* Store chosen gnucash account in callback data */
|
||||
|
||||
@@ -121,8 +121,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
||||
g_assert(gnc_ofx_importer_gui);
|
||||
|
||||
if(data.account_id_valid==true){
|
||||
account = gnc_import_select_account(NULL,
|
||||
data.account_id, 0, NULL, NULL, NO_TYPE, NULL, NULL);
|
||||
account = gnc_import_select_account(NULL, data.account_id, 0, NULL, NULL,
|
||||
ACCT_TYPE_NONE, NULL, NULL);
|
||||
if(account!=NULL)
|
||||
{
|
||||
/********** Validate the input strings to ensure utf8 ********************/
|
||||
@@ -340,7 +340,8 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
||||
else if(data.unique_id_valid==true&&data.security_data_ptr->secname_valid==true)
|
||||
{
|
||||
/************************ Process an investment transaction ******************************/
|
||||
/* Note that the STOCK account type should be replaced with something derived from data.invtranstype*/
|
||||
/* Note that the ACCT_TYPE_STOCK account type should be replaced with something
|
||||
derived from data.invtranstype*/
|
||||
investment_commodity = gnc_import_select_commodity(data.unique_id,
|
||||
0,
|
||||
NULL,
|
||||
@@ -358,7 +359,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
||||
1,
|
||||
investment_account_text,
|
||||
investment_commodity,
|
||||
STOCK,
|
||||
ACCT_TYPE_STOCK,
|
||||
NULL,
|
||||
NULL);
|
||||
g_free (investment_account_text);
|
||||
@@ -424,7 +425,7 @@ int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_u
|
||||
1,
|
||||
investment_account_text,
|
||||
currency,
|
||||
INCOME,
|
||||
ACCT_TYPE_INCOME,
|
||||
NULL,
|
||||
NULL);
|
||||
income_acc_guid = xaccAccountGetGUID(income_account);
|
||||
@@ -548,7 +549,7 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
|
||||
Account *selected_account;
|
||||
gnc_commodity_table * commodity_table;
|
||||
gnc_commodity * default_commodity;
|
||||
GNCAccountType default_type=NO_TYPE;
|
||||
GNCAccountType default_type=ACCT_TYPE_NONE;
|
||||
gchar * account_description;
|
||||
gchar * account_type_name = NULL;
|
||||
|
||||
@@ -571,31 +572,31 @@ int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
|
||||
if(data.account_type_valid==true){
|
||||
switch(data.account_type){
|
||||
case OFX_CHECKING :
|
||||
default_type=BANK;
|
||||
default_type=ACCT_TYPE_BANK;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX checking account"));
|
||||
break;
|
||||
case OFX_SAVINGS :
|
||||
default_type=BANK;
|
||||
default_type=ACCT_TYPE_BANK;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX savings account"));
|
||||
break;
|
||||
case OFX_MONEYMRKT :
|
||||
default_type=MONEYMRKT;
|
||||
default_type=ACCT_TYPE_MONEYMRKT;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX money market account"));
|
||||
break;
|
||||
case OFX_CREDITLINE :
|
||||
default_type=CREDITLINE;
|
||||
default_type=ACCT_TYPE_CREDITLINE;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX credit line account"));
|
||||
break;
|
||||
case OFX_CMA :
|
||||
default_type=NO_TYPE;
|
||||
default_type=ACCT_TYPE_NONE;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX CMA account"));
|
||||
break;
|
||||
case OFX_CREDITCARD :
|
||||
default_type=CREDIT;
|
||||
default_type=ACCT_TYPE_CREDIT;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX credit card account"));
|
||||
break;
|
||||
case OFX_INVESTMENT :
|
||||
default_type=BANK;
|
||||
default_type=ACCT_TYPE_BANK;
|
||||
account_type_name = g_strdup_printf(_("Unknown OFX investment account"));
|
||||
break;
|
||||
default: PERR("WRITEME: ofx_proc_account() This is an unknown account type!");
|
||||
|
||||
@@ -213,24 +213,30 @@ build_atype_map()
|
||||
qif_atype_map = g_hash_table_new(g_str_hash, g_str_equal);
|
||||
g_assert(qif_atype_map);
|
||||
|
||||
QIF_ADD_ATYPE("bank", make_list(1, BANK));
|
||||
QIF_ADD_ATYPE("port", make_list(1, BANK));
|
||||
QIF_ADD_ATYPE("cash", make_list(1, CASH));
|
||||
QIF_ADD_ATYPE("ccard", make_list(1, CREDIT));
|
||||
QIF_ADD_ATYPE("invst", make_list(3, BANK, STOCK, MUTUAL));
|
||||
QIF_ADD_ATYPE("oth a", make_list(3, ASSET, BANK, CASH));
|
||||
QIF_ADD_ATYPE("oth l", make_list(2, LIABILITY, CREDIT));
|
||||
QIF_ADD_ATYPE("mutual", make_list(3, BANK, MUTUAL, STOCK));
|
||||
QIF_ADD_ATYPE("bank", make_list(1, ACCT_TYPE_BANK));
|
||||
QIF_ADD_ATYPE("port", make_list(1, ACCT_TYPE_BANK));
|
||||
QIF_ADD_ATYPE("cash", make_list(1, ACCT_TYPE_CASH));
|
||||
QIF_ADD_ATYPE("ccard", make_list(1, ACCT_TYPE_CREDIT));
|
||||
QIF_ADD_ATYPE("invst", make_list(3, ACCT_TYPE_BANK, ACCT_TYPE_STOCK,
|
||||
ACCT_TYPE_MUTUAL));
|
||||
QIF_ADD_ATYPE("oth a", make_list(3, ACCT_TYPE_ASSET, ACCT_TYPE_BANK,
|
||||
ACCT_TYPE_CASH));
|
||||
QIF_ADD_ATYPE("oth l", make_list(2, ACCT_TYPE_LIABILITY, ACCT_TYPE_CREDIT));
|
||||
QIF_ADD_ATYPE("mutual", make_list(3, ACCT_TYPE_BANK, ACCT_TYPE_MUTUAL,
|
||||
ACCT_TYPE_STOCK));
|
||||
|
||||
/* Internal types */
|
||||
QIF_ADD_ATYPE("__any_bank__", make_list(5, BANK, CREDIT, CASH, ASSET,
|
||||
LIABILITY));
|
||||
QIF_ADD_ATYPE("__all__", make_list(7, BANK, CREDIT, CASH, ASSET, LIABILITY,
|
||||
STOCK, MUTUAL));
|
||||
QIF_ADD_ATYPE("__stock__", make_list(2, STOCK, MUTUAL));
|
||||
QIF_ADD_ATYPE("__income__", make_list(1, INCOME));
|
||||
QIF_ADD_ATYPE("__expense__", make_list(1, EXPENSE));
|
||||
QIF_ADD_ATYPE("__equity__", make_list(1, EQUITY));
|
||||
QIF_ADD_ATYPE("__any_bank__", make_list(5, ACCT_TYPE_BANK, ACCT_TYPE_CREDIT,
|
||||
ACCT_TYPE_CASH, ACCT_TYPE_ASSET,
|
||||
ACCT_TYPE_LIABILITY));
|
||||
QIF_ADD_ATYPE("__all__", make_list(7, ACCT_TYPE_BANK, ACCT_TYPE_CREDIT,
|
||||
ACCT_TYPE_CASH, ACCT_TYPE_ASSET,
|
||||
ACCT_TYPE_LIABILITY, ACCT_TYPE_STOCK,
|
||||
ACCT_TYPE_MUTUAL));
|
||||
QIF_ADD_ATYPE("__stock__", make_list(2, ACCT_TYPE_STOCK, ACCT_TYPE_MUTUAL));
|
||||
QIF_ADD_ATYPE("__income__", make_list(1, ACCT_TYPE_INCOME));
|
||||
QIF_ADD_ATYPE("__expense__", make_list(1, ACCT_TYPE_EXPENSE));
|
||||
QIF_ADD_ATYPE("__equity__", make_list(1, ACCT_TYPE_EQUITY));
|
||||
}
|
||||
#undef QIF_ADD_ATYPE
|
||||
|
||||
|
||||
@@ -200,8 +200,8 @@ gnc_get_default_register_style (GNCAccountType type)
|
||||
|
||||
switch (type) {
|
||||
#if 0
|
||||
case PAYABLE:
|
||||
case RECEIVABLE:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
new_style = REG_STYLE_LEDGER;
|
||||
break;
|
||||
#endif
|
||||
@@ -246,41 +246,41 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
{
|
||||
switch (account_type)
|
||||
{
|
||||
case BANK:
|
||||
case ACCT_TYPE_BANK:
|
||||
return BANK_REGISTER;
|
||||
|
||||
case CASH:
|
||||
case ACCT_TYPE_CASH:
|
||||
return CASH_REGISTER;
|
||||
|
||||
case ASSET:
|
||||
case ACCT_TYPE_ASSET:
|
||||
return ASSET_REGISTER;
|
||||
|
||||
case CREDIT:
|
||||
case ACCT_TYPE_CREDIT:
|
||||
return CREDIT_REGISTER;
|
||||
|
||||
case LIABILITY:
|
||||
case ACCT_TYPE_LIABILITY:
|
||||
return LIABILITY_REGISTER;
|
||||
|
||||
case PAYABLE:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
return PAYABLE_REGISTER;
|
||||
|
||||
case RECEIVABLE:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
return RECEIVABLE_REGISTER;
|
||||
|
||||
case STOCK:
|
||||
case MUTUAL:
|
||||
case ACCT_TYPE_STOCK:
|
||||
case ACCT_TYPE_MUTUAL:
|
||||
return STOCK_REGISTER;
|
||||
|
||||
case INCOME:
|
||||
case ACCT_TYPE_INCOME:
|
||||
return INCOME_REGISTER;
|
||||
|
||||
case EXPENSE:
|
||||
case ACCT_TYPE_EXPENSE:
|
||||
return EXPENSE_REGISTER;
|
||||
|
||||
case EQUITY:
|
||||
case ACCT_TYPE_EQUITY:
|
||||
return EQUITY_REGISTER;
|
||||
|
||||
case CURRENCY:
|
||||
case ACCT_TYPE_CURRENCY:
|
||||
return CURRENCY_REGISTER;
|
||||
|
||||
default:
|
||||
@@ -297,17 +297,17 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
|
||||
switch (account_type)
|
||||
{
|
||||
case BANK:
|
||||
case CASH:
|
||||
case ASSET:
|
||||
case CREDIT:
|
||||
case LIABILITY:
|
||||
case RECEIVABLE:
|
||||
case PAYABLE:
|
||||
case ACCT_TYPE_BANK:
|
||||
case ACCT_TYPE_CASH:
|
||||
case ACCT_TYPE_ASSET:
|
||||
case ACCT_TYPE_CREDIT:
|
||||
case ACCT_TYPE_LIABILITY:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
{
|
||||
/* If any of the sub-accounts have STOCK or MUTUAL types,
|
||||
* then we must use the PORTFOLIO_LEDGER ledger. Otherwise,
|
||||
* a plain old GENERAL_LEDGER will do. */
|
||||
/* If any of the sub-accounts have ACCT_TYPE_STOCK or
|
||||
* ACCT_TYPE_MUTUAL types, then we must use the PORTFOLIO_LEDGER
|
||||
* ledger. Otherwise, a plain old GENERAL_LEDGER will do. */
|
||||
gpointer ret;
|
||||
reg_type = GENERAL_LEDGER;
|
||||
|
||||
@@ -318,18 +318,18 @@ gnc_get_reg_type (Account *leader, GNCLedgerDisplayType ld_type)
|
||||
break;
|
||||
}
|
||||
|
||||
case STOCK:
|
||||
case MUTUAL:
|
||||
case CURRENCY:
|
||||
case ACCT_TYPE_STOCK:
|
||||
case ACCT_TYPE_MUTUAL:
|
||||
case ACCT_TYPE_CURRENCY:
|
||||
reg_type = PORTFOLIO_LEDGER;
|
||||
break;
|
||||
|
||||
case INCOME:
|
||||
case EXPENSE:
|
||||
case ACCT_TYPE_INCOME:
|
||||
case ACCT_TYPE_EXPENSE:
|
||||
reg_type = INCOME_LEDGER;
|
||||
break;
|
||||
|
||||
case EQUITY:
|
||||
case ACCT_TYPE_EQUITY:
|
||||
reg_type = GENERAL_LEDGER;
|
||||
break;
|
||||
|
||||
@@ -360,8 +360,8 @@ gnc_ledger_display_simple (Account *account)
|
||||
gboolean use_double_line;
|
||||
|
||||
switch (acc_type) {
|
||||
case PAYABLE:
|
||||
case RECEIVABLE:
|
||||
case ACCT_TYPE_PAYABLE:
|
||||
case ACCT_TYPE_RECEIVABLE:
|
||||
use_double_line = TRUE;
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -2161,8 +2161,8 @@ gnc_split_register_model_new (void)
|
||||
|
||||
/* FIXME: We really only need a due date for 'invoices', not for
|
||||
* 'payments' or 'receipts'. This implies we really only need the
|
||||
* due-date for transactions that credit the RECEIVABLE or debit
|
||||
* the PAYABLE account type.
|
||||
* due-date for transactions that credit the ACCT_TYPE_RECEIVABLE or
|
||||
* debit the ACCT_TYPE_PAYABLE account type.
|
||||
*/
|
||||
gnc_table_model_set_io_flags_handler(
|
||||
model, gnc_split_register_get_rate_io_flags, RATE_CELL);
|
||||
|
||||
@@ -1839,37 +1839,37 @@ gnc_split_register_type_to_account_type (SplitRegisterType sr_type)
|
||||
switch (sr_type)
|
||||
{
|
||||
case BANK_REGISTER:
|
||||
return BANK;
|
||||
return ACCT_TYPE_BANK;
|
||||
case CASH_REGISTER:
|
||||
return CASH;
|
||||
return ACCT_TYPE_CASH;
|
||||
case ASSET_REGISTER:
|
||||
return ASSET;
|
||||
return ACCT_TYPE_ASSET;
|
||||
case CREDIT_REGISTER:
|
||||
return CREDIT;
|
||||
return ACCT_TYPE_CREDIT;
|
||||
case LIABILITY_REGISTER:
|
||||
return LIABILITY;
|
||||
return ACCT_TYPE_LIABILITY;
|
||||
case PAYABLE_REGISTER:
|
||||
return PAYABLE;
|
||||
return ACCT_TYPE_PAYABLE;
|
||||
case RECEIVABLE_REGISTER:
|
||||
return RECEIVABLE;
|
||||
return ACCT_TYPE_RECEIVABLE;
|
||||
case INCOME_LEDGER:
|
||||
case INCOME_REGISTER:
|
||||
return INCOME;
|
||||
return ACCT_TYPE_INCOME;
|
||||
case EXPENSE_REGISTER:
|
||||
return EXPENSE;
|
||||
return ACCT_TYPE_EXPENSE;
|
||||
case STOCK_REGISTER:
|
||||
case PORTFOLIO_LEDGER:
|
||||
return STOCK;
|
||||
return ACCT_TYPE_STOCK;
|
||||
case CURRENCY_REGISTER:
|
||||
return CURRENCY;
|
||||
return ACCT_TYPE_CURRENCY;
|
||||
case GENERAL_LEDGER:
|
||||
return NO_TYPE;
|
||||
return ACCT_TYPE_NONE;
|
||||
case EQUITY_REGISTER:
|
||||
return EQUITY;
|
||||
return ACCT_TYPE_EQUITY;
|
||||
case SEARCH_LEDGER:
|
||||
return NO_TYPE;
|
||||
return ACCT_TYPE_NONE;
|
||||
default:
|
||||
return NO_TYPE;
|
||||
return ACCT_TYPE_NONE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user