[Gnucash-changes] r13386 - gnucash/trunk - Aqbanking-1.3.0 (released 2005-08-11) is sufficient for MT940 import.

Christian Stimming cstim at cvs.gnucash.org
Sat Feb 25 04:24:00 EST 2006


Author: cstim
Date: 2006-02-25 04:23:58 -0500 (Sat, 25 Feb 2006)
New Revision: 13386
Trac: http://svn.gnucash.org/trac/changeset/13386

Modified:
   gnucash/trunk/configure.in
   gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c
Log:
Aqbanking-1.3.0 (released 2005-08-11) is sufficient for MT940 import.

Modified: gnucash/trunk/configure.in
===================================================================
--- gnucash/trunk/configure.in	2006-02-25 08:18:39 UTC (rev 13385)
+++ gnucash/trunk/configure.in	2006-02-25 09:23:58 UTC (rev 13386)
@@ -751,12 +751,9 @@
 if test x${MT940_DIR} = xmt940 ;
 then
     AC_MSG_WARN([MT940 importing support is enabled but is totally experimental!])
-    # Use a very recent aqbanking (released 2006-02-06) due to significant
-    # simplifications with file importing. Since this is
-    # experimental and not used by anyone anyway, I guess it should be
-    # okay. May very well be disabled for 2.0.x stable series anyway.
-    PKG_CHECK_MODULES(HBCI, aqbanking >= "1.9.7", [], [
-      AC_AQBANKING(1,9,7)
+    PKG_CHECK_MODULES(HBCI, aqbanking >= "1.3.0", [], [
+      # aqbanking-1.3.0 was released on 2005-08-11
+      AC_AQBANKING(1,3,0)
       if test x${have_aqbanking} != xyes; 
       then
       	AC_MSG_ERROR([Could not find aqbanking. If you use --enable-mt940, you *have* to enable aqbanking.])

Modified: gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c
===================================================================
--- gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c	2006-02-25 08:18:39 UTC (rev 13385)
+++ gnucash/trunk/src/import-export/mt940/gnc-mt940-import.c	2006-02-25 09:23:58 UTC (rev 13386)
@@ -23,7 +23,6 @@
      @brief MT940 import module code
      @author Copyright (c) 2002 Benoit Grégoire <bock at step.polymtl.ca>, Copyright (c) 2003 Jan-Pascal van Best <janpascal at vanbest.org>, Copyright (c) 2006 Florian Steinel, 2006 Christian Stimming.
  */
- /* See aqbanking-1.6.0beta/src/tools/aqbanking-tool/import.c for hints */
 #define _GNU_SOURCE
 
 #include "config.h"
@@ -35,6 +34,7 @@
 #include <sys/time.h>
 #include <fcntl.h>
 
+#include <aqbanking/version.h>
 #include <aqbanking/banking.h>
 #include <aqbanking/imexporter.h>
 
@@ -66,9 +66,60 @@
 static AB_IMEXPORTER_ACCOUNTINFO *
 accountinfolist_cb(AB_IMEXPORTER_ACCOUNTINFO *element, void *user_data);
 
-/* Note: This is not yet tested,  see
+
+/* If aqbanking is older than 1.9.7, use our own copies of these
+   foreach functions */
+#if ((AQBANKING_VERSION_MAJOR == 1) && \
+     ((AQBANKING_VERSION_MINOR < 9) || \
+      ((AQBANKING_VERSION_MINOR == 9) && \
+       ((AQBANKING_VERSION_PATCHLEVEL < 7)))))
+static AB_IMEXPORTER_ACCOUNTINFO *
+AB_ImExporterContext_AccountInfoForEach(AB_IMEXPORTER_CONTEXT *iec,
+					AB_IMEXPORTER_ACCOUNTINFO_LIST2_FOREACH func,
+					void* user_data)
+{
+  AB_IMEXPORTER_ACCOUNTINFO *it;
+  AB_IMEXPORTER_ACCOUNTINFO *retval;
+  g_assert(iec);
+
+  it = AB_ImExporterContext_GetFirstAccountInfo (iec);
+  while (it) {
+    retval = func(it, user_data);
+    if (retval) {
+      return retval;
+    }
+    it = AB_ImExporterContext_GetNextAccountInfo (iec);
+  }
+  return 0;
+
+}
+static const AB_TRANSACTION *
+AB_ImExporterAccountInfo_TransactionsForEach(AB_IMEXPORTER_ACCOUNTINFO *iea,
+					     AB_TRANSACTION_CONSTLIST2_FOREACH func,
+					     void* user_data)
+{
+  const AB_TRANSACTION *it;
+  const AB_TRANSACTION *retval;
+  g_assert(iea);
+
+  it = AB_ImExporterAccountInfo_GetFirstTransaction (iea);
+  while (it) {
+    retval = func(it, user_data);
+    if (retval) {
+      return retval;
+    }
+    it = AB_ImExporterAccountInfo_GetNextTransaction (iea);
+  }
+  return 0;
+}
+#endif /* aqbanking < 1.9.7 */
+
+
+/* Note: The importing here is not yet tested with actual files, see
    http://bugzilla.gnome.org/show_bug.cgi?id=325170 . */
 
+/* See aqbanking-1.6.0beta/src/tools/aqbanking-tool/import.c for hints
+   on how to program aqbanking. */
 
 /********************************************************************\
  * gnc_file_mt940_import



More information about the gnucash-changes mailing list