You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@ofbiz.apache.org by Skip <sk...@thedevers.org> on 2013/07/03 01:59:16 UTC

Error (for me only probably) LookupProduct screen

I am adding some of the nifty new features in the latest ofbiz.  One is the
autocomplete feature.  One of these screens is LookupProduct.

This screen passes in all the parameters in the inputFields parameter to
"performFind".  I calling this from a screen that looks up inventory items
in a facility and therefore, there is a facilityId in parameter list.

When performFind is done, it looks up the partial productId entered in the
LookupProduct dialog and also passes in the facilityId.  Because none of my
products is associated with a single facility, that field is empty in my
Product table and therefore, the search returns no values.


So, my question is, how can I restrict the performFind to just those fields
in the dialog [productId, internalName, brandName];


There is field called "searchFields" in LookupProduct which contains the
only parameters that should be passed to prepareFind.  Is there some way I
can make a groovy call with this value to get just those values if they
exist in the parameters list?


For the time being, I added a "searchFields" parameter to performFind and
passed only those fields along with their _op and _ic fields to prepareFind
and that all works, but I would like to not have to modify that java code.

Skip


Re: Error (for me only probably) LookupProduct screen

Posted by Pierre Smits <pi...@gmail.com>.
Skip,

If I understand you correctly, you modified the entity 'Product' to not
include field 'facilityId'. And thus you now have to modify a standard
function to facilitate your needs.

Wouldn't it have been easier to add the field again in your entity, and not
modify the lookup functionality?

Regards,

Pierre

Pierre Smits


On Mon, Jul 8, 2013 at 8:07 PM, Skip <sk...@thedevers.org> wrote:

> This is in a custom screen (not part of ofbiz) that edits
> products/prices/vendors/inventory/etc all in a single screen.  One of the
> parameters in the parameter map of this screen is facilityId (used for
> inventory).  facilityId is also a field in Product table.
>
> In this custom screen, I replaced the existing productId lookup field with
> <@htmlTemplate.lookupField ... fieldFormName="LookupProduct"/>  to be able
> to get autocompletion.  However, when I first tried it, I got no results
> even though I used well known productIds.  A little investigation turned up
> the problem to be with performFind.  LookupProducts has two forms,
> lookupProduct and listLookupProduct, both in
> product\widget\catalog\LoookupScreens.xml.  The second, listLookupProduct
> calls the service performFind with all parameters as the inputFields
> argument to that service.  However, because facilityId is in the parameter
> map, performFind finds that as a valid field in Product table and adds it
> to
> the query.  Once again, because I do not use facilityId for my Product
> table, no results were returned.
>
> The screen LookupProduct in LookupScreens.xml defines a <set
> field="searchFields".  However, this value is not used anywhere I can find
> and specifically is not used in the performFind service.  I simply added
> searchFields as an optional argument to the performFind servoce and in the
> performFind java code, used it if it existed by extracting just those
> values
> from the inputFields map.  Works a charm, but I am trying to find an OOTB
> solution because the next time I upgrade ofbiz, this code change will go
> away.
>
> This will be a problem to anyone using any of the lookup services in a
> custom app where there may be an unintended field in the parameter map.
>
> Skip
>
> -----Original Message-----
> From: Pierre Smits [mailto:pierre.smits@gmail.com]
> Sent: Monday, July 08, 2013 6:11 AM
> To: user@ofbiz.apache.org
> Subject: Re: Error (for me only probably) LookupProduct screen
>
>
> Skip,
>
> In what component are you using the LookupProduct functionality where it
> doesn't deliver the expected result?
>
> Regards,
>
> Pierre Smits
>
>

RE: Error (for me only probably) LookupProduct screen

Posted by Skip <sk...@thedevers.org>.
This is in a custom screen (not part of ofbiz) that edits
products/prices/vendors/inventory/etc all in a single screen.  One of the
parameters in the parameter map of this screen is facilityId (used for
inventory).  facilityId is also a field in Product table.

In this custom screen, I replaced the existing productId lookup field with
<@htmlTemplate.lookupField ... fieldFormName="LookupProduct"/>  to be able
to get autocompletion.  However, when I first tried it, I got no results
even though I used well known productIds.  A little investigation turned up
the problem to be with performFind.  LookupProducts has two forms,
lookupProduct and listLookupProduct, both in
product\widget\catalog\LoookupScreens.xml.  The second, listLookupProduct
calls the service performFind with all parameters as the inputFields
argument to that service.  However, because facilityId is in the parameter
map, performFind finds that as a valid field in Product table and adds it to
the query.  Once again, because I do not use facilityId for my Product
table, no results were returned.

The screen LookupProduct in LookupScreens.xml defines a <set
field="searchFields".  However, this value is not used anywhere I can find
and specifically is not used in the performFind service.  I simply added
searchFields as an optional argument to the performFind servoce and in the
performFind java code, used it if it existed by extracting just those values
from the inputFields map.  Works a charm, but I am trying to find an OOTB
solution because the next time I upgrade ofbiz, this code change will go
away.

This will be a problem to anyone using any of the lookup services in a
custom app where there may be an unintended field in the parameter map.

Skip

-----Original Message-----
From: Pierre Smits [mailto:pierre.smits@gmail.com]
Sent: Monday, July 08, 2013 6:11 AM
To: user@ofbiz.apache.org
Subject: Re: Error (for me only probably) LookupProduct screen


Skip,

In what component are you using the LookupProduct functionality where it
doesn't deliver the expected result?

Regards,

Pierre Smits


Re: Error (for me only probably) LookupProduct screen

Posted by Pierre Smits <pi...@gmail.com>.
Skip,

In what component are you using the LookupProduct functionality where it
doesn't deliver the expected result?

Regards,

Pierre Smits