[Gnucash-changes] 2004-10-08 Benoit Grégoire <bock@step.polymtl.ca> *

Benoit Gr?goire bock at cvs.gnucash.org
Fri Oct 8 20:09:13 EDT 2004


Log Message:
-----------
2004-10-08  Benoit Grégoire <bock at step.polymtl.ca>
       	* src/import-export/import-backend.c:  Duplicate match tweaks:
               -Change MATCH_DATE_NOT_THRESHOLD from 3 weeks to two weeks
               -A transaction amount mismatch past the threshold is now punished by -5 instead of -1
               -Date mismatch is now worth -5 isntead of -10
               -Check number mismatch is now punished -2, but only if both numbers are NOT empty.
       	* src/import-export/ofx/gnc-ofx-import.c: Update for new LibOfx, this among other things, gives gnucash Microsoft OFC support.
       	* src/import-export/ofx/test/test-link.cL Update for new LibOfx.
       	* configure.in:  Partly update for new libofx.  It will crash if the right version isn't available, but there is no explicit version support (if someone wants to code it, you can use the output of "ofxdump --version".
	* src/gnome-utils/gnc-query-list.c:  Fix gcc3.4 compile problem

Modified Files:
--------------
    gnucash:
        ChangeLog
        configure.in
    gnucash/src/gnome-utils:
        gnc-query-list.c
    gnucash/src/import-export:
        import-backend.c
    gnucash/src/import-export/ofx:
        gnc-ofx-import.c
    gnucash/src/import-export/ofx/test:
        test-link.c

Revision Data
-------------
Index: configure.in
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/configure.in,v
retrieving revision 1.395
retrieving revision 1.396
diff -Lconfigure.in -Lconfigure.in -u -r1.395 -r1.396
--- configure.in
+++ configure.in
@@ -549,13 +549,9 @@
     LIBS="${LIBS} ${LIBOFX_LIBS}"
     AC_TRY_LINK( [
 #include <libofx/libofx.h>
-int ofx_proc_status_cb(const struct OfxStatusData data) { return 0; }
-int ofx_proc_account_cb(const struct OfxAccountData data) { return 0; }
-int ofx_proc_security_cb(const struct OfxSecurityData data) { return 0; }
-int ofx_proc_transaction_cb(const struct OfxTransactionData data) { return 0; }
-int ofx_proc_statement_cb(const struct OfxStatementData data) { return 0; }
 	], [
-	ofx_proc_file(0, NULL);
+	LibofxContextPtr libofx_context = libofx_get_new_context();
+	libofx_free_context(libofx_context);
 	], AC_MSG_RESULT(yes),
 	[ AC_MSG_ERROR([*** Cannot compile test program for libofx library. Please check config.log for the exact error.]) ] )
 
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1843
retrieving revision 1.1844
diff -LChangeLog -LChangeLog -u -r1.1843 -r1.1844
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,15 @@
+2004-10-08  Benoit Grégoire <bock at step.polymtl.ca>
+       	* src/import-export/import-backend.c:  Duplicate match tweaks:
+               -Change MATCH_DATE_NOT_THRESHOLD from 3 weeks to two weeks
+               -A transaction amount mismatch past the threshold is now punished by -5 instead of -1
+               -Date mismatch is now worth -5 isntead of -10
+               -Check number mismatch is now punished -2, but only if both numbers are NOT empty.
+       	* src/import-export/ofx/gnc-ofx-import.c: Update for new LibOfx, this among other things, gives gnucash Microsoft OFC support.
+       	* src/import-export/ofx/test/test-link.cL Update for new LibOfx.
+       	* configure.in:  Partly update for new libofx.  It will crash if the right version isn't available, but there is no explicit version support (if someone wants to code it, you can use the output of "ofxdump --version".
+	* src/gnome-utils/gnc-query-list.c:  Fix gcc3.4 compile problem
+
+
 2004-09-30  Christian Stimming  <stimming at tuhh.de>
 
 	* src/import-export/hbci/gnc-hbci-getbalance.c: Fix HBCI balance
Index: gnc-ofx-import.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/ofx/gnc-ofx-import.c,v
retrieving revision 1.32
retrieving revision 1.33
diff -Lsrc/import-export/ofx/gnc-ofx-import.c -Lsrc/import-export/ofx/gnc-ofx-import.c -u -r1.32 -r1.33
--- src/import-export/ofx/gnc-ofx-import.c
+++ src/import-export/ofx/gnc-ofx-import.c
@@ -1,4 +1,4 @@
-/********************************************************************\
+/*******************************************************************\
  * This program is free software; you can redistribute it and/or    *
  * modify it under the terms of the GNU General Public License as   *
  * published by the Free Software Foundation; either version 2 of   *
@@ -72,64 +72,18 @@
    ofx_proc_transaction_cb can use it. */
 GNCImportMainMatcher *gnc_ofx_importer_gui = NULL;
 
