[jira] [Commented] (OFBIZ-12082) Unique form names for promo actions

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

[jira] [Commented] (OFBIZ-12082) Unique form names for promo actions

Nicolas Malin (Jira)

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

ASF subversion and git services commented on OFBIZ-12082:
---------------------------------------------------------

Commit 5860dbe3cc1d79e3aeae5454d7a43650fa14c58b in ofbiz-framework's branch refs/heads/release18.12 from Jacques Le Roux
[ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=5860dbe ]

Fixed: Unique form names for promo actions (OFBIZ-12082)

Creating a promo with multiple rules and actions results in an exception.

It's reproducible by creating a promo with 1 rule and more than 1 Action and
specifying different products for each Action. When creating the second Action
and trying to specify another product to included the ajax request LookupProduct
will fail because it included both product ids in its xhr request.

Thanks: Danny Trunk


> Unique form names for promo actions
> -----------------------------------
>
>                 Key: OFBIZ-12082
>                 URL: https://issues.apache.org/jira/browse/OFBIZ-12082
>             Project: OFBiz
>          Issue Type: Bug
>    Affects Versions: Trunk
>            Reporter: Danny Trunk
>            Assignee: Jacques Le Roux
>            Priority: Minor
>         Attachments: Bildschirmfoto vom 2020-12-01 16-01-55.png
>
>
> Creating a promo with multiple rules and actions results in an exception:
> {code:java}
> org.apache.ofbiz.widget.renderer.ScreenRenderException: Error rendering screen [component://product/widget/catalog/LookupScreens.xml#LookupProduct]: org.apache.ofbiz.widget.renderer.ScreenRenderException: Error rendering screen [component://common/widget/CommonScreens.xml#LookupDecorator]: java.lang.IllegalArgumentException: Error running script at location [component://common/groovyScripts/FindAutocompleteOptions.groovy]: org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95) (SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95)) (Error running script at location [component://common/groovyScripts/FindAutocompleteOptions.groovy]: org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95) (SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95))) (Error rendering screen [component://common/widget/CommonScreens.xml#LookupDecorator]: java.lang.IllegalArgumentException: Error running script at location [component://common/groovyScripts/FindAutocompleteOptions.groovy]: org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95) (SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95)) (Error running script at location [component://common/groovyScripts/FindAutocompleteOptions.groovy]: org.apache.ofbiz.entity.GenericEntityException: org.apache.ofbiz.entity.GenericDataSourceException: SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95) (SQL Exception while executing the following: SELECT PRODUCT_ID, INTERNAL_NAME, BRAND_NAME FROM public.PRODUCT WHERE (((PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?) OR PRODUCT_ID = (?, ?, ?)))) ORDER BY PRODUCT_ID ASC, INTERNAL_NAME ASC, BRAND_NAME ASC (FEHLER: Operator existiert nicht: character varying = record Hint: Kein Operator stimmt mit dem angegebenen Namen und den Argumenttypen überein. Sie müssen möglicherweise ausdrückliche Typumwandlungen hinzufügen. Position: 95))))
> {code}
> The problem is that the query contains all 3 product IDs of all 3 actions.
> See attachment for Ajax Request `POST [https://localhost:8443/catalog/control/LookupProduct]`
> jQuery cannot find the specific field, instead it finds all 3 fields. This is because the fieldlookup.js is checking the form name (see [https://github.com/apache/ofbiz-framework/blob/trunk/themes/common-theme/webapp/common/js/util/fieldlookup.js#L831]) and the form name is in a loop and statically set to `updateProductPromoAction` (see [https://github.com/apache/ofbiz-framework/blob/trunk/applications/product/template/promo/EditProductPromoRules.ftl#L288])
> h3. Solution
> form name needs to be renamed from updateProductPromoAction to updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}.



--
This message was sent by Atlassian Jira
(v8.3.4#803005)