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.
This commit is contained in:
Jacques Le Roux
2020-12-25 16:10:34 +01:00
parent 8bdf4d447e
commit c91c4f856d
@@ -291,8 +291,14 @@ under the License.
<input type="hidden" name="productPromoActionSeqId" value="${(productPromoAction.productPromoActionSeqId)!}" />
<select name="customMethodId" size="1">
<#if (productPromoAction.customMethodId)??>
<#assign productPromoActionCurEnum = productPromoAction.getRelatedOne("ActionEnumeration", true)>
<option value="${(productPromoAction.customMethodId)!}"><#if productPromoActionCurEnum??>${(productPromoActionCurEnum.get("description",locale))!}<#else>[${(productPromoAction.customMethodId)!}]</#if></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)! />
@@ -317,7 +323,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>
@@ -392,7 +397,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)!}" />