mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
deprecate xaccAccountCountSplits with include_children = FALSE
whereby xaccAccountCountSplits is called with with_children = FALSE, test xaccAccountGetSplitList against NULL.
This commit is contained in:
parent
1b31c06b29
commit
e6486e9d95
@ -1389,7 +1389,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
|
||||
&aw->commodity_mode);
|
||||
|
||||
// If the account has transactions, prevent changes by displaying a label and tooltip
|
||||
if (xaccAccountCountSplits (aw_get_account (aw), FALSE) > 0)
|
||||
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
|
||||
{
|
||||
const gchar *sec_name = gnc_commodity_get_printname (xaccAccountGetCommodity(aw_get_account (aw)));
|
||||
GtkWidget *label = gtk_label_new (sec_name);
|
||||
@ -1473,7 +1473,7 @@ gnc_account_window_create(GtkWindow *parent, AccountWindow *aw)
|
||||
// immutable if gnucash depends on details that would be lost/missing
|
||||
// if changing from/to such a type. At the time of this writing the
|
||||
// immutable types are AR, AP and trading types.
|
||||
if (xaccAccountCountSplits (aw_get_account (aw), FALSE) > 0)
|
||||
if (xaccAccountGetSplitList (aw_get_account (aw)) != NULL)
|
||||
{
|
||||
GNCAccountType atype = xaccAccountGetType (aw_get_account (aw));
|
||||
compat_types = xaccAccountTypesCompatibleWith (atype);
|
||||
|
@ -1643,7 +1643,7 @@ gnc_plugin_page_account_tree_cmd_delete_account (GtkAction *action, GncPluginPag
|
||||
}
|
||||
|
||||
// If no transaction or children just delete it.
|
||||
if (!(xaccAccountCountSplits (account, FALSE) ||
|
||||
if (!(xaccAccountGetSplitList (account) != NULL ||
|
||||
gnc_account_n_children (account)))
|
||||
{
|
||||
do_delete_account (account, NULL, NULL, NULL);
|
||||
|
@ -175,6 +175,12 @@ test_invoice_post ( Fixture *fixture, gconstpointer pData )
|
||||
g_assert(!gncInvoiceIsPosted(fixture->invoice));
|
||||
}
|
||||
|
||||
static gboolean account_has_one_split (const Account *acc)
|
||||
{
|
||||
GList *splits = xaccAccountGetSplitList (acc);
|
||||
return (splits && !(splits->next));
|
||||
}
|
||||
|
||||
static void
|
||||
test_invoice_posted_trans ( Fixture *fixture, gconstpointer pData )
|
||||
{
|
||||
@ -183,8 +189,8 @@ test_invoice_posted_trans ( Fixture *fixture, gconstpointer pData )
|
||||
gnc_numeric total = gncInvoiceGetTotal(fixture->invoice);
|
||||
gnc_numeric acct_balance, acct2_balance;
|
||||
|
||||
g_assert (1 == xaccAccountCountSplits (fixture->account, FALSE));
|
||||
g_assert (1 == xaccAccountCountSplits (fixture->account2, FALSE));
|
||||
g_assert (account_has_one_split (fixture->account));
|
||||
g_assert (account_has_one_split (fixture->account2));
|
||||
|
||||
acct_balance = xaccAccountGetBalance(fixture->account);
|
||||
acct2_balance = xaccAccountGetBalance(fixture->account2);
|
||||
|
Loading…
Reference in New Issue
Block a user