[Gnucash-changes] Fix HBCI date range for statement download.

Christian Stimming cstim at cvs.gnucash.org
Sun Feb 6 09:30:43 EST 2005


Log Message:
-----------
Fix HBCI date range for statement download.

2005-02-06  Christian Stimming  <stimming at tuhh.de>

	* src/import-export/hbci/gnc-hbci-gettrans.c: Fix HBCI date range
	for statement download.

Tags:
----
gnucash-1-8-branch

Modified Files:
--------------
    gnucash:
        ChangeLog
    gnucash/src/import-export/hbci:
        gnc-hbci-gettrans.c

Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.393
retrieving revision 1.1461.2.394
diff -LChangeLog -LChangeLog -u -r1.1461.2.393 -r1.1461.2.394
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,8 @@
+2005-02-06  Christian Stimming  <stimming at tuhh.de>
+
+	* src/import-export/hbci/gnc-hbci-gettrans.c: Fix HBCI date range
+	for statement download.
+
 2005-01-05  Derek Atkins  <derek at ihtfp.com>
 
 	* src/report/locale-specific/us/gncmod-locale-reports-us.c:
Index: gnc-hbci-gettrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c,v
retrieving revision 1.20.2.6
retrieving revision 1.20.2.7
diff -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -u -r1.20.2.6 -r1.20.2.7
--- src/import-export/hbci/gnc-hbci-gettrans.c
+++ src/import-export/hbci/gnc-hbci-gettrans.c
@@ -123,7 +123,8 @@
     gnc_hbci_cleanup_job(api, job);
     gnc_AB_BANKING_fini (api);
     GNCInteractor_hide (interactor);
-    GWEN_Time_free (from_date);
+    if (from_date) 
+      GWEN_Time_free (from_date);
     GWEN_Time_free (to_date);
   }
 }
@@ -148,35 +149,36 @@
   last_timespec = gnc_hbci_get_account_trans_retrieval (gnc_acc);
   if (last_timespec.tv_sec == 0) {
     use_last_date = FALSE;
-      timespecFromTime_t (&last_timespec, now);
-    }
-    timespecFromTime_t (&until_timespec, now);
+    timespecFromTime_t (&last_timespec, now);
+  }
+  timespecFromTime_t (&until_timespec, now);
+
+  /* Let the user choose the date range of retrieval */
+  if (!gnc_hbci_enter_daterange (parent, NULL, 
+				 &last_timespec, 
+				 &use_last_date, &use_earliest_date,
+				 &until_timespec, &use_until_now))
+    return FALSE;
+
+  /*printf("Retrieving transactions from date %s to date %s. \n",
+    ctime(&()))*/
+    
+  /* Now calculate from date */
+  if (use_earliest_date)
+    *from_date = NULL;
+  /* for an old version this was: from_date = GWEN_Time_fromSeconds(0); */
+  else {
+    if (use_last_date)
+      last_timespec = gnc_hbci_get_account_trans_retrieval (gnc_acc);
+    *from_date = GWEN_Time_fromSeconds(timespecToTime_t(last_timespec));
+  }
 
-    /* Let the user choose the date range of retrieval */
-    if (!gnc_hbci_enter_daterange (parent, NULL, 
-				   &last_timespec, 
-				   &use_last_date, &use_earliest_date,
-				   &until_timespec, &use_until_now))
-      return FALSE;
-
-    /*printf("Retrieving transactions from date %s to date %s. \n",
-	   ctime(&()))*/
-    
-    /* Now calculate from date */
-    if (use_earliest_date)
-      *from_date = GWEN_Time_fromSeconds(0);
-    else {
-      if (use_last_date)
-	last_timespec = gnc_hbci_get_account_trans_retrieval (gnc_acc);
-      *from_date = GWEN_Time_fromSeconds(timespecToTime_t(last_timespec));
-    }
-
-    /* Now calculate to date */
-    if (use_until_now)
-      timespecFromTime_t (&until_timespec, now);
-    *to_date = GWEN_Time_fromSeconds(timespecToTime_t (until_timespec));
+  /* Now calculate to date */
+  if (use_until_now)
+    timespecFromTime_t (&until_timespec, now);
+  *to_date = GWEN_Time_fromSeconds(timespecToTime_t (until_timespec));
 
-    return TRUE;
+  return TRUE;
 }
 
 
@@ -193,7 +195,7 @@
 
   trans_list = AB_JobGetTransactions_GetTransactions(trans_job);
   if (!trans_list) {
-    printf("gnc_hbci_gettrans_final: No transactions section. Response was:\n");
+    /* printf("gnc_hbci_gettrans_final: No transactions section. Response was:\n"); */
 
     gnome_ok_dialog_parented 
       (_("The HBCI import returned no transactions for the selected time period."),


More information about the gnucash-changes mailing list