http://ofbiz.116.s1.nabble.com/jira-Commented-OFBIZ-12082-Unique-form-names-for-promo-actions-tp4763026.html
While working on it this morning I stumbled upon an error which is known: OFBIZ-11168
I'll fix it before, except if you can give me an easy scenario to reproduce, TIA
> 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}.