gnucash master: Fix aqbanking handling of transaction templates.

Christian Stimming cstim at code.gnucash.org
Mon Sep 8 15:17:04 EDT 2014


Updated	 via  https://github.com/Gnucash/gnucash/commit/9e0e6e1f (commit)
	from  https://github.com/Gnucash/gnucash/commit/e210f8cd (commit)



commit 9e0e6e1f69da804b18b52ac70dd4c80f11563b15
Author: Christian Stimming <christian at cstimming.de>
Date:   Mon Sep 8 21:16:25 2014 +0200

    Fix aqbanking handling of transaction templates.
    
    Also, make the unittest less verbose.

diff --git a/src/import-export/aqb/gnc-ab-transfer.c b/src/import-export/aqb/gnc-ab-transfer.c
index 35685a7..9ca81c0 100644
--- a/src/import-export/aqb/gnc-ab-transfer.c
+++ b/src/import-export/aqb/gnc-ab-transfer.c
@@ -158,12 +158,6 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
         /* Let the user enter the values */
         result = gnc_ab_trans_dialog_run_until_ok(td);
 
-        if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER)
-        {
-            aborted = TRUE;
-            goto repeat;
-        }
-
         /* Save the templates */
         templates = gnc_ab_trans_dialog_get_templ(td, &changed);
         if (changed)
@@ -172,6 +166,12 @@ gnc_ab_maketrans(GtkWidget *parent, Account *gnc_acc,
         g_list_free(templates);
         templates = NULL;
 
+        if (result != GNC_RESPONSE_NOW && result != GNC_RESPONSE_LATER)
+        {
+            aborted = TRUE;
+            goto repeat;
+        }
+
         /* Get a job and enqueue it */
         ab_trans = gnc_ab_trans_dialog_get_ab_trans(td);
         job = gnc_ab_trans_dialog_get_job(td);
diff --git a/src/import-export/aqb/test/test-kvp.c b/src/import-export/aqb/test/test-kvp.c
index a001f1b..dcb6df1 100644
--- a/src/import-export/aqb/test/test-kvp.c
+++ b/src/import-export/aqb/test/test-kvp.c
@@ -166,11 +166,13 @@ test_qofsession_aqb_kvp( void )
 
             g_assert(account);
 
-            if (0)
+            // The interesting test case here: Can we read the correct date
+            // from the xml file?
+            if (1)
             {
                 Timespec retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
                 g_test_message("retrieved_ts=%s\n", gnc_print_date(retrieved_ts));
-                printf("Time=%s\n", gnc_print_date(retrieved_ts));
+                //printf("Time=%s\n", gnc_print_date(retrieved_ts));
 
                 retrieved_date = timespec_to_gdate(retrieved_ts);
                 g_date_set_dmy(&original_date, 29, 8, 2014);
@@ -178,7 +180,10 @@ test_qofsession_aqb_kvp( void )
                 g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);
             }
 
-            if (1)
+            // A lower-level test here: Can we write and read again the
+            // trans_retrieval date? This wouldn't need this particular
+            // Account, just a general Account object.
+            if (0)
             {
                 Timespec original_ts = timespec_now(), retrieved_ts;
 
@@ -187,17 +192,17 @@ test_qofsession_aqb_kvp( void )
                 gnc_ab_set_account_trans_retrieval(account, original_ts);
                 retrieved_ts = gnc_ab_get_account_trans_retrieval(account);
 
-                printf("original_ts=%s = %d  retrieved_ts=%s = %d\n",
-                       gnc_print_date(original_ts), original_ts.tv_sec,
-                       gnc_print_date(retrieved_ts), retrieved_ts.tv_sec);
+//                printf("original_ts=%s = %d  retrieved_ts=%s = %d\n",
+//                       gnc_print_date(original_ts), original_ts.tv_sec,
+//                       gnc_print_date(retrieved_ts), retrieved_ts.tv_sec);
 
                 original_date = timespec_to_gdate(original_ts);
                 retrieved_date = timespec_to_gdate(retrieved_ts);
 
                 qof_print_gdate (buff, sizeof (buff), &original_date);
-                printf("original_date=%s\n", buff);
+                //printf("original_date=%s\n", buff);
                 qof_print_gdate (buff, sizeof (buff), &retrieved_date);
-                printf("retrieved_date=%s\n", buff);
+                //printf("retrieved_date=%s\n", buff);
 
                 // Is the retrieved date identical to the one written
                 g_assert_cmpint(g_date_compare(&retrieved_date, &original_date), ==, 0);



Summary of changes:
 src/import-export/aqb/gnc-ab-transfer.c | 12 ++++++------
 src/import-export/aqb/test/test-kvp.c   | 21 +++++++++++++--------
 2 files changed, 19 insertions(+), 14 deletions(-)



More information about the gnucash-changes mailing list