gnucash master: Bug 721196 - Cannot import lines with empty fields for deposit or withdrawal in bank transaction download.

Mike Evans mikee at code.gnucash.org
Sun Mar 16 07:01:35 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/67d90c90 (commit)
	from  https://github.com/Gnucash/gnucash/commit/d1cbddc9 (commit)



commit 67d90c90cc14292181a64b5a68cf52979960c052
Author: Mike Evans <mikee at millstreamcomputing.co.uk>
Date:   Sun Mar 16 10:58:28 2014 +0000

    Bug 721196 - Cannot import lines with empty fields for deposit or withdrawal in bank transaction download.
    
    Empty numeric fields are assumed to be 0.0 values.

diff --git a/src/import-export/csv-imp/gnc-csv-model.c b/src/import-export/csv-imp/gnc-csv-model.c
index d9697a0..3bc5da2 100644
--- a/src/import-export/csv-imp/gnc-csv-model.c
+++ b/src/import-export/csv-imp/gnc-csv-model.c
@@ -663,7 +663,12 @@ static gboolean trans_property_set(TransProperty* prop, char* str)
     case GNC_CSV_DEPOSIT:
     case GNC_CSV_WITHDRAWAL:
         str_dupe = g_strdup(str); /* First, we make a copy so we can't mess up real data. */
-
+        /* If a cell is empty make its value = 0.0 */
+        if ( strcmp(str_dupe, "") == 0)
+        { 
+            g_free(str_dupe);
+            str_dupe = g_strdup("0.0");
+        }
         /* Go through str_dupe looking for currency symbols. */
         for (possible_currency_symbol = str_dupe; *possible_currency_symbol;
                 possible_currency_symbol = g_utf8_next_char(possible_currency_symbol))



Summary of changes:
 src/import-export/csv-imp/gnc-csv-model.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list