You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Leon <cb...@gmail.com> on 2012/04/05 07:08:13 UTC

local variable in groovy script override same name one in context

e.g.
applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy,
within this script file, there're some code to retrieve two invoice lists
and put them into context:
......
//retrieve invoices for the related parties which have not been (fully)
applied yet and which have the same currency as the payment
*invoices *= delegator.findList("Invoice", topCond, fields, ["invoiceDate"],
null, false);
context.invoices = getInvoices(invoices, false);
//retrieve invoices for the related parties which have not been (fully)
applied yet and which have the same originalCurrency as the payment
*invoices *= delegator.findList("Invoice", topCondActual, fields,
["invoiceDate"], null, false);
context.invoicesOtherCurrency = getInvoices(invoices, true);
......

The second "invoices" value-set overrides "context.invoices", and
eventually, it breaks the function provided in "editPaymentApplications"
form.

It seems this problem does not exist before script refactoring.


--
View this message in context: http://ofbiz.135035.n4.nabble.com/local-variable-in-groovy-script-override-same-name-one-in-context-tp4533988p4533988.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: local variable in groovy script override same name one in context

Posted by Leon <cb...@gmail.com>.
thanks Adrian.

--
View this message in context: http://ofbiz.135035.n4.nabble.com/local-variable-in-groovy-script-override-same-name-one-in-context-tp4533988p4538763.html
Sent from the OFBiz - Dev mailing list archive at Nabble.com.

Re: local variable in groovy script override same name one in context

Posted by Adrian Crum <ad...@sandglass-software.com>.
This has been fixed in rev 1310307.

-Adrian

On 4/5/2012 6:08 AM, Leon wrote:
> e.g.
> applications/accounting/webapp/accounting/WEB-INF/actions/payment/ListNotAppliedInvoices.groovy,
> within this script file, there're some code to retrieve two invoice lists
> and put them into context:
> ......
> //retrieve invoices for the related parties which have not been (fully)
> applied yet and which have the same currency as the payment
> *invoices *= delegator.findList("Invoice", topCond, fields, ["invoiceDate"],
> null, false);
> context.invoices = getInvoices(invoices, false);
> //retrieve invoices for the related parties which have not been (fully)
> applied yet and which have the same originalCurrency as the payment
> *invoices *= delegator.findList("Invoice", topCondActual, fields,
> ["invoiceDate"], null, false);
> context.invoicesOtherCurrency = getInvoices(invoices, true);
> ......
>
> The second "invoices" value-set overrides "context.invoices", and
> eventually, it breaks the function provided in "editPaymentApplications"
> form.
>
> It seems this problem does not exist before script refactoring.
>
>
> --
> View this message in context: http://ofbiz.135035.n4.nabble.com/local-variable-in-groovy-script-override-same-name-one-in-context-tp4533988p4533988.html
> Sent from the OFBiz - Dev mailing list archive at Nabble.com.