mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Bug 777949 - Accounts implicitly created in ledger attempt creation twice
Guard against recursively calling the account doesn’t exist query or creation dialog if one is already in the account creation dialog. The underlying problem is that creating the dialog forces a UI update that in turn sets the cell value and checks for the existence of the account. In basic view the cell being displayed (“transfer”) isn’t the one being changed (“account”) so the account check isn’t invoked, but in multi-split view the “account” cell *is* displayed so the check is invoked again.
This commit is contained in:
parent
97598c4306
commit
bc50f3da00
@ -1833,6 +1833,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
|||||||
char *account_name;
|
char *account_name;
|
||||||
ComboCell *cell = (ComboCell *) bcell;
|
ComboCell *cell = (ComboCell *) bcell;
|
||||||
Account *account;
|
Account *account;
|
||||||
|
static gboolean creating_account = FALSE;
|
||||||
|
|
||||||
if (!name || (strlen(name) == 0))
|
if (!name || (strlen(name) == 0))
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -1842,15 +1843,16 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
|
|||||||
if (!account)
|
if (!account)
|
||||||
account = gnc_account_lookup_by_code(gnc_get_current_root_account(), name);
|
account = gnc_account_lookup_by_code(gnc_get_current_root_account(), name);
|
||||||
|
|
||||||
if (!account)
|
if (!account && !creating_account)
|
||||||
{
|
{
|
||||||
/* Ask if they want to create a new one. */
|
/* Ask if they want to create a new one. */
|
||||||
if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
|
if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
|
||||||
TRUE, missing, name))
|
TRUE, missing, name))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
creating_account = TRUE;
|
||||||
/* User said yes, they want to create a new account. */
|
/* User said yes, they want to create a new account. */
|
||||||
account = gnc_ui_new_accounts_from_name_window (name);
|
account = gnc_ui_new_accounts_from_name_window (name);
|
||||||
|
creating_account = FALSE;
|
||||||
if (!account)
|
if (!account)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user