Bug #645406: Make transaction matching on memo and description case-insensitive

Patch by gnemas:

The function split_find_match() in import-backend.c scores
transactions according to comparisons of amount, date, description,
etc.

I noticed that the comparison of the description and memo fields is
case-sensitive.

This means that my supermarket entries that have descriptions "Giant
Food" do not match the downloaded descriptions "GIANT FOOD".

This applies to both the exact and the 50% match cases, and for both
the memo and the description fields.

The attached patch should fix this.

git-svn-id: svn+ssh://svn.gnucash.org/repo/gnucash/trunk@20478 57a11ea4-9604-0410-9ed3-97b8803252fd
pull/1/head
Christian Stimming 15 years ago
parent 6e987e23f0
commit 39030f8a73

@ -721,13 +721,13 @@ static void split_find_match (GNCImportTransInfo * trans_info,
const char *memo = xaccSplitGetMemo(new_trans_fsplit);
if (memo && strlen(memo) != 0)
{
if (safe_strcmp(memo, xaccSplitGetMemo(split)) == 0)
if (safe_strcasecmp(memo, xaccSplitGetMemo(split)) == 0)
{
/* An exact match of memo gives a +2 */
prob = prob + 2;
/* DEBUG("heuristics: probability + 2 (memo)"); */
}
else if ((strncmp(memo, xaccSplitGetMemo(split),
else if ((strncasecmp(memo, xaccSplitGetMemo(split),
strlen(xaccSplitGetMemo(split)) / 2)
== 0))
{
@ -746,7 +746,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
const char *descr = xaccTransGetDescription(new_trans);
if (descr && strlen(descr) != 0)
{
if (safe_strcmp(descr,
if (safe_strcasecmp(descr,
xaccTransGetDescription(xaccSplitGetParent(split)))
== 0)
{
@ -754,7 +754,7 @@ static void split_find_match (GNCImportTransInfo * trans_info,
prob = prob + 2;
/*DEBUG("heuristics: probability + 2 (description)");*/
}
else if ((strncmp(descr,
else if ((strncasecmp(descr,
xaccTransGetDescription (xaccSplitGetParent(split)),
strlen(xaccTransGetDescription (new_trans)) / 2)
== 0))

Loading…
Cancel
Save