[ofbiz-framework] branch release17.12 updated (3982f8d -> aa4791f)

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

[ofbiz-framework] branch release17.12 updated (3982f8d -> aa4791f)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a change to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git.


    from 3982f8d  Fixed: Make ruleName field in PriceForms.xml#AddPriceRules safe (OFBIZ-12098)
     new e87747d  Fixed: Issue in creating promotion action (OFBIZ-11168)
     new aa4791f  Fixed: Unique form names for promo actions (OFBIZ-12082)

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../template/promo/EditProductPromoRules.ftl       | 25 +++++++++++++++-------
 1 file changed, 17 insertions(+), 8 deletions(-)

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 01/02: Fixed: Issue in creating promotion action (OFBIZ-11168)

jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit e87747dcb9c00060776a83f0c9f10026d16da508
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Fri Dec 25 16:09:43 2020 +0100

    Fixed: Issue in creating promotion action (OFBIZ-11168)
   
    The issue reported there was fixed with OFBIZ-11058.
   
    But there was still an issue in logI reported in a comment.
   
    The problem was that
    <#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
    was used in 2 places where it should not have been because it returned a null
    value that can't be handled by OFBiz.
   
    Better use
    <#assign productPromoActionCustomMethod = productPromoAction.getRelatedOne("CustomMethod", true)>
    and
    productPromoAction.getRelatedOne("ActionEnumeration", true))??
   
    The repercussion was that the description was not used but the Id and the log
    was showing an error.
   
    Conflicts handled by hand:
    applications/product/template/promo/EditProductPromoRules.ftl
---
 .../product/template/promo/EditProductPromoRules.ftl  | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

diff --git a/applications/product/template/promo/EditProductPromoRules.ftl b/applications/product/template/promo/EditProductPromoRules.ftl
index a84f55a..bcb076f 100644
--- a/applications/product/template/promo/EditProductPromoRules.ftl
+++ b/applications/product/template/promo/EditProductPromoRules.ftl
@@ -286,9 +286,19 @@ under the License.
                     <input type="hidden" name="productPromoActionSeqId" value="${(productPromoAction.productPromoActionSeqId)!}" />
                     <select name="productPromoActionEnumId" size="1">
       <#if (productPromoAction.productPromoActionEnumId)??>
-        <#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
-                      <option value="${(productPromoAction.productPromoActionEnumId)!}"><#if productPromoActionCurEnum??>${(productPromoActionCurEnum.get("description",locale))!}<#else>[${(productPromoAction.productPromoActionEnumId)!}]</#if></option>
-                      <option value="${(productPromoAction.productPromoActionEnumId)!}">&nbsp;</option>
+        <#assign productPromoActionCustomMethod = productPromoAction.getRelatedOne("CustomMethod", true)>
+                      <option value="${(productPromoAction.customMethodId)!}">
+                        <#if (productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true))??>
+                            ${(productPromoActionCurEnum.get("description",locale))!}
+                        <#else>
+                            ${(productPromoActionCustomMethod.get("description",locale))!}
+                        </#if>
+                      </option>
+                      <option value="${(productPromoAction.customMethodId)!}">&nbsp;</option>
+        <#elseif (productPromoAction.productPromoActionEnumId)??>
+          <#assign actionEnumeration = productPromoAction.getRelatedOne("ActionEnumeration", true)! />
+          <#assign customMethod = EntityQuery.use(delegator).from("CustomMethod").where("customMethodId", actionEnumeration.enumCode!).cache().queryOne()!>
+            <option value="${(customMethod.customMethodId)!}">${(actionEnumeration.get("description",locale))!}</option>
       <#else>
                       <option value="">&nbsp;</option>
       </#if>
@@ -308,7 +318,6 @@ under the License.
                     ${uiLabelMap.UseCartQuantity}:&nbsp;
                     <select name="useCartQuantity">
       <#if (productPromoAction.useCartQuantity)??>
-        <#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
                       <option value="${(productPromoAction.useCartQuantity)!}"><#if ("Y" == productPromoAction.useCartQuantity)>${uiLabelMap.CommonY}<#else>${uiLabelMap.CommonN}</#if></option>
                       <option value="${(productPromoAction.useCartQuantity)!}">&nbsp;</option>
       <#else>
