From: Damyan Ivanov Date: Sat, 30 Jan 2021 21:06:16 +0000 (+0000) Subject: fix support for matching of transaction description/comment X-Git-Tag: v0.17.0~196 X-Git-Url: https://git.ktnx.net/?a=commitdiff_plain;h=72bbdba090181d9d725cd1d80f96e6ea1ab4c28c;p=mobile-ledger.git fix support for matching of transaction description/comment --- diff --git a/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java b/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java index 43c77f72..93528051 100644 --- a/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java +++ b/app/src/main/java/net/ktnx/mobileledger/model/PatternDetailsItem.java @@ -61,8 +61,17 @@ abstract public class PatternDetailsItem { header.setName(ph.getName()); header.setPattern(ph.getRegularExpression()); header.setTestText(ph.getTestText()); - header.setTransactionDescription(ph.getTransactionDescription()); - header.setTransactionComment(ph.getTransactionComment()); + + if (ph.getTransactionDescriptionMatchGroup() == null) + header.setTransactionDescription(ph.getTransactionDescription()); + else + header.setTransactionDescriptionMatchGroup(ph.getTransactionDescriptionMatchGroup()); + + if (ph.getTransactionCommentMatchGroup() == null) + header.setTransactionComment(ph.getTransactionComment()); + else + header.setTransactionCommentMatchGroup(ph.getTransactionCommentMatchGroup()); + header.setDateDayMatchGroup(ph.getDateDayMatchGroup()); header.setDateMonthMatchGroup(ph.getDateMonthMatchGroup()); header.setDateYearMatchGroup(ph.getDateYearMatchGroup()); @@ -528,13 +537,13 @@ abstract public class PatternDetailsItem { public int getTransactionDescriptionMatchGroup() { return transactionDescription.getMatchGroup(); } - public void setTransactionDescriptionMatchGroup(short group) { + public void setTransactionDescriptionMatchGroup(int group) { transactionDescription.setMatchGroup(group); } public int getTransactionCommentMatchGroup() { return transactionComment.getMatchGroup(); } - public void setTransactionCommentMatchGroup(short group) { + public void setTransactionCommentMatchGroup(int group) { transactionComment.setMatchGroup(group); } public void switchToLiteralDateYear() {