You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by "Amardeep Singh Jhajj (JIRA)" <ji...@apache.org> on 2016/06/03 12:59:59 UTC

[jira] [Commented] (OFBIZ-7157) Error on clicking "Create New Financial Account Reconciliations" button

    [ https://issues.apache.org/jira/browse/OFBIZ-7157?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15314062#comment-15314062 ] 

Amardeep Singh Jhajj commented on OFBIZ-7157:
---------------------------------------------

I worked on this issue and found that its working fine in 13.07 and 14.12, but not on 15.12 and trunk.  So I checked the code for the form and found that the "openingBalance" field declaration is changed in "EditGlReconciliation" form in GlForms.xml in both the release 15.12 and trunk.

In 13.07 and 14.12,

{code}
<field name="openingBalance" use-when="&quot;GLREC_RECONCILED&quot;.equals(&quot;${glReconciliation.statusId}&quot;)"><display/></field>
{code}

In 15.12 and trunk

{code}
<field name="openingBalance" use-when="'GLREC_RECONCILED'.equals('${glReconciliation.statusId}')"><display/></field>
{code}

But after looking into code, the field is executed in the bsh way and everything seems to be correct.

Then I checked form's field bsh expression interpreter in OFBiz and found the code where expression evaluation is done. In ModeFormField.java, shouldUse method have below code:

{code}
Interpreter bsh = this.modelForm.getBshInterpreter(context);
Object retVal = bsh.eval(StringUtil.convertOperatorSubstitutions(useWhenStr));
{code}

I added the log there to get the actual expression (returned from StringUtil's convertOperatorSubstitutions method) which will be evaluated.

Expression In 13.07 and 14.12,

{code}
"GLREC_RECONCILED".equals("GLREC_RECONCILED")
{code}

Expression in 15.12 and trunk

{code}
'GLREC_RECONCILED'.equals('GLREC_RECONCILED')
{code}

The difference in both the cases is use of " and '.

So according to my analysis, bsh doesn't evaluate the expressions properly when ' is used instead of ".

It would be good if bsh interpreter is replaced with groovy, as we are moving towards groovy.

For now, To fix the above issue i used groovy pattern and it is working fine.

{code}
<field name="openingBalance" use-when="${groovy:'GLREC_RECONCILED'.equals(glReconciliation?.statusId)}"><display/></field>
{code}

I am attaching the patch for both the Release 15.12 and trunk. Thanks.

> Error on clicking "Create New Financial Account Reconciliations" button
> -----------------------------------------------------------------------
>
>                 Key: OFBIZ-7157
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-7157
>             Project: OFBiz
>          Issue Type: Bug
>          Components: accounting
>    Affects Versions: Trunk, Release Branch 15.12
>            Reporter: Amardeep Singh Jhajj
>            Assignee: Pranay Pandey
>
> Error:
> {code}
>      [java] 2016-06-01 20:13:56,637 |http-nio-8443-exec-4 |[ControlServlet]              |E| Servlet.service() for servlet [ControlServlet] in context with path [/accounting] threw exception [Servlet execution threw an exception] with root cause
>      [java] bsh.TokenMgrError: Lexical error at line 1, column 3.  Encountered: "L" (76), after : "\'G"
>      [java] 	at bsh.ParserTokenManager.getNextToken(Unknown Source) ~[bsh-2.0b4.jar:2.0b4 2007-04-28 05:52:58]
>      [java] 	at bsh.Parser.jj_ntk(Unknown Source) ~[bsh-2.0b4.jar:2.0b4 2007-04-28 05:52:58]
>      [java] 	at bsh.Parser.Line(Unknown Source) ~[bsh-2.0b4.jar:2.0b4 2007-04-28 05:52:58]
>      [java] 	at bsh.Interpreter.parseScript(Unknown Source) ~[bsh-2.0b4.jar:2.0b4 2007-04-28 05:52:58]
> {code}
> Steps to regenerate:
> 1. Go to https://localhost:8443/accounting/control/FindFinAccountReconciliations?finAccountId=ABN_CHECKING
> 2. Click on "Create New Financial Account Reconciliations" button.
> I will provide the patch for it.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)