mirror of
https://github.com/Gnucash/gnucash.git
synced 2025-02-25 18:55:30 -06:00
Revert the change in December about date matching threshold.
2005-02-21 Christian Stimming <stimming@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.) git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@10909 57a11ea4-9604-0410-9ed3-97b8803252fd
This commit is contained in:
parent
26ad9d4348
commit
77e3d2d674
@ -1,3 +1,12 @@
|
||||
2005-02-21 Christian Stimming <stimming@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-20 Neil Williams <linux@codehelp.co.uk>
|
||||
* src/engine/qof_book_merge.c: Fix double free of the targetList
|
||||
entities that cause xaccGroupGetNumSubAccounts to generate a
|
||||
|
@ -206,7 +206,7 @@ gnc_hbci_gettrans_final(GtkWidget *parent,
|
||||
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;
|
||||
|
@ -616,11 +616,8 @@ static void split_find_match (GNCImportTransInfo * trans_info,
|
||||
{
|
||||
/* 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 @@ static void split_find_match (GNCImportTransInfo * trans_info,
|
||||
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 @@ static void split_find_match (GNCImportTransInfo * trans_info,
|
||||
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 @@ void gnc_import_find_split_matches(GNCImportTransInfo *trans_info,
|
||||
xaccQueryAddSingleAccountMatch (query, importaccount,
|
||||
QOF_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,
|
||||
QOF_QUERY_AND);
|
||||
list_element = xaccQueryGetSplits (query);
|
||||
/* Sigh. Doesnt help too much. We still create and run one query
|
||||
@ -1072,7 +1071,8 @@ gnc_import_TransInfo_init_matches (GNCImportTransInfo *trans_info,
|
||||
/* 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)
|
||||
{
|
||||
|
@ -71,10 +71,21 @@ gboolean gnc_import_exists_online_id (Transaction *trans);
|
||||
* @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 @@ void gnc_import_find_split_matches(GNCImportTransInfo *transaction_info,
|
||||
* @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);
|
||||
|
@ -380,8 +380,9 @@ static void gnc_gen_trans_list_thaw (GNCImportMainMatcher *gui)
|
||||
}
|
||||
|
||||
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;
|
||||
@ -393,6 +394,7 @@ GNCImportMainMatcher *gnc_gen_trans_list_new (GtkWidget *parent,
|
||||
|
||||
/* 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");
|
||||
|
@ -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);
|
||||
|
||||
|
@ -84,6 +84,7 @@ struct _genimportsettings {
|
||||
/** The allowed amount range for fuzzy amount matching,
|
||||
in the users default commodity.*/
|
||||
double fuzzy_amount;
|
||||
gint match_date_hardlimit;
|
||||
};
|
||||
|
||||
|
||||
@ -122,7 +123,8 @@ gnc_import_Settings_new (void)
|
||||
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 @@ gint gnc_import_Settings_get_display_threshold (GNCImportSettings *settings)
|
||||
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;
|
||||
}
|
||||
|
||||
/**@}*/
|
||||
|
@ -36,8 +36,17 @@ typedef struct _genimportsettings GNCImportSettings;
|
||||
|
||||
|
||||
|
||||
/** 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 @@ gint gnc_import_Settings_get_add_threshold (GNCImportSettings *settings);
|
||||
/** 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);
|
||||
|
||||
/**@}*/
|
||||
/**@}*/
|
||||
|
||||
|
@ -642,7 +642,7 @@ void gnc_file_ofx_import (void)
|
||||
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 */
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user