-void gnc_file_ofx_import (void)
-{
-  extern int ofx_PARSER_msg;
-  extern int ofx_DEBUG_msg;
-  extern int ofx_WARNING_msg;
-  extern int ofx_ERROR_msg;
-  extern int ofx_INFO_msg;
-  extern int ofx_STATUS_msg;
-  char *filenames[3];
-  const char *selected_filename;
-  char *default_dir;
-
-  ofx_PARSER_msg = false;
-  ofx_DEBUG_msg = false;
-  ofx_WARNING_msg = true;
-  ofx_ERROR_msg = true;
-  ofx_INFO_msg = true;
-  ofx_STATUS_msg = false;
-
-  gnc_set_log_level(MOD_IMPORT, GNC_LOG_TRACE);
-  ENTER(" ");
-
-  default_dir = gnc_lookup_string_option("__paths", "Import OFX", NULL);
-  if (default_dir == NULL)
-    gnc_init_default_directory(&default_dir);
-  selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
-				      NULL,
-				      default_dir);
-
-  if(selected_filename!=NULL)
-    {
-      /* Remember the directory as the default. */
-      gnc_extract_directory(&default_dir, selected_filename);
-      gnc_set_string_option("__paths", "Import OFX", default_dir);
-      g_free(default_dir);
-
-      /*strncpy(file,selected_filename, 255);*/
-      DEBUG("Filename found: %s",selected_filename);
-      filenames[0]=NULL;
-      filenames[1]= (char *)selected_filename;
-      /*      filenames[1]=file;*/
-      filenames[2]=NULL;
-
-      /* Create the Generic transaction importer GUI. */
-      gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE);
-
-      DEBUG("Opening selected file");
-      ofx_proc_file(2, filenames);
-    }
-
-}
-
+/*
 int ofx_proc_status_cb(struct OfxStatusData data)
 {
   return 0;
 }
+*/
 
-int ofx_proc_security_cb(const struct OfxSecurityData data)
+int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data);
+int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data);
+int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data);
+
+int ofx_proc_security_cb(const struct OfxSecurityData data, void * security_user_data)
 {
   char * tmp_exchange_code=NULL;
   char * tmp_default_fullname=NULL;
@@ -155,7 +109,7 @@
   return 0;
 }
 
-int ofx_proc_transaction_cb(struct OfxTransactionData data)
+int ofx_proc_transaction_cb(struct OfxTransactionData data, void * transaction_user_data)
 {
   char dest_string[255];
   time_t current_time; 
@@ -563,12 +517,14 @@
   return 0;
 }//end ofx_proc_transaction()
 
-int ofx_proc_statement_cb(struct OfxStatementData data)
+/*
+int ofx_proc_statement_cb(struct OfxStatementData data, void * statement_user_data)
 {
   return 0;
 }//end ofx_proc_statement()
+*/
 
-int ofx_proc_account_cb(struct OfxAccountData data)
+int ofx_proc_account_cb(struct OfxAccountData data, void * account_user_data)
 {
   Account *selected_account;
   gnc_commodity_table * commodity_table;
@@ -646,4 +602,62 @@
   return 0;
 }
 
+void gnc_file_ofx_import (void)
+{
+  extern int ofx_PARSER_msg;
+  extern int ofx_DEBUG_msg;
+  extern int ofx_WARNING_msg;
+  extern int ofx_ERROR_msg;
+  extern int ofx_INFO_msg;
+  extern int ofx_STATUS_msg;
+  const char *selected_filename;
+  char *default_dir;
+  LibofxContextPtr libofx_context = libofx_get_new_context();
+
+  ofx_PARSER_msg = false;
+  ofx_DEBUG_msg = false;
+  ofx_WARNING_msg = true;
+  ofx_ERROR_msg = true;
+  ofx_INFO_msg = true;
+  ofx_STATUS_msg = false;
+
+  gnc_should_log(MOD_IMPORT, GNC_LOG_TRACE);
+  DEBUG("gnc_file_ofx_import(): Begin...\n");
+
+  default_dir = gnc_lookup_string_option("__paths", "Import OFX", NULL);
+  if (default_dir == NULL)
+    gnc_init_default_directory(&default_dir);
+  selected_filename = gnc_file_dialog(_("Select an OFX/QFX file to process"),
+				      NULL,
+				      default_dir);
+
+  if(selected_filename!=NULL)
+    {
+      /* Remember the directory as the default. */
+      gnc_extract_directory(&default_dir, selected_filename);
+      gnc_set_string_option("__paths", "Import OFX", default_dir);
+      g_free(default_dir);
+
+      /*strncpy(file,selected_filename, 255);*/
+      DEBUG("Filename found: %s",selected_filename);
+
+      /* Create the Generic transaction importer GUI. */
+      gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE);
+
+      /* Initialize libofx */
+
+      /*ofx_set_statement_cb(libofx_context, ofx_proc_statement_cb, 0);*/
+      ofx_set_account_cb(libofx_context, ofx_proc_account_cb, 0);
+      ofx_set_transaction_cb(libofx_context, ofx_proc_transaction_cb, 0);
+      ofx_set_security_cb(libofx_context, ofx_proc_security_cb, 0);
+      /*ofx_set_status_cb(libofx_context, ofx_proc_status_cb, 0);*/
+
+
+      DEBUG("Opening selected file");
+     libofx_proc_file(libofx_context, selected_filename, AUTODETECT);
+    }
+
+}
+
+
 /** @} */
