gnucash maint: Multiple changes pushed

Robert Fewell bobit at code.gnucash.org
Fri Jun 28 09:13:05 EDT 2019


Updated	 via  https://github.com/Gnucash/gnucash/commit/cdf348df (commit)
	 via  https://github.com/Gnucash/gnucash/commit/a4bbaf96 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d5c3b4af (commit)



commit cdf348df248ea9fc23bb8f1ccf55b71c1821e0f5
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Jun 28 14:06:35 2019 +0100

    Check for a blank line on the transaction importer
    
    If you have some blank lines, just newlines at the end of file and you
    have an account column and do not remove them you will get an error
    advising that there is no account column selected or account specified
    so this change removes them from being parsed.

diff --git a/gnucash/import-export/csv-imp/gnc-import-tx.cpp b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
index 34d68b763..99536136b 100644
--- a/gnucash/import-export/csv-imp/gnc-import-tx.cpp
+++ b/gnucash/import-export/csv-imp/gnc-import-tx.cpp
@@ -392,11 +392,12 @@ void GncTxImport::tokenize (bool guessColTypes)
     m_parsed_lines.clear();
     for (auto tokenized_line : m_tokenizer->get_tokens())
     {
-        m_parsed_lines.push_back (std::make_tuple (tokenized_line, std::string(),
-                std::make_shared<GncPreTrans>(date_format()),
-                std::make_shared<GncPreSplit>(date_format(), currency_format()),
-                false));
         auto length = tokenized_line.size();
+        if (length > 0)
+            m_parsed_lines.push_back (std::make_tuple (tokenized_line, std::string(),
+                    std::make_shared<GncPreTrans>(date_format()),
+                    std::make_shared<GncPreSplit>(date_format(), currency_format()),
+                    false));
         if (length > max_cols)
             max_cols = length;
     }

commit a4bbaf968f809f690cd1163ca7fc7619cbebc014
Author: Robert Fewell <14uBobIT at gmail.com>
Date:   Fri Jun 28 14:03:44 2019 +0100

    Fix an error in my previous double-click fix
    
    Th gboolean first needs to be setup as a pointer but have left
    is_selected as a gboolean.

diff --git a/gnucash/import-export/import-main-matcher.c b/gnucash/import-export/import-main-matcher.c
index 981bf8dee..be39bcf0f 100644
--- a/gnucash/import-export/import-main-matcher.c
+++ b/gnucash/import-export/import-main-matcher.c
@@ -100,7 +100,7 @@ void on_matcher_help_close_clicked (GtkButton *button, gpointer user_data);
 /* Local prototypes */
 static void gnc_gen_trans_assign_transfer_account (
                                                 GtkTreeView *treeview,
-                                                gboolean first,
+                                                gboolean *first,
                                                 gboolean is_selection,
                                                 GtkTreePath *path,
                                                 Account **new_acc,
@@ -377,7 +377,7 @@ gnc_gen_trans_update_toggled_cb (GtkCellRendererToggle *cell_renderer,
 
 static void
 gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
-                                       gboolean first,
+                                       gboolean *first,
                                        gboolean is_selection,
                                        GtkTreePath *path,
                                        Account **new_acc,
@@ -388,11 +388,13 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
     GNCImportTransInfo *trans_info;
     Account *old_acc;
     gboolean ok_pressed;
+    gchar *path_str = gtk_tree_path_to_string (path);
 
     ENTER("");
-    DEBUG("first = %s", first ? "true" : "false");
+    DEBUG("first = %s", *first ? "true" : "false");
     DEBUG("is_selection = %s", is_selection ? "true" : "false");
-    DEBUG("path  = %s", gtk_tree_path_to_string (path));
+    DEBUG("path  = %s", path_str);
+    g_free (path_str);
     DEBUG("account passed in = %s", gnc_get_account_name_for_register (*new_acc));
     model = gtk_tree_view_get_model (treeview);
     if (gtk_tree_model_get_iter (model, &iter, path))
@@ -406,7 +408,7 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
             {
                 ok_pressed = TRUE;
                 old_acc  = gnc_import_TransInfo_get_destacc (trans_info);
-                if (first)
+                if (*first)
                 {
                     ok_pressed = FALSE;
                     *new_acc = gnc_import_select_account (info->main_widget,
@@ -418,7 +420,7 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
                         ACCT_TYPE_NONE,
                         old_acc,
                         &ok_pressed);
-                    first = FALSE;
+                    *first = FALSE;
                     DEBUG("account selected = %s",
                             gnc_account_get_full_name (*new_acc));
                 }
@@ -428,7 +430,7 @@ gnc_gen_trans_assign_transfer_account (GtkTreeView *treeview,
             break;
         case GNCImport_CLEAR:
         case GNCImport_UPDATE:
-            if (first && !is_selection)
+            if (*first && !is_selection)
                 run_match_dialog (info, trans_info);
             break;
         case GNCImport_SKIP:
@@ -471,19 +473,18 @@ gnc_gen_trans_assign_transfer_account_to_selection_cb (GtkMenuItem *menuitem,
     {
         for (l = selected_rows; l != NULL; l = l->next)
         {
-            DEBUG("passing first = %s",
-                                                first?"true":"false");
-            DEBUG("passing is_selection = %s",
-                                                is_selection?"true":"false");
-            DEBUG("passing path = %s",
-                           gtk_tree_path_to_string (l->data));
+            gchar *path_str = gtk_tree_path_to_string (l->data);
+            DEBUG("passing first = %s", first ? "true" : "false");
+            DEBUG("passing is_selection = %s", is_selection ? "true" : "false");
+            DEBUG("passing path = %s", path_str);
+            g_free (path_str);
             DEBUG("passing account value = %s",
                         gnc_account_get_full_name (assigned_account));
             gnc_gen_trans_assign_transfer_account (treeview,
-                           first, is_selection, l->data, &assigned_account, info);
+                           &first, is_selection, l->data, &assigned_account, info);
             DEBUG("returned value of account = %s",
                         gnc_account_get_full_name (assigned_account));
-            DEBUG("returned value of first = %s",first?"true":"false");
+            DEBUG("returned value of first = %s", first ? "true" : "false");
             if (assigned_account == NULL)
                 break;
             gtk_tree_selection_unselect_path (selection, l->data);
@@ -507,7 +508,7 @@ gnc_gen_trans_row_activated_cb (GtkTreeView *treeview,
     first = TRUE;
     is_selection = FALSE;
     gnc_gen_trans_assign_transfer_account (treeview,
-                            first, is_selection, path,
+                            &first, is_selection, path,
                             &assigned_account, info);
     DEBUG("account returned = %s", gnc_account_get_full_name (assigned_account));
     LEAVE("");



Summary of changes:
 gnucash/import-export/csv-imp/gnc-import-tx.cpp |  9 ++++---
 gnucash/import-export/import-main-matcher.c     | 33 +++++++++++++------------
 2 files changed, 22 insertions(+), 20 deletions(-)



More information about the gnucash-changes mailing list