Uploaded image for project: 'OFBiz'
  1. OFBiz
  2. OFBIZ-12082

Unique form names for promo actions

Details

    • Bug
    • Status: Closed
    • Minor
    • Resolution: Fixed
    • Trunk
    • 17.12.05, 18.12.01
    • None
    • None

    Description

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

      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))))
      

      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)

      Solution

      form name needs to be renamed from updateProductPromoAction to updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}.

      Attachments

        Issue Links

          Activity

            Hi Danny,

            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

            jleroux Jacques Le Roux added a comment - Hi Danny, 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
            dtrunk90 Danny Trunk added a comment -

            Hi Jacques,

            it should be 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.

            dtrunk90 Danny Trunk added a comment - Hi Jacques, it should be 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.
            dtrunk90 Danny Trunk added a comment -

            I can provide some XML entity engine data to reproduce on January 4th if you need it.

            dtrunk90 Danny Trunk added a comment - I can provide some XML entity engine data to reproduce on January 4th if you need it.

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

            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

            jira-bot ASF subversion and git services added a comment - Commit aa4791f1200c6d91e7597b46d77aa3c557928394 in ofbiz-framework's branch refs/heads/release17.12 from Jacques Le Roux [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=aa4791f ] 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

            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

            jira-bot ASF subversion and git services added a comment - 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

            Commit 6110ced974c686a82bf3747430ea70e4541366b2 in ofbiz-framework's branch refs/heads/trunk from Jacques Le Roux
            [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=6110ced ]

            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

            jira-bot ASF subversion and git services added a comment - Commit 6110ced974c686a82bf3747430ea70e4541366b2 in ofbiz-framework's branch refs/heads/trunk from Jacques Le Roux [ https://gitbox.apache.org/repos/asf?p=ofbiz-framework.git;h=6110ced ] 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

            People

              jleroux Jacques Le Roux
              dtrunk90 Danny Trunk
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: