[Gnucash-changes] 2005-02-21 Christian Stimming <stimming@tuhh.de>
*
Christian Stimming
cstim at cvs.gnucash.org
Mon Feb 21 15:51:36 EST 2005
Log Message:
-----------
2005-02-21 Christian Stimming <stimming at tuhh.de>
* src/import-export/import-backend.c, import-backend.h,
import-main-matcher.h: Revert the change in December about date
matching thresholds that broke some OFX import. Now, the hard
limit days interval is set by the importing sub-module when
creating the dialog. This way, HBCI and OFX can set their
different requirements. (Note: QIF does not use this code at all.)
Tags:
----
gnucash-1-8-branch
Modified Files:
--------------
gnucash:
ChangeLog
gnucash/src/import-export:
import-backend.c
import-backend.h
import-main-matcher.c
import-main-matcher.h
import-settings.c
import-settings.h
gnucash/src/import-export/hbci:
gnc-hbci-gettrans.c
gnucash/src/import-export/ofx:
gnc-ofx-import.c
Revision Data
-------------
Index: ChangeLog
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/ChangeLog,v
retrieving revision 1.1461.2.400
retrieving revision 1.1461.2.401
diff -LChangeLog -LChangeLog -u -r1.1461.2.400 -r1.1461.2.401
--- ChangeLog
+++ ChangeLog
@@ -1,3 +1,12 @@
+2005-02-21 Christian Stimming <stimming at tuhh.de>
+
+ * src/import-export/import-backend.c, import-backend.h,
+ import-main-matcher.h: Revert the change in December about date
+ matching thresholds that broke some OFX import. Now, the hard
+ limit days interval is set by the importing sub-module when
+ creating the dialog. This way, HBCI and OFX can set their
+ different requirements. (Note: QIF does not use this code at all.)
+
2005-02-16 Derek Atkins <derek at ihtfp.com>
* src/gnome-utils/dialog-utils.c: When trying to load the symbol
Index: import-settings.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-settings.h,v
retrieving revision 1.2
retrieving revision 1.2.2.1
diff -Lsrc/import-export/import-settings.h -Lsrc/import-export/import-settings.h -u -r1.2 -r1.2.2.1
--- src/import-export/import-settings.h
+++ src/import-export/import-settings.h
@@ -36,8 +36,17 @@
-/** Allocates a new GNCImportSettings object, and initialize it with the
- appropriate user prefs.
+/** Allocates a new GNCImportSettings object, and initialize it with
+ * the appropriate user prefs.
+ *
+ * @param match_date_hardlimit The number of days that a matching
+ * split may differ from the given transaction before it is discarded
+ * immediately. In other words, any split that is more distant from
+ * the given transaction than this match_date_hardlimit days will be
+ * ignored altogether. For use cases without paper checks (e.g. HBCI),
+ * values like 14 (days) might be appropriate, whereas for use cases
+ * with paper checks (e.g. OFX, QIF), values like 42 (days) seem more
+ * appropriate.
*/
GNCImportSettings *
gnc_import_Settings_new (void);
@@ -83,6 +92,20 @@
/** Return the selected threshold.
*/
gint gnc_import_Settings_get_display_threshold (GNCImportSettings *settings);
+
+/** @param match_date_hardlimit The number of days that a matching
+ * split may differ from the given transaction before it is discarded
+ * immediately. In other words, any split that is more distant from
+ * the given transaction than this match_date_hardlimit days will be
+ * ignored altogether. For use cases without paper checks (e.g. HBCI),
+ * values like 14 (days) might be appropriate, whereas for use cases
+ * with paper checks (e.g. OFX, QIF), values like 42 (days) seem more
+ * appropriate.
+ */
+void gnc_import_Settings_set_match_date_hardlimit (GNCImportSettings *settings, gint match_date_hardlimit);
+/** Returns the hard-limiting number of days that a matching split may differ. */
+gint gnc_import_Settings_get_match_date_hardlimit (const GNCImportSettings *settings);
+
/**@}*/
/**@}*/
Index: import-backend.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-backend.h,v
retrieving revision 1.3.2.1
retrieving revision 1.3.2.2
diff -Lsrc/import-export/import-backend.h -Lsrc/import-export/import-backend.h -u -r1.3.2.1 -r1.3.2.2
--- src/import-export/import-backend.h
+++ src/import-export/import-backend.h
@@ -71,10 +71,21 @@
* @param fuzzy_amount_difference For fuzzy amount matching, a certain
* fuzzyness in the matching amount is allowed up to this value. May
* be e.g. 3.00 dollars for ATM fees, or 0.0 if you only want to allow
- * exact matches. */
+ * exact matches.
+ *
+ * @param match_date_hardlimit The number of days that a matching
+ * split may differ from the given transaction before it is discarded
+ * immediately. In other words, any split that is more distant from
+ * the given transaction than this match_date_hardlimit days will be
+ * ignored altogether. For use cases without paper checks (e.g. HBCI),
+ * values like 14 (days) might be appropriate, whereas for use cases
+ * with paper checks (e.g. OFX, QIF), values like 42 (days) seem more
+ * appropriate.
+ */
void gnc_import_find_split_matches(GNCImportTransInfo *transaction_info,
gint process_threshold,
- double fuzzy_amount_difference);
+ double fuzzy_amount_difference,
+ gint match_date_hardlimit);
/** Iterates through all splits of the originating account of
* trans_info. Sorts the resulting list and sets the selected_match
@@ -83,21 +94,8 @@
* @param trans_info The TransInfo for which the matches should be
* found, sorted, and selected.
*
- * @param clear_threshold If the heuristics of the best matching split
- * is higher or equal this value, 'clear' is selected as default
- * action.
- *
- * @param add_threshold If the heuristics of the best matching split
- * is lesser or equal this value, 'add' is selected as default
- * action.
- *
- * @paran process_threshold Each potential match whose heuristics are
- * smaller than this value is totally ignored.
- *
- * @param fuzzy_amount_difference For fuzzy amount matching, a certain
- * fuzzyness in the matching amount is allowed up to this value. May
- * be e.g. 3.00 dollars for ATM fees, or 0.0 if you only want to allow
- * exact matches. */
+ * @param settings The structure that holds all the user preferences.
+ */
void
gnc_import_TransInfo_init_matches (GNCImportTransInfo *trans_info,
GNCImportSettings *settings);
Index: import-settings.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-settings.c,v
retrieving revision 1.4.2.1
retrieving revision 1.4.2.2
diff -Lsrc/import-export/import-settings.c -Lsrc/import-export/import-settings.c -u -r1.4.2.1 -r1.4.2.2
--- src/import-export/import-settings.c
+++ src/import-export/import-settings.c
@@ -84,6 +84,7 @@
/** The allowed amount range for fuzzy amount matching,
in the users default commodity.*/
double fuzzy_amount;
+ gint match_date_hardlimit;
};
@@ -122,7 +123,8 @@
settings->fuzzy_amount =
gnc_lookup_number_option(MATCHER_PREF_PAGE,"Commercial ATM fees threshold",
DEFAULT_ATM_FEE_THRESHOLD);
-
+
+ settings->match_date_hardlimit = 42; /* 6 weeks */
return settings;
}
@@ -183,4 +185,15 @@
return settings->display_threshold;
};
+void gnc_import_Settings_set_match_date_hardlimit (GNCImportSettings *s, gint m)
+{
+ g_assert(s);
+ s->match_date_hardlimit = m;
+}
+gint gnc_import_Settings_get_match_date_hardlimit (const GNCImportSettings *s)
+{
+ g_assert(s);
+ return s->match_date_hardlimit;
+}
+
/**@}*/
Index: import-main-matcher.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-main-matcher.c,v
retrieving revision 1.10
retrieving revision 1.10.2.1
diff -Lsrc/import-export/import-main-matcher.c -Lsrc/import-export/import-main-matcher.c -u -r1.10 -r1.10.2.1
--- src/import-export/import-main-matcher.c
+++ src/import-export/import-main-matcher.c
@@ -371,8 +371,9 @@
}
GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
- const gchar* heading,
- gboolean all_from_same_account)
+ const gchar* heading,
+ gboolean all_from_same_account,
+ gint match_date_hardlimit)
{
GNCImportMainMatcher *info;
GladeXML *xml;
@@ -384,6 +385,7 @@
/* Initialize user Settings. */
info->user_settings = gnc_import_Settings_new ();
+ gnc_import_Settings_set_match_date_hardlimit (info->user_settings, match_date_hardlimit);
/* Initialize the GnomeDialog. */
xml = gnc_glade_xml_new ("generic-import.glade", "transaction_matcher");
Index: import-backend.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-backend.c,v
retrieving revision 1.13.2.8
retrieving revision 1.13.2.9
diff -Lsrc/import-export/import-backend.c -Lsrc/import-export/import-backend.c -u -r1.13.2.8 -r1.13.2.9
--- src/import-export/import-backend.c
+++ src/import-export/import-backend.c
@@ -616,11 +616,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 -5 penality. Changed 2004-11-27:
- The penalty is so high that we can forget about this
- split anyway and skip the rest of the tests. */
- return;
- /* prob = prob-5; */
+ so we give it an extra -5 penality */
+ prob = prob-5;
/* DEBUG("heuristics: probability - 1 (amount)"); */
}
@@ -648,12 +645,13 @@
else if (datediff_day > MATCH_DATE_NOT_THRESHOLD)
{
/* Extra penalty if that split lies awfully far away from
- the given one. Changed 2004-11-27: The penalty is so high
- that we can forget about this split anyway and skip the
- rest of the tests. */
- return;
- /* prob = prob-5; */
+ the given one. */
+ prob = prob-5;
/*DEBUG("heuristics: probability - 5 (date)"); */
+ /* Changed 2005-02-21: Revert the hard-limiting behaviour
+ back to the previous large penalty. (Changed 2004-11-27:
+ The penalty is so high that we can forget about this
+ split anyway and skip the rest of the tests.) */
}
/* Check number heuristics */
@@ -768,7 +766,8 @@
transaction, and find all matching splits there. */
void gnc_import_find_split_matches(GNCImportTransInfo *trans_info,
gint process_threshold,
- double fuzzy_amount_difference)
+ double fuzzy_amount_difference,
+ gint match_date_hardlimit)
{
GList * list_element;
Query *query = xaccMallocQuery();
@@ -790,8 +789,8 @@
xaccQueryAddSingleAccountMatch (query, importaccount,
QUERY_AND);
xaccQueryAddDateMatchTT (query,
- TRUE, download_time - MATCH_DATE_NOT_THRESHOLD*86400/2,
- TRUE, download_time + MATCH_DATE_NOT_THRESHOLD*86400/2,
+ TRUE, download_time - match_date_hardlimit*86400,
+ TRUE, download_time + match_date_hardlimit*86400,
QUERY_AND);
list_element = xaccQueryGetSplits (query);
/* Sigh. Doesnt help too much. We still create and run one query
@@ -1072,7 +1071,8 @@
/* Find all split matches in originating account. */
gnc_import_find_split_matches(trans_info,
gnc_import_Settings_get_display_threshold (settings),
- gnc_import_Settings_get_fuzzy_amount (settings));
+ gnc_import_Settings_get_fuzzy_amount (settings),
+ gnc_import_Settings_get_match_date_hardlimit (settings));
if (trans_info->match_list != NULL)
{
Index: import-main-matcher.h
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/import-main-matcher.h,v
retrieving revision 1.3
retrieving revision 1.3.2.1
diff -Lsrc/import-export/import-main-matcher.h -Lsrc/import-export/import-main-matcher.h -u -r1.3 -r1.3.2.1
--- src/import-export/import-main-matcher.h
+++ src/import-export/import-main-matcher.h
@@ -33,25 +33,41 @@
typedef struct _main_matcher_info GNCImportMainMatcher;
/** Create a new generic transaction dialog window and return it.
- @param parent The parent GtkWidget. May be NULL.
- @param heading The heading label in the Importer window. May be NULL.
- @param all_from_same_account Set this to TRUE if ALL the transaction
- that will be added with gnc_gen_trans_list_add_trans are from the same
- source account. This will cause the account column to be hidden.
+ *
+ * @param parent The parent GtkWidget. May be NULL.
+ *
+ * @param heading The heading label in the Importer window. May be NULL.
+ *
+ * @param all_from_same_account Set this to TRUE if ALL the
+ * transaction that will be added with gnc_gen_trans_list_add_trans
+ * are from the same source account. This will cause the account
+ * column to be hidden.
+ *
+ * @param match_date_hardlimit The number of days that a matching
+ * split may differ from the given transaction before it is discarded
+ * immediately. In other words, any split that is more distant from
+ * the given transaction than this match_date_hardlimit days will be
+ * ignored altogether. For use cases without paper checks (e.g. HBCI),
+ * values like 14 (days) might be appropriate, whereas for use cases
+ * with paper checks (e.g. OFX, QIF), values like 42 (days) seem more
+ * appropriate.
*/
GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
const gchar* heading,
- gboolean all_from_same_account);
+ gboolean all_from_same_account,
+ gint match_date_hardlimit);
/** Deletes the given object. */
void gnc_gen_trans_list_delete (GNCImportMainMatcher *info);
/** Add a newly imported Transaction to the Transaction Importer.
- @param gui The Transaction Importer to use.
- @param trans The Transaction to add. The must contain at least
- one split, and this split must have been associated with an account
- Only the first split will be used for matching. The
- transaction must NOT be commited.
+ *
+ * @param gui The Transaction Importer to use.
+ *
+ * @param trans The Transaction to add. The must contain at least one
+ * split, and this split must have been associated with an account
+ * Only the first split will be used for matching. The transaction
+ * must NOT be commited.
*/
void gnc_gen_trans_list_add_trans(GNCImportMainMatcher *gui, Transaction *trans);
Index: gnc-hbci-gettrans.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/hbci/gnc-hbci-gettrans.c,v
retrieving revision 1.20.2.7
retrieving revision 1.20.2.8
diff -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -Lsrc/import-export/hbci/gnc-hbci-gettrans.c -u -r1.20.2.7 -r1.20.2.8
--- src/import-export/hbci/gnc-hbci-gettrans.c
+++ src/import-export/hbci/gnc-hbci-gettrans.c
@@ -206,7 +206,7 @@
if (trans_list && (AB_Transaction_List2_GetSize(trans_list) > 0)) {
struct trans_list_data data;
GNCImportMainMatcher *importer_generic_gui =
- gnc_gen_trans_list_new(NULL, NULL, TRUE);
+ gnc_gen_trans_list_new(NULL, NULL, TRUE, 14);
data.importer_generic = importer_generic_gui;
data.gnc_acc = gnc_acc;
Index: gnc-ofx-import.c
===================================================================
RCS file: /home/cvs/cvsroot/gnucash/src/import-export/ofx/gnc-ofx-import.c,v
retrieving revision 1.28.2.2
retrieving revision 1.28.2.3
diff -Lsrc/import-export/ofx/gnc-ofx-import.c -Lsrc/import-export/ofx/gnc-ofx-import.c -u -r1.28.2.2 -r1.28.2.3
--- src/import-export/ofx/gnc-ofx-import.c
+++ src/import-export/ofx/gnc-ofx-import.c
@@ -643,7 +643,7 @@
DEBUG("Filename found: %s",selected_filename);
/* Create the Generic transaction importer GUI. */
- gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE);
+ gnc_ofx_importer_gui = gnc_gen_trans_list_new(NULL, NULL, FALSE, 42);
/* Initialize libofx */
More information about the gnucash-changes
mailing list