gnucash maint: Bug 798578 - MT940 imports broken - all transactions have date of...
John Ralls
jralls at code.gnucash.org
Thu Jul 28 18:16:53 EDT 2022
Updated via https://github.com/Gnucash/gnucash/commit/436110e5 (commit)
from https://github.com/Gnucash/gnucash/commit/1d5e9d4d (commit)
commit 436110e523e5530e67d8d21410270fe7d495b0ea
Author: John Ralls <jralls at ceridwen.us>
Date: Thu Jul 28 14:55:12 2022 -0700
Bug 798578 - MT940 imports broken - all transactions have date of...
first transaction
It's really the date of the opening balance and it's because AQBanking
returns that instead of the value date if a transaction field has
no entry date.: https://www.aquamaniac.de/rdm/issues/262
diff --git a/gnucash/import-export/aqb/gnc-ab-utils.c b/gnucash/import-export/aqb/gnc-ab-utils.c
index e8809eed2..f78585680 100644
--- a/gnucash/import-export/aqb/gnc-ab-utils.c
+++ b/gnucash/import-export/aqb/gnc-ab-utils.c
@@ -111,7 +111,7 @@ gnc_gwen_date_to_time64 (const GNC_GWEN_DATE* date)
* that's the case then back up a day to get a real date for
* posting.
*/
- if (month == 2 && day <= 30 && day > (is_leap_year(year) ? 29 : 28))
+ while (month == 2 && day <= 30 && day > (is_leap_year(year) ? 29 : 28))
--day;
return gnc_dmy2time64_neutral(day, month, year);
#else
@@ -600,16 +600,16 @@ gnc_ab_trans_to_gnc(const AB_TRANSACTION *ab_trans, Account *gnc_acc)
* German). The value date is the effective date for financial
* calculation purposes and is mandatory, the entry date is the
* date that the financial institution posted the
- * transaction. Since the entry date is normally closer to the
- * date that the customer's book should recognize the transaction
- * we prefer that date if present.
+ * transaction. Unfortunately if the transaction field doesn't
+ * provide an entry date AQBanking substitutes the date from the
+ * last balance instead of using the value date or NULL, making
+ * the field unreliable.
*/
- post_date = AB_Transaction_GetDate(ab_trans);
value_date = AB_Transaction_GetValutaDate(ab_trans);
- if (post_date)
- post_time = gnc_gwen_date_to_time64(post_date);
- else if (value_date)
+ if (value_date)
post_time = gnc_gwen_date_to_time64(value_date);
+ else if ((post_date = AB_Transaction_GetDate(ab_trans))) // always true
+ post_time = gnc_gwen_date_to_time64(post_date);
else
{
g_warning("transaction_cb: Import had no transaction date");
Summary of changes:
gnucash/import-export/aqb/gnc-ab-utils.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
More information about the gnucash-changes
mailing list