You cannot select a payment method in an Expense report line, if you opt for any category containing comma separated value.
There is a bug in standard TrvExpenseLookupHelper class in paymentMethodLookupQuery method: it must use old good queryValue() method.
Otherwise you will get a few values instead of one in the range. Compare them before and after the fix.
There is a bug in standard TrvExpenseLookupHelper class in paymentMethodLookupQuery method: it must use old good queryValue() method.
Otherwise you will get a few values instead of one in the range. Compare them before and after the fix.
[ExtensionOf(classStr(TrvExpenseLookupHelper))] final static class myTrvExpenseLookupHelper_Extension { /// <summary> /// A fix for the standard method which does not treat comma separated cost type correctly /// </summary> /// <param name = "_costType"></param> /// <param name = "_excludeImportOnly"></param> /// <returns></returns> public static Query paymentMethodLookupQuery(TrvCostTypeEDT _costType, boolean _excludeImportOnly) { Query query = next paymentMethodLookupQuery(_costType, _excludeImportOnly); QueryBuildDataSource qbPayMethod, qbValidatePayment; TrvCostType trvCostType; trvCostType = TrvCostType::find(_costType); query = new Query(); qbPayMethod = query.addDataSource(tableNum(TrvPayMethod)); if (trvCostType) { query.queryType(QueryType::Join); qbValidatePayment = qbPayMethod.addDataSource(tableNum(TrvValidatePayment)); qbValidatePayment.addLink(fieldNum(TrvPayMethod,PayMethod),fieldNum(TrvValidatePayment,PayMethod)); qbValidatePayment.joinMode(JoinMode::ExistsJoin); //it should be converted by standard queryValue() qbValidatePayment.addRange(fieldNum(TrvValidatePayment, CostType)).value(queryValue(trvCostType.CostType)); } if (_excludeImportOnly) { QueryBuildRange qbr = qbPayMethod.addRange(fieldNum(TrvPayMethod, AutomaticPayment)); qbr.value(queryValue(NoYes::No)); qbr.Status(RangeStatus::Hidden); } return query; } }
No comments:
Post a Comment