From 797a1594c5e12c313ab465edda396546cfa77cfa Mon Sep 17 00:00:00 2001 From: Dave Peticolas Date: Sat, 9 Jun 2001 07:35:24 +0000 Subject: [PATCH] 2001-06-09 Dave Peticolas * src/gnc-ui-util.c (gnc_find_or_create_equity_account): allow group to be specified (gnc_account_create_opening_balance): search in given account's group git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@4565 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 7 +++++++ src/gnc-ui-util.c | 10 ++++++---- src/gnc-ui-util.h | 3 ++- 3 files changed, 15 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cceae93e9e..3c926171ec 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2001-06-09 Dave Peticolas + + * src/gnc-ui-util.c (gnc_find_or_create_equity_account): allow + group to be specified + (gnc_account_create_opening_balance): search in given account's + group + 2001-06-08 Dave Peticolas * src/gnc-ui-util.c (gnc_find_or_create_equity_account): first diff --git a/src/gnc-ui-util.c b/src/gnc-ui-util.c index ea37f2e376..e8168dd37c 100644 --- a/src/gnc-ui-util.c +++ b/src/gnc-ui-util.c @@ -470,12 +470,12 @@ equity_base_name (GNCEquityType equity_type) } Account * -gnc_find_or_create_equity_account (GNCEquityType equity_type, +gnc_find_or_create_equity_account (AccountGroup *group, + GNCEquityType equity_type, gnc_commodity *currency) { Account *parent; Account *account; - AccountGroup *group; gboolean name_exists; gboolean base_name_exists; const char *base_name; @@ -485,7 +485,8 @@ gnc_find_or_create_equity_account (GNCEquityType equity_type, g_return_val_if_fail (equity_type < NUM_EQUITY_TYPES, NULL); g_return_val_if_fail (currency != NULL, NULL); - group = gncGetCurrentGroup (); + if (!group) + group = gncGetCurrentGroup (); base_name = equity_base_name (equity_type); @@ -578,7 +579,8 @@ gnc_account_create_opening_balance (Account *account, g_return_val_if_fail (account != NULL, FALSE); equity_account = - gnc_find_or_create_equity_account (EQUITY_OPENING_BALANCE, + gnc_find_or_create_equity_account (xaccGetAccountRoot (account), + EQUITY_OPENING_BALANCE, xaccAccountGetCurrency (account)); if (!equity_account) return FALSE; diff --git a/src/gnc-ui-util.h b/src/gnc-ui-util.h index 750a61a8ba..5001c7b65d 100644 --- a/src/gnc-ui-util.h +++ b/src/gnc-ui-util.h @@ -85,7 +85,8 @@ typedef enum NUM_EQUITY_TYPES } GNCEquityType; -Account * gnc_find_or_create_equity_account (GNCEquityType equity_type, +Account * gnc_find_or_create_equity_account (AccountGroup *group, + GNCEquityType equity_type, gnc_commodity *currency); gboolean gnc_account_create_opening_balance (Account *account, gnc_numeric balance,