/** * Perform Match * * @param bs bank statement * @return Message */ private String match(MBankStatement bs) { if (m_matchers == null || bs == null) return "--"; log.fine("match - " + bs); int count = 0; MBankStatementLine[] lines = bs.getLines(false); for (MBankStatementLine element : lines) { if (element.getC_Payment_ID() == 0) { match(element); count++; } } return String.valueOf(count); } // match
/** * Perform Match * * @param bsl bank statement line * @return Message */ private String match(MBankStatementLine bsl) { if (m_matchers == null || bsl == null || bsl.getC_Payment_ID() != 0) return "--"; log.fine("match - " + bsl); BankStatementMatchInfo info = null; for (MBankStatementMatcher element : m_matchers) { if (element.isMatcherValid()) { info = element.getMatcher().findMatch(bsl); if (info != null && info.isMatched()) { if (info.getC_Payment_ID() > 0) bsl.setC_Payment_ID(info.getC_Payment_ID()); if (info.getC_Invoice_ID() > 0) bsl.setC_Invoice_ID(info.getC_Invoice_ID()); if (info.getC_BPartner_ID() > 0) bsl.setC_BPartner_ID(info.getC_BPartner_ID()); bsl.save(); return "OK"; } } } // for all matchers return "--"; } // match