Fix register problem where the transfer field (on the last line if in

a multi-line split) ignores whatever the user entered if you leave the
cell with the <enter> key instead of the <tab> key.


git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@7473 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
David Hampton 2002-11-12 18:21:45 +00:00
parent 2e26735df4
commit 348e88d83d
4 changed files with 76 additions and 43 deletions

View File

@ -1,16 +1,28 @@
2002-11-12 David Hampton <hampton@employees.org>
* src/register/ledger-core/split-register-control.c
(gnc_split_register_traverse): Move the checking for non-existent
and placeholder accounts to a separate function, and call that new
function.
* src/register/ledger-core/split-register.c
(gnc_split_register_cancel_cursor_trans_changes): Do a full
refresh after calling this function. Cleans up some gui leftovers
after a delete. (gnc_split_register_get_account_by_name): Add the
new function that checks for non-existent and placeholder
accounts. (gnc_split_register_get_account): Call the new function
to get the addditional checks. This solves #92157.
2002-11-12 Benoit Grégoire <bock@step.polymtl.ca> 2002-11-12 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/Transaction-matcher.c: Fix previous patch. * src/import-export/Transaction-matcher.c: Fix previous patch.
gcc 3.2 is too forgiving... gcc 3.2 is too forgiving...
2002-11-12 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/Transaction-matcher.c: Dynamically generate * src/import-export/Transaction-matcher.c: Dynamically generate
a pixmap to display match confidence graphically. a pixmap to display match confidence graphically.
2002-11-12 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/ofx/gnc-ofx-import.c: Fix call to * src/import-export/ofx/gnc-ofx-import.c: Fix call to
g_strdup_printf in Christian's 2002-11-03 translation patch. g_strdup_printf in Christian's 2002-11-03 translation patch.
2002-11-12 Benoit Grégoire <bock@step.polymtl.ca>
* src/import-export/Transaction-matcher.c * src/import-export/Transaction-matcher.c
* src/import-export/generic-import.glade: First round of * src/import-export/generic-import.glade: First round of
transaction matcher UI changes. Create a pseudo-widget in first transaction matcher UI changes. Create a pseudo-widget in first

View File

@ -884,7 +884,6 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
do do
{ {
ComboCell *cell; ComboCell *cell;
Account *account;
char *name; char *name;
@ -919,41 +918,9 @@ gnc_split_register_traverse (VirtualLocation *p_new_virt_loc,
safe_strcmp (name, STOCK_SPLIT_STR) == 0) safe_strcmp (name, STOCK_SPLIT_STR) == 0)
break; break;
account = xaccGetAccountFromFullName (gnc_get_current_group (), /* Create the account if necessary. Also checks for a placeholder */
cell->cell.value, (void) gnc_split_register_get_account_by_name (reg, (BasicCell *)cell, cell->cell.value,
gnc_get_account_separator ()); &info->full_refresh);
if (account)
{
if (xaccAccountGetPlaceholder (account))
{
const char *format = _("The account %s does not allow transactions.\n");
gnc_error_dialog_parented (GTK_WINDOW(gnc_split_register_get_parent (reg)),
format, name);
}
break;
}
else
{
const char *format = _("The account %s does not exist.\n"
"Would you like to create it?");
if (!gnc_verify_dialog_parented (gnc_split_register_get_parent (reg),
TRUE, format, name))
break;
}
info->full_refresh = FALSE;
account = gnc_ui_new_accounts_from_name_window (name);
if (!account)
break;
info->full_refresh = TRUE;
name = xaccAccountGetFullName (account, gnc_get_account_separator ());
gnc_combo_cell_set_value (cell, name);
gnc_basic_cell_set_changed (&cell->cell, TRUE);
g_free (name);
} while (FALSE); } while (FALSE);
/* See if we are tabbing off the end of the very last line */ /* See if we are tabbing off the end of the very last line */

View File

@ -147,6 +147,8 @@ CellBlock * gnc_split_register_get_active_cursor (SplitRegister *reg);
void gnc_split_register_set_last_num (SplitRegister *reg, const char *num); void gnc_split_register_set_last_num (SplitRegister *reg, const char *num);
Account * gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * cell,
const char *name, gboolean *new);
Account * gnc_split_register_get_account (SplitRegister *reg, Account * gnc_split_register_get_account (SplitRegister *reg,
const char *cell_name); const char *cell_name);

View File

@ -1104,6 +1104,7 @@ gnc_split_register_cancel_cursor_trans_changes (SplitRegister *reg)
xaccTransRollbackEdit (pending_trans); xaccTransRollbackEdit (pending_trans);
info->pending_trans_guid = *xaccGUIDNULL (); info->pending_trans_guid = *xaccGUIDNULL ();
info->full_refresh = TRUE;
gnc_resume_gui_refresh (); gnc_resume_gui_refresh ();
} }
@ -1470,18 +1471,69 @@ gnc_split_register_save (SplitRegister *reg, gboolean do_commit)
return TRUE; return TRUE;
} }
Account *
gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
const char *name, gboolean *new)
{
const char *placeholder = _("The account %s does not allow transactions.\n");
const char *missing = _("The account %s does not exist.\n"
"Would you like to create it?");
char *fullname;
ComboCell *cell = (ComboCell *) bcell;
Account *account;
/* No changes, as yet. */
*new = FALSE;
/* Find the account */
account = xaccGetAccountFromFullName (gnc_get_current_group (),
name, gnc_get_account_separator ());
if (!account) {
/* Ask if they want to create a new one. */
if (!gnc_verify_dialog_parented (gnc_split_register_get_parent (reg),
TRUE, missing, name))
return NULL;
/* User said yes, they want to create a new account. */
account = gnc_ui_new_accounts_from_name_window (name);
if (!account)
return NULL;
*new = TRUE;
/* Now have a new account. Update the cell with the name as created. */
fullname = xaccAccountGetFullName (account, gnc_get_account_separator ());
gnc_combo_cell_set_value (cell, fullname);
gnc_basic_cell_set_changed (&cell->cell, TRUE);
g_free (fullname);
}
/* See if the account (either old or new) is a placeholder. */
if (xaccAccountGetPlaceholder (account)) {
gnc_error_dialog_parented (GTK_WINDOW(gnc_split_register_get_parent (reg)),
placeholder, name);
}
/* Be seeing you. */
return account;
}
Account * Account *
gnc_split_register_get_account (SplitRegister *reg, const char * cell_name) gnc_split_register_get_account (SplitRegister *reg, const char * cell_name)
{ {
BasicCell *cell;
const char *name; const char *name;
gboolean dummy;
if (!gnc_table_layout_get_cell_changed (reg->table->layout, cell_name, TRUE)) if (!gnc_table_layout_get_cell_changed (reg->table->layout, cell_name, TRUE))
return NULL; return NULL;
name = gnc_table_layout_get_cell_value (reg->table->layout, cell_name); cell = gnc_table_layout_get_cell (reg->table->layout, cell_name);
if (!cell)
return xaccGetAccountFromFullName (gnc_get_current_group (), return NULL;
name, gnc_get_account_separator ()); name = gnc_basic_cell_get_value (cell);
return gnc_split_register_get_account_by_name (reg, cell, name, &dummy);
} }
static gboolean static gboolean