From 39030f8a73bca32f2abc7c00bd4edbbdd97caced Mon Sep 17 00:00:00 2001 From: Christian Stimming Date: Fri, 25 Mar 2011 19:56:51 +0000 Subject: [PATCH] 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 --- src/import-export/import-backend.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/import-export/import-backend.c b/src/import-export/import-backend.c index 4ad3e09cbd..7f045cebe6 100644 --- a/src/import-export/import-backend.c +++ b/src/import-export/import-backend.c @@ -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))