gnucash maint: Multiple changes pushed

John Ralls jralls at code.gnucash.org
Fri Mar 10 13:54:33 EST 2017


Updated	 via  https://github.com/Gnucash/gnucash/commit/bc50f3da (commit)
	 via  https://github.com/Gnucash/gnucash/commit/97598c43 (commit)
	from  https://github.com/Gnucash/gnucash/commit/03ff5d37 (commit)



commit bc50f3da005d707067a83d74852ad1bcc69f857b
Author: John Ralls <jralls at ceridwen.us>
Date:   Fri Mar 10 10:54:22 2017 -0800

    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.

diff --git a/src/register/ledger-core/split-register.c b/src/register/ledger-core/split-register.c
index 3e4eb74..2e2aebd 100644
--- a/src/register/ledger-core/split-register.c
+++ b/src/register/ledger-core/split-register.c
@@ -1833,6 +1833,7 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     char *account_name;
     ComboCell *cell = (ComboCell *) bcell;
     Account *account;
+    static gboolean creating_account = FALSE;
 
     if (!name || (strlen(name) == 0))
         return NULL;
@@ -1842,15 +1843,16 @@ gnc_split_register_get_account_by_name (SplitRegister *reg, BasicCell * bcell,
     if (!account)
         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. */
         if (!gnc_verify_dialog (gnc_split_register_get_parent (reg),
                                 TRUE, missing, name))
             return NULL;
-
+        creating_account = TRUE;
         /* User said yes, they want to create a new account. */
         account = gnc_ui_new_accounts_from_name_window (name);
+        creating_account = FALSE;
         if (!account)
             return NULL;
     }

commit 97598c430693239d6aeab9dc4ff6f49e789cebff
Author: John Ralls <jralls at ceridwen.us>
Date:   Thu Mar 9 11:38:42 2017 -0800

    Bug 776564 - Creating a scheduled transaction from an existing...
    
    transaction does not include the notes field.
    
    In fact, notes support was entirely missing from scheduled transactions.

diff --git a/src/engine/SX-ttinfo.c b/src/engine/SX-ttinfo.c
index 052d964..7af023f 100644
--- a/src/engine/SX-ttinfo.c
+++ b/src/engine/SX-ttinfo.c
@@ -30,9 +30,9 @@
 /* KvpFrame policy? */
 struct TTInfo_s
 {
-    /* FIXME add notes field */
     char *description; /* owned by us */
     char *num;         /* owned  by us */
+    char *notes;
     gnc_commodity *common_currency; /* not freed */
 
     GList *splits; /* list of template splits, owned by us */
@@ -67,6 +67,7 @@ void gnc_ttinfo_free(TTInfo *info)
 
     g_free(info->description);
     g_free(info->num);
+    g_free (info->notes);
     g_list_foreach(info->splits,
                    delete_splitinfo,
                    NULL);
@@ -127,6 +128,28 @@ gnc_ttinfo_get_num(TTInfo *tti)
     return tti->num;
 }
 
+void
+gnc_ttinfo_set_notes (TTInfo *tti, const char *notes)
+{
+    g_return_if_fail (tti);
+
+    if (tti->notes)
+    {
+        g_free (tti->notes);
+    }
+
+    tti->notes = g_strdup (notes);
+
+    return;
+}
+
+const char*
+gnc_ttinfo_get_notes (TTInfo *tti)
+{
+    g_return_val_if_fail (tti, NULL);
+
+    return tti->notes;
+}
 
 void
 gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency)
diff --git a/src/engine/SX-ttinfo.h b/src/engine/SX-ttinfo.h
index 0844757..72486f7 100644
--- a/src/engine/SX-ttinfo.h
+++ b/src/engine/SX-ttinfo.h
@@ -41,7 +41,7 @@ void gnc_ttinfo_free(TTInfo *info);
 /* these two deep-copy their arguments */
 void gnc_ttinfo_set_description(TTInfo *tti, const char *description);
 void gnc_ttinfo_set_num(TTInfo *tti, const char *num);
-
+void gnc_ttinfo_set_notes (TTInfo *tti, const char *notes);
 
 /* this one points to a persistent pointer so ownership isn't relevant */
 void gnc_ttinfo_set_currency(TTInfo *tti, gnc_commodity *common_currency);
@@ -52,6 +52,7 @@ void gnc_ttinfo_set_template_splits(TTInfo *tti, GList *splits);
 
 const char    * gnc_ttinfo_get_description(TTInfo *tti);
 const char    * gnc_ttinfo_get_num(TTInfo *tti);
+const char *gnc_ttinfo_get_notes (TTInfo *tti);
 gnc_commodity * gnc_ttinfo_get_currency(TTInfo *tti);
 GList         * gnc_ttinfo_get_template_splits(TTInfo *tti);
 
diff --git a/src/engine/SchedXaction.c b/src/engine/SchedXaction.c
index 1bdcb0b..23ffb1f 100644
--- a/src/engine/SchedXaction.c
+++ b/src/engine/SchedXaction.c
@@ -1039,6 +1039,7 @@ xaccSchedXactionSetTemplateTrans(SchedXaction *sx, GList *t_t_list,
          * xaccTransSetNum with these arguments */
         gnc_set_num_action(new_trans, NULL,
                         gnc_ttinfo_get_num(tti), NULL);
+        xaccTransSetNotes (new_trans, gnc_ttinfo_get_notes (tti));
         xaccTransSetCurrency( new_trans,
                               gnc_ttinfo_get_currency(tti) );
 
diff --git a/src/gnome/dialog-sx-from-trans.c b/src/gnome/dialog-sx-from-trans.c
index 596512c..f8be47b 100644
--- a/src/gnome/dialog-sx-from-trans.c
+++ b/src/gnome/dialog-sx-from-trans.c
@@ -221,6 +221,7 @@ sxftd_add_template_trans(SXFromTransInfo *sxfti)
 
     gnc_ttinfo_set_description(tti, xaccTransGetDescription(tr));
     gnc_ttinfo_set_num(tti, gnc_get_num_action(tr, NULL));
+    gnc_ttinfo_set_notes (tti, xaccTransGetNotes (tr));
     gnc_ttinfo_set_currency(tti, xaccTransGetCurrency(tr));
 
     for (splits = xaccTransGetSplitList(tr); splits; splits = splits->next)



Summary of changes:
 src/engine/SX-ttinfo.c                    | 25 ++++++++++++++++++++++++-
 src/engine/SX-ttinfo.h                    |  3 ++-
 src/engine/SchedXaction.c                 |  1 +
 src/gnome/dialog-sx-from-trans.c          |  1 +
 src/register/ledger-core/split-register.c |  6 ++++--
 5 files changed, 32 insertions(+), 4 deletions(-)



More information about the gnucash-changes mailing list