From 0083bc59cbd20a7104eab7d0c557ca1bd114ce5d Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Sun, 6 Feb 2005 14:31:37 +0000 Subject: [PATCH] Fix HBCI date range for statement download. 2005-02-06 Christian Stimming * src/import-export/hbci/gnc-hbci-gettrans.c: Fix HBCI date range for statement download. git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10451 57a11ea4-9604-0410-9ed3-97b8803252fd --- ChangeLog | 5 ++ src/import-export/hbci/gnc-hbci-gettrans.c | 54 +++++++++++----------- 2 files changed, 33 insertions(+), 26 deletions(-) diff --git a/ChangeLog b/ChangeLog index d527f2b82b..9770d218fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-06 Christian Stimming + + * src/import-export/hbci/gnc-hbci-gettrans.c: Fix HBCI date range + for statement download. + 2005-02-05 Derek Atkins * src/report/locale-specific/us/Makefile.am: make sure the diff --git a/src/import-export/hbci/gnc-hbci-gettrans.c b/src/import-export/hbci/gnc-hbci-gettrans.c index 62e64f8cfd..fe8e46be5f 100644 --- a/src/import-export/hbci/gnc-hbci-gettrans.c +++ b/src/import-export/hbci/gnc-hbci-gettrans.c @@ -123,7 +123,8 @@ gnc_hbci_gettrans (GtkWidget *parent, Account *gnc_acc) 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 @@ gettrans_dates(GtkWidget *parent, Account *gnc_acc, 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; + /* 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(&()))*/ + /*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 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)); + } - /* 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 @@ gnc_hbci_gettrans_final(GtkWidget *parent, 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."),