Fixed: add item to order cause exception
(OFBIZ-9167)
-go to https://localhost:8443/ordermgr/control/orderentry
-create order for DemoCustomer
-add an item
console output...
java.lang.NullPointerException
at org.apache.ofbiz.content.content.ContentWorker.
renderContentAsText(ContentWorker.java:368) ~[ofbiz.jar:?]
[...]
While at it I also found issues with cartLine.getName() in ftl files. It was
also missing the dispatcher.
This was broken by OFBIZ-9164
Thanks: Wai
git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@1778889 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/applications/order/groovyScripts/entry/CheckoutReview.groovy b/applications/order/groovyScripts/entry/CheckoutReview.groovy
index 8369b98..50658a0 100644
--- a/applications/order/groovyScripts/entry/CheckoutReview.groovy
+++ b/applications/order/groovyScripts/entry/CheckoutReview.groovy
@@ -38,7 +38,7 @@
// nuke the event messages
request.removeAttribute("_EVENT_MESSAGE_")
-orderItems = cart.makeOrderItems()
+orderItems = cart.makeOrderItems(dispatcher)
context.orderItems = orderItems
orderAdjustments = cart.makeAllAdjustments()
diff --git a/applications/order/groovyScripts/entry/ShowCart.groovy b/applications/order/groovyScripts/entry/ShowCart.groovy
index cb9ed6b..9a02e5d 100644
--- a/applications/order/groovyScripts/entry/ShowCart.groovy
+++ b/applications/order/groovyScripts/entry/ShowCart.groovy
@@ -53,7 +53,7 @@
context.currencyUomId = shoppingCart.getCurrency()
context.orderType = shoppingCart.getOrderType()
-orderItems = shoppingCart.makeOrderItems()
+orderItems = shoppingCart.makeOrderItems(dispatcher)
orderAdjustments = shoppingCart.makeAllAdjustments()
orderItemShipGroupInfo = shoppingCart.makeAllShipGroupInfos()
if (orderItemShipGroupInfo) {
@@ -114,7 +114,7 @@
productStoreFacilityId = productStore.inventoryFacilityId
}
context.facilityId = productStoreFacilityId
-inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(), facilityId : productStoreFacilityId])
+inventorySummary = runService('getProductInventorySummaryForItems', [orderItems : shoppingCart.makeOrderItems(dispatcher), facilityId : productStoreFacilityId])
context.availableToPromiseMap = inventorySummary.availableToPromiseMap
context.quantityOnHandMap = inventorySummary.quantityOnHandMap
context.mktgPkgATPMap = inventorySummary.mktgPkgATPMap
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
index 860f316..c115ecb 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
@@ -4212,7 +4212,7 @@
}
}
- toStore.addAll(cart.makeOrderItems());
+ toStore.addAll(cart.makeOrderItems(dispatcher));
toStore.addAll(cart.makeAllAdjustments());
long groupIndex = cart.getShipInfoSize();
diff --git a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
index c81a0ae..9f7886e 100644
--- a/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
+++ b/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
@@ -3606,8 +3606,8 @@
}
}
- public List<GenericValue> makeOrderItems() {
- return makeOrderItems(false, false, null);
+ public List<GenericValue> makeOrderItems(LocalDispatcher dispatcher) {
+ return makeOrderItems(false, false, dispatcher);
}
public List<GenericValue> makeOrderItems(boolean explodeItems, boolean replaceAggregatedId, LocalDispatcher dispatcher) {
diff --git a/applications/order/template/entry/SetItemShipGroups.ftl b/applications/order/template/entry/SetItemShipGroups.ftl
index 6b07fca..05d6a66 100644
--- a/applications/order/template/entry/SetItemShipGroups.ftl
+++ b/applications/order/template/entry/SetItemShipGroups.ftl
@@ -65,7 +65,7 @@
<input type="hidden" name="fromGroupIndex_o_${rowCount}" value="${shipGroupIndex}"/>
<tr>
<td>
- <div>[${shoppingCartItem.getProductId()}] ${shoppingCartItem.getName()!}: ${shoppingCartItem.getDescription()!}</div>
+ <div>[${shoppingCartItem.getProductId()}] ${shoppingCartItem.getName()!}: ${shoppingCartItem.getDescription(dispatcher)!}</div>
</td>
<td>
<div>${shipGroupItemQuantity}</div>
diff --git a/applications/order/template/entry/SplitShip.ftl b/applications/order/template/entry/SplitShip.ftl
index 0edb56d..e0c926d 100644
--- a/applications/order/template/entry/SplitShip.ftl
+++ b/applications/order/template/entry/SplitShip.ftl
@@ -185,7 +185,7 @@
</#if>
<#-- end code to display a small image of the product -->
<a href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()} -
- ${cartLine.getName()!}</a> : ${cartLine.getDescription()!}
+ ${cartLine.getName(dispatcher)!}</a> : ${cartLine.getDescription(dispatcher)!}
<#-- display the registered ship groups and quantity -->
<#assign itemShipGroups = cart.getShipGroups(cartLine)>
@@ -205,7 +205,7 @@
<#else>
<#-- this is a non-product item -->
- <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+ <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
</#if>
</div>
diff --git a/applications/order/template/entry/cart/MiniCart.ftl b/applications/order/template/entry/cart/MiniCart.ftl
index f3b09ee..0dba056 100644
--- a/applications/order/template/entry/cart/MiniCart.ftl
+++ b/applications/order/template/entry/cart/MiniCart.ftl
@@ -60,9 +60,9 @@
<td>
<#if cartLine.getProductId()??>
<#if cartLine.getParentProductId()??>
- <a href="<@ofbizCatalogAltUrl productId=cartLine.getParentProductId()/>" class="linktext">${cartLine.getName()}</a>
+ <a href="<@ofbizCatalogAltUrl productId=cartLine.getParentProductId()/>" class="linktext">${cartLine.getName(dispatcher)}</a>
<#else>
- <a href="<@ofbizCatalogAltUrl productId=cartLine.getProductId()/>" class="linktext">${cartLine.getName()}</a>
+ <a href="<@ofbizCatalogAltUrl productId=cartLine.getProductId()/>" class="linktext">${cartLine.getName(dispatcher)}</a>
</#if>
<#else>
<strong>${cartLine.getItemTypeDescription()!}</strong>
diff --git a/applications/order/template/entry/cart/ShowCartItems.ftl b/applications/order/template/entry/cart/ShowCartItems.ftl
index 1af8163..07e8639 100644
--- a/applications/order/template/entry/cart/ShowCartItems.ftl
+++ b/applications/order/template/entry/cart/ShowCartItems.ftl
@@ -80,8 +80,8 @@
<#if cartLine.getProductId()??>
<#-- product item -->
<a href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()}</a> -
- <input size="60" type="text" name="description_${cartLineIndex}" value="${cartLine.getName()?default("")}"/><br />
- <i>${cartLine.getDescription()!}</i>
+ <input size="60" type="text" name="description_${cartLineIndex}" value="${cartLine.getName(dispatcher)?default("")}"/><br />
+ <i>${cartLine.getDescription(dispatcher)!}</i>
<#if shoppingCart.getOrderType() != "PURCHASE_ORDER">
<#-- only applies to sales orders, not purchase orders -->
<#-- if inventory is not required check to see if it is out of stock and needs to have a message shown about that... -->
@@ -93,7 +93,7 @@
</#if>
<#else>
<#-- this is a non-product item -->
- <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+ <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
</#if>
<#-- display the item's features -->
<#assign features = "">
diff --git a/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy b/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy
index 25b30ec..b6d3b1f 100644
--- a/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy
+++ b/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy
@@ -30,7 +30,7 @@
cart = session.getAttribute("shoppingCart")
context.cart = cart
-orderItems = cart.makeOrderItems()
+orderItems = cart.makeOrderItems(dispatcher)
context.orderItems = orderItems
orderAdjustments = cart.makeAllAdjustments()
diff --git a/plugins/ecommerce/template/cart/ShowCart.ftl b/plugins/ecommerce/template/cart/ShowCart.ftl
index 496b20a..c00f93c 100644
--- a/plugins/ecommerce/template/cart/ShowCart.ftl
+++ b/plugins/ecommerce/template/cart/ShowCart.ftl
@@ -265,8 +265,8 @@
<#-- ${cartLineIndex} - -->
<a href="<@ofbizCatalogAltUrl productId=parentProductId/>"
class="linktext">${cartLine.getProductId()} -
- ${cartLine.getName()!}
- </a> : ${cartLine.getDescription()!}
+ ${cartLine.getName(dispatcher)!}
+ </a> : ${cartLine.getDescription(dispatcher)!}
<#-- For configurable products, the selected options are shown -->
<#if cartLine.getConfigWrapper()??>
<#assign selectedOptions = cartLine.getConfigWrapper().getSelectedOptions()! />
@@ -293,7 +293,7 @@
<#else>
<#-- this is a non-product item -->
- ${cartLine.getItemTypeDescription()!}: ${cartLine.getName()!}
+ ${cartLine.getItemTypeDescription()!}: ${cartLine.getName(dispatcher)!}
</#if>
<#assign attrs = cartLine.getOrderItemAttributes()/>
diff --git a/plugins/ecommerce/template/cart/UpdateCart.ftl b/plugins/ecommerce/template/cart/UpdateCart.ftl
index 3e376a2..0152e3d 100644
--- a/plugins/ecommerce/template/cart/UpdateCart.ftl
+++ b/plugins/ecommerce/template/cart/UpdateCart.ftl
@@ -87,7 +87,7 @@
<td headers="orderItem">
<img src="<@ofbizContentUrl>${requestAttributes.contentPathPrefix!}${smallImageUrl}</@ofbizContentUrl>"
alt = "Product Image" /></td>
- <td headers="description">${cartLine.getName()!}</td>
+ <td headers="description">${cartLine.getName(dispatcher)!}</td>
<td headers="unitPrice">${cartLine.getDisplayPrice()}</td>
<td headers="quantity">
<span id="completedCartItemQty_${cartLine_index}">${cartLine.getQuantity()?string.number}</span>
@@ -182,7 +182,7 @@
</#if>
</#if>
</td>
- <td headers="editDescription">${cartLine.getName()!}</td>
+ <td headers="editDescription">${cartLine.getName(dispatcher)!}</td>
<td headers="editUnitPrice" id="itemUnitPrice_${cartLine_index}">
<@ofbizCurrency amount=cartLine.getDisplayPrice() isoCode=shoppingCart.getCurrency() />
</td>
diff --git a/plugins/ecommerce/template/order/SplitShip.ftl b/plugins/ecommerce/template/order/SplitShip.ftl
index f945b63..b7f3eb5 100644
--- a/plugins/ecommerce/template/order/SplitShip.ftl
+++ b/plugins/ecommerce/template/order/SplitShip.ftl
@@ -185,7 +185,7 @@
</#if>
<#-- end code to display a small image of the product -->
<a href="<@ofbizUrl>product?product_id=${cartLine.getProductId()}</@ofbizUrl>" class="buttontext">${cartLine.getProductId()} -
- ${cartLine.getName()!}</a> : ${cartLine.getDescription()!}
+ ${cartLine.getName(dispatcher)!}</a> : ${cartLine.getDescription()!}
<#-- display the registered ship groups and quantity -->
<#assign itemShipGroups = cart.getShipGroups(cartLine)>
@@ -205,7 +205,7 @@
<#else>
<#-- this is a non-product item -->
- <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+ <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
</#if>
</div>
diff --git a/plugins/webpos/template/cart/ShowCart.ftl b/plugins/webpos/template/cart/ShowCart.ftl
index d049fdd..5b98352 100644
--- a/plugins/webpos/template/cart/ShowCart.ftl
+++ b/plugins/webpos/template/cart/ShowCart.ftl
@@ -110,10 +110,10 @@
<img src="<@ofbizContentUrl>${requestAttributes.contentPathPrefix!}${smallImageUrl}</@ofbizContentUrl>" align="left" class="cssImgSmall" />
</#if>
<#-- end code to display a small image of the product -->
- ${cartLine.getProductId()} - ${cartLine.getName()!} : ${cartLine.getDescription()!}
+ ${cartLine.getProductId()} - ${cartLine.getName(dispatcher)!} : ${cartLine.getDescription(dispatcher)!}
<#else>
<#-- this is a non-product item -->
- <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+ <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
</#if>
</div>
</td>
diff --git a/plugins/webpos/template/cart/ShowCartItemSelected.ftl b/plugins/webpos/template/cart/ShowCartItemSelected.ftl
index 1670093..27e2650 100644
--- a/plugins/webpos/template/cart/ShowCartItemSelected.ftl
+++ b/plugins/webpos/template/cart/ShowCartItemSelected.ftl
@@ -39,17 +39,17 @@
${cartLine.getProductId()}
<br/>
</#if>
- <#if cartLine.getName()?has_content>
- ${cartLine.getName()}
+ <#if cartLine.getName(dispatcher)?has_content>
+ ${cartLine.getName(dispatcher)}
<#else>
- <#if cartLine.getDescription()?has_content>
- ${cartLine.getDescription()}
+ <#if cartLine.getDescription(dispatcher)?has_content>
+ ${cartLine.getDescription(dispatcher)}
</#if>
</#if>
<#else>
<div id="CartItemSelectedRight">
<#-- this is a non-product item -->
- <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+ <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
</#if>
<br/>
<b>${uiLabelMap.CommonQuantity}</b>