@@ -383,7 +392,7 @@ under the License.
                 <div>
                   ${(actionProduct.internalName)!} [${actionProductPromoProduct.productId}]
                   - ${(actionApplEnumeration.get("description",locale))?default(actionProductPromoProduct.productPromoApplEnumId)}
-                  <form name="deleteProductPromoProductAction_${productPromoRule_index}_${productPromoAction_index}_${actionProductPromoProduct_index}" method="post" action="<@ofbizUrl>deleteProductPromoProduct</@ofbizUrl>">
+                  <form name="deleteProductPromoProductAction_${productPromoRule_index}_${productPromoAction_index}_${actionProductPromoProduct_index}" method="post" action="<@ofbizUrl>deleteProductPromoProduct</@ofbizUrl>">
                     <input type="hidden" name="productPromoId" value="${(actionProductPromoProduct.productPromoId)!}" />
                     <input type="hidden" name="productPromoRuleId" value="${(actionProductPromoProduct.productPromoRuleId)!}" />
                     <input type="hidden" name="productPromoCondSeqId" value="${(actionProductPromoProduct.productPromoCondSeqId)!}" />

Reply | Threaded
Open this post in threaded view
|

[ofbiz-framework] 02/02: Fixed: Unique form names for promo actions (OFBIZ-12082)

jleroux@apache.org
In reply to this post by jleroux@apache.org
This is an automated email from the ASF dual-hosted git repository.

jleroux pushed a commit to branch release17.12
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git

commit aa4791f1200c6d91e7597b46d77aa3c557928394
Author: Jacques Le Roux <[hidden email]>
AuthorDate: Fri Dec 25 16:17:35 2020 +0100

    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
---
 applications/product/template/promo/EditProductPromoRules.ftl | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/applications/product/template/promo/EditProductPromoRules.ftl b/applications/product/template/promo/EditProductPromoRules.ftl
index bcb076f..9c489d5 100644
--- a/applications/product/template/promo/EditProductPromoRules.ftl
+++ b/applications/product/template/promo/EditProductPromoRules.ftl
@@ -280,7 +280,7 @@ under the License.
               <td>
                 <div>
                   <b> ${uiLabelMap.ProductAction} ${(productPromoAction.productPromoActionSeqId)!}</b>
-                  <form method="post" action="<@ofbizUrl>updateProductPromoAction</@ofbizUrl>" name="updateProductPromoAction">
+                  <form method="post" action="<@ofbizUrl>updateProductPromoAction</@ofbizUrl>" name="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}">
                     <input type="hidden" name="productPromoId" value="${(productPromoAction.productPromoId)!}" />
                     <input type="hidden" name="productPromoRuleId" value="${(productPromoAction.productPromoRuleId)!}" />
                     <input type="hidden" name="productPromoActionSeqId" value="${(productPromoAction.productPromoActionSeqId)!}" />
@@ -310,9 +310,9 @@ under the License.
                     ${uiLabelMap.ProductQuantity}:&nbsp;<input type="text" size="5" name="quantity" value="${(productPromoAction.quantity)!}" />
                     ${uiLabelMap.ProductAmount}:&nbsp;<input type="text" size="5" name="amount" value="${(productPromoAction.amount)!}" />
                     <br/>
-                    ${uiLabelMap.ProductItemId}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.productId)!}" formName="updateProductPromoAction" name="productId" id="productId" fieldFormName="LookupProduct"/>
+                    ${uiLabelMap.ProductItemId}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.productId)!}" formName="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}" name="productId" id="productId" fieldFormName="LookupProduct"/>
                     <br/>
-                    ${uiLabelMap.PartyParty}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.partyId)!}" formName="updateProductPromoAction" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
+                    ${uiLabelMap.PartyParty}:&nbsp;<@htmlTemplate.lookupField value="${(productPromoAction.partyId)!}" formName="updateProductPromoAction_${productPromoRule_index}_${productPromoAction_index}" name="partyId" id="partyId" fieldFormName="LookupUserLoginAndPartyDetails"/>
                     <br/>
                     ${uiLabelMap.ProductServiceName}:&nbsp;<input type="text" size="20" name="serviceName" value="${(productPromoAction.serviceName)!}" />
                     ${uiLabelMap.UseCartQuantity}:&nbsp;