Error (for me only probably) LookupProduct screen

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

Error (for me only probably) LookupProduct screen

SkipDever
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

Reply | Threaded
Open this post in threaded view
|

Re: Error (for me only probably) LookupProduct screen

Pierre Smits
Skip,

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

Regards,

Pierre Smits
Reply | Threaded
Open this post in threaded view
|

RE: Error (for me only probably) LookupProduct screen

SkipDever
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:[hidden email]]
Sent: Monday, July 08, 2013 6:11 AM
To: [hidden email]
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

Reply | Threaded
Open this post in threaded view
|

Re: Error (for me only probably) LookupProduct screen

Pierre Smits
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 <[hidden email]> 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:[hidden email]]
> Sent: Monday, July 08, 2013 6:11 AM
> To: [hidden email]
> 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
>
>