gnucash maint: Bug 771246 - Set Invoice/Bill items date correctly from imported CSV.

Mike Evans mikee at code.gnucash.org
Mon Sep 12 04:04:27 EDT 2016


Updated	 via  https://github.com/Gnucash/gnucash/commit/afd684c1 (commit)
	from  https://github.com/Gnucash/gnucash/commit/325aed3a (commit)



commit afd684c1bf87306d5a340fa4600d0c9d375f01be
Author: Mike Evans <mikee at saxicola.co.uk>
Date:   Mon Sep 12 09:01:54 2016 +0100

    Bug 771246 - Set Invoice/Bill items date correctly from imported CSV.
    
    If there's a date in the field use it, otherwise use the current date.

diff --git a/src/plugins/bi_import/dialog-bi-import.c b/src/plugins/bi_import/dialog-bi-import.c
index f266ffc..12b8588 100644
--- a/src/plugins/bi_import/dialog-bi-import.c
+++ b/src/plugins/bi_import/dialog-bi-import.c
@@ -710,7 +710,15 @@ gnc_bi_import_create_bis (GtkListStore * store, QofBook * book,
             g_date_free (date);
         }
         timespecFromTime64 (&today, gnc_time (NULL));	// set today to the current date
-        gncEntrySetDateEntered (entry, today);
+        if (strlen (date_opened) != 0)	// If a date is specified in CSV
+        {
+            qof_scan_date (date_opened, &day, &month, &year); // FIXME: Must check for the return value of qof_scan_date!
+            gncEntrySetDate(entry, gnc_dmy2timespec (day, month, year));
+        }
+        else
+        {
+            gncEntrySetDateEntered(entry, today);
+        }
         // Remove escaped quotes
         desc = un_escape(desc);
         notes = un_escape(notes);



Summary of changes:
 src/plugins/bi_import/dialog-bi-import.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)



More information about the gnucash-changes mailing list