Re: svn commit: r689816 - in /ofbiz/trunk: applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh specialpurpose/mypage/widget/MyPageScreens.xml

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Re: svn commit: r689816 - in /ofbiz/trunk: applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy specialpurpose/mypage/webapp/mypage/WEB-INF/actions/GetMyCompany.bsh specialpurpose/mypage/widget/MyPageScreens.xml

Adam Heath-2
[hidden email] wrote:

> --- ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy (added)
> +++ ofbiz/trunk/applications/party/webapp/partymgr/WEB-INF/actions/party/GetMyCompany.groovy Thu Aug 28 06:39:13 2008
> +if (userLogin) {
> + companies = delegator.findByAnd("PartyRelationship",
> + [partyIdTo: userLogin.partyId,
> +         roleTypeIdTo: "CONTACT",
> +         roleTypeIdFrom: "ACCOUNT"]);
> + if (companies) {
> + company = companies.get(0);
> + context.myCompanyId = company.partyIdFrom;
> + } else {
> + context.myCompanyId = userLogin.partyId;
> + }
> +}

So, you use [:] for fast map creation, Map.field for fast putting, but
then use .get(int) to fetch from the list.

Why not use:

company = companies[0]?