* src/business/business-ledger/gncEntryLedgerLoad.c -- don't add

income accounts to bills, or expense accounts to invoices.  This
	  should help further reduce user confusion with what to do when
	  entering invoices.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7925 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
Derek Atkins
2003-02-02 22:52:42 +00:00
parent c0a75e8db7
commit 434156ca84
2 changed files with 41 additions and 13 deletions

View File

@@ -15,6 +15,11 @@
* src/app-utils/option-util.c: use gh_scm2double() instead of
gh_scm2int() because guile-1.6 prefers it. Fixes a crash when
opening the Pref's dialog when using guile-1.6.1
* src/business/business-ledger/gncEntryLedgerLoad.c -- don't add
income accounts to bills, or expense accounts to invoices. This
should help further reduce user confusion with what to do when
entering invoices.
2003-02-01 Benoit Gr<47>goire <bock@step.polymtl.ca>

View File

@@ -79,7 +79,8 @@ static void load_discount_how_cells (GncEntryLedger *ledger)
gnc_recn_cell_set_string_getter (cell, gnc_entry_ledger_how_string_getter);
}
static void load_xfer_cell (ComboCell * cell, AccountGroup * grp)
static void load_xfer_cell (ComboCell * cell, AccountGroup * grp,
GncEntryLedgerType ledger_type)
{
GList *list;
GList *node;
@@ -93,19 +94,41 @@ static void load_xfer_cell (ComboCell * cell, AccountGroup * grp)
for (node = list; node; node = node->next) {
Account *account = node->data;
char *name;
GNCAccountType type;
/* Don't add placeholder accounts */
if (xaccAccountGetPlaceholder (account))
continue;
/* 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)
continue;
/* If this is an ORDER or INVOICE, then leave out the expenses.
* if it's a BILL, then leave out the incomes
*/
switch (ledger_type) {
case GNCENTRY_ORDER_ENTRY:
case GNCENTRY_ORDER_VIEWER:
case GNCENTRY_INVOICE_ENTRY:
case GNCENTRY_INVOICE_VIEWER:
if (type == EXPENSE) continue;
break;
case GNCENTRY_BILL_ENTRY:
case GNCENTRY_BILL_VIEWER:
case GNCENTRY_NUM_REGISTER_TYPES:
if (type == INCOME) continue;
break;
}
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
if (name != NULL) {
GNCAccountType type = xaccAccountGetType (account);
if (name != NULL)
gnc_combo_cell_add_menu_item (cell, name);
/* Dont add placeholder, A/R, A/P, Bank, Cash, or Equity accounts */
if (! (xaccAccountGetPlaceholder (account) ||
type == PAYABLE || type == RECEIVABLE ||
type == CASH || type == BANK || type == EQUITY) )
gnc_combo_cell_add_menu_item (cell, name);
g_free(name);
}
g_free(name);
}
g_list_free (list);
@@ -123,12 +146,12 @@ static void load_xfer_type_cells (GncEntryLedger *ledger)
cell = (ComboCell *)
gnc_table_layout_get_cell (ledger->table->layout, ENTRY_IACCT_CELL);
gnc_combo_cell_clear_menu (cell);
load_xfer_cell (cell, group);
load_xfer_cell (cell, group, ledger->type);
cell = (ComboCell *)
gnc_table_layout_get_cell (ledger->table->layout, ENTRY_BACCT_CELL);
gnc_combo_cell_clear_menu (cell);
load_xfer_cell (cell, group);
load_xfer_cell (cell, group, ledger->type);
}
static void load_taxtable_type_cells (GncEntryLedger *ledger)