Index: import-backend.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-backend.c,v
retrieving revision 1.27
retrieving revision 1.28
diff -Lsrc/import-export/import-backend.c -Lsrc/import-export/import-backend.c -u -r1.27 -r1.28
--- src/import-export/import-backend.c
+++ src/import-export/import-backend.c
@@ -58,7 +58,7 @@
 \********************************************************************/
 
 static const int MATCH_DATE_THRESHOLD=4; /*within 4 days*/
-static const int MATCH_DATE_NOT_THRESHOLD = 21;
+static const int MATCH_DATE_NOT_THRESHOLD = 14;
 /**Transaction's who have an online_id kvp frame have been downloaded 
   online can probably be skipped in the match list, since it is very 
   unlikely that they would match a transaction downloaded at a later
@@ -615,8 +615,8 @@
 	{
 	  /* If a transaction's amount doesn't match within the
 	     threshold, it's very unlikely to be the same transaction
-	     so we give it an extra -1 penality */
-	  prob = prob-1;
+	     so we give it an extra -5 penality */
+	  prob = prob-5;
 	  /* DEBUG("heuristics:  probability - 1 (amount)"); */
 	}
       
@@ -645,8 +645,8 @@
 	{
 	  /* Extra penalty if that split lies awfully far away
 	     from the given one. */
-	  prob = prob-10;
-	  /*DEBUG("heuristics:  probability - 10 (date)"); */
+	  prob = prob-5;
+	  /*DEBUG("heuristics:  probability - 5 (date)"); */
 	}
       
       /* Check number heuristics */  
@@ -657,10 +657,16 @@
 		     xaccTransGetNum(xaccSplitGetParent(split)))
 	      ==0))
 	    {	
-	      /*An exact match of the Check number gives a +5 */
-	      prob = prob+5;
+	      /*An exact match of the Check number gives a +4 */
+	      prob = prob+4;
 	      /*DEBUG("heuristics:  probability + 5 (Check number)");*/
 	    }
+	  else if(strlen(xaccTransGetNum(gnc_import_TransInfo_get_trans (trans_info))) > 0 &&
+		  strlen(xaccTransGetNum(xaccSplitGetParent(split))) > 0)
+	    {
+	      /* If both number are not empty yet do not match, add a little extre penality */
+	      prob = prob-2;
+	    }
 	}
       
       /* Memo heuristics */  
Index: gnc-query-list.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/gnome-utils/gnc-query-list.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -Lsrc/gnome-utils/gnc-query-list.c -Lsrc/gnome-utils/gnc-query-list.c -u -r1.10 -r1.11
--- src/gnome-utils/gnc-query-list.c
+++ src/gnome-utils/gnc-query-list.c
@@ -764,6 +764,7 @@
   gchar *strings[list->num_columns + 1];
   GList *entries, *item;
   const GUID *guid;
+  const QofParam *gup;
   gint i;
 
   /* Clear all watches */
@@ -828,7 +829,7 @@
     update_booleans (list, row);
 
     /* and set a watcher on this item */
-    const QofParam *gup = list->priv->get_guid;
+    gup = list->priv->get_guid;
     guid = (const GUID*)((gup->param_getfcn)(item->data, gup));
     gnc_gui_component_watch_entity (list->priv->component_id, guid,
 				    GNC_EVENT_MODIFY | GNC_EVENT_DESTROY);
Index: test-link.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/ofx/test/test-link.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -Lsrc/import-export/ofx/test/test-link.c -Lsrc/import-export/ofx/test/test-link.c -u -r1.2 -r1.3
--- src/import-export/ofx/test/test-link.c
+++ src/import-export/ofx/test/test-link.c
@@ -5,23 +5,3 @@
   return 0;
 }
 
-int ofx_proc_status_cb(struct OfxStatusData data)
-{
-	return 0;
-}
-int ofx_proc_security_cb(struct OfxSecurityData data)
-{
-	return 0;
-}
-int ofx_proc_transaction_cb(struct OfxTransactionData data)
-{
-	return 0;
-}
-int ofx_proc_statement_cb(struct OfxStatementData data)
-{
-	return 0;
-}
-int ofx_proc_account_cb(struct OfxAccountData data)
-{
-	return 0;
-}


More information about the gnucash-changes mailing list