r17544 - gnucash/branches/2.2/src/import-export/aqbanking - [r17495] Bug #548601: Do not import unawaited zero balances from aqbanking.
Andreas Köhler
andi5 at cvs.gnucash.org
Wed Sep 17 13:35:23 EDT 2008
Author: andi5
Date: 2008-09-17 13:35:23 -0400 (Wed, 17 Sep 2008)
New Revision: 17544
Trac: http://svn.gnucash.org/trac/changeset/17544
Modified:
gnucash/branches/2.2/src/import-export/aqbanking/gnc-ab-utils.c
Log:
[r17495] Bug #548601: Do not import unawaited zero balances from aqbanking.
Check whether an unawaited balance is zero and simply ignore it in this case.
Unawaited here means that the user asked the application to fetch transactions,
issue a transaction or anything else not resembling the fetching of account
balances.
Patch from Micha Lenk.
Modified: gnucash/branches/2.2/src/import-export/aqbanking/gnc-ab-utils.c
===================================================================
--- gnucash/branches/2.2/src/import-export/aqbanking/gnc-ab-utils.c 2008-09-17 17:35:14 UTC (rev 17543)
+++ gnucash/branches/2.2/src/import-export/aqbanking/gnc-ab-utils.c 2008-09-17 17:35:23 UTC (rev 17544)
@@ -593,7 +593,24 @@
else
data->awaiting |= FOUND_BALANCES;
+ /* Lookup the most recent ACCOUNT_STATUS available */
+ item = AB_ImExporterAccountInfo_GetFirstAccountStatus(element);
+ while (item) {
+ const GWEN_TIME *item_time = AB_AccountStatus_GetTime(item);
+ if (!best || GWEN_Time_Diff(best_time, item_time) < 0.0) {
+ best = item;
+ best_time = item_time;
+ }
+ item = AB_ImExporterAccountInfo_GetNextAccountStatus(element);
+ }
+
+ booked_bal = AB_AccountStatus_GetBookedBalance(best);
if (!(data->awaiting & AWAIT_BALANCES)) {
+ /* Ignore zero balances if we don't await a balance */
+ if (!booked_bal || AB_Value_IsZero(AB_Balance_GetValue(booked_bal)))
+ return NULL;
+
+ /* Ask the user whether to import unawaited non-zero balance */
if (gnc_verify_dialog(data->parent, TRUE, "%s",
_("The bank has sent balance information "
"in its response."
@@ -611,19 +628,7 @@
if (!gnc_acc) return NULL;
data->gnc_acc = gnc_acc;
- /* Lookup the most recent ACCOUNT_STATUS available */
- item = AB_ImExporterAccountInfo_GetFirstAccountStatus(element);
- while (item) {
- const GWEN_TIME *item_time = AB_AccountStatus_GetTime(item);
- if (!best || GWEN_Time_Diff(best_time, item_time) < 0.0) {
- best = item;
- best_time = item_time;
- }
- item = AB_ImExporterAccountInfo_GetNextAccountStatus(element);
- }
-
/* Lookup booked balance and time */
- booked_bal = AB_AccountStatus_GetBookedBalance(best);
if (booked_bal) {
const GWEN_TIME *ti = AB_Balance_GetTime(booked_bal);
if (ti) {
More information about the gnucash-changes
mailing list