You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/01/15 07:37:36 UTC

svn commit: r1778889 - in /ofbiz/trunk: applications/order/groovyScripts/entry/ applications/order/src/main/java/org/apache/ofbiz/order/order/ applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ applications/order/template/entry/ appl...

Author: jleroux
Date: Sun Jan 15 07:37:35 2017
New Revision: 1778889

URL: http://svn.apache.org/viewvc?rev=1778889&view=rev
Log:
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

Modified:
    ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy
    ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy
    ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
    ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
    ofbiz/trunk/applications/order/template/entry/SetItemShipGroups.ftl
    ofbiz/trunk/applications/order/template/entry/SplitShip.ftl
    ofbiz/trunk/applications/order/template/entry/cart/MiniCart.ftl
    ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl
    ofbiz/trunk/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy
    ofbiz/trunk/plugins/ecommerce/template/cart/ShowCart.ftl
    ofbiz/trunk/plugins/ecommerce/template/cart/UpdateCart.ftl
    ofbiz/trunk/plugins/ecommerce/template/order/SplitShip.ftl
    ofbiz/trunk/plugins/webpos/template/cart/ShowCart.ftl
    ofbiz/trunk/plugins/webpos/template/cart/ShowCartItemSelected.ftl

Modified: ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/entry/CheckoutReview.groovy Sun Jan 15 07:37:35 2017
@@ -38,7 +38,7 @@ context.productStore = ProductStoreWorke
 // nuke the event messages
 request.removeAttribute("_EVENT_MESSAGE_")
 
-orderItems = cart.makeOrderItems()
+orderItems = cart.makeOrderItems(dispatcher)
 context.orderItems = orderItems
 
 orderAdjustments = cart.makeAllAdjustments()

Modified: ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy (original)
+++ ofbiz/trunk/applications/order/groovyScripts/entry/ShowCart.groovy Sun Jan 15 07:37:35 2017
@@ -53,7 +53,7 @@ context.shoppingCart = shoppingCart
 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 @@ if (productStore) {
     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

Modified: ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Sun Jan 15 07:37:35 2017
@@ -4212,7 +4212,7 @@ public class OrderServices {
             }
         }
 
-        toStore.addAll(cart.makeOrderItems());
+        toStore.addAll(cart.makeOrderItems(dispatcher));
         toStore.addAll(cart.makeAllAdjustments());
 
         long groupIndex = cart.getShipInfoSize();

Modified: ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java (original)
+++ ofbiz/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCart.java Sun Jan 15 07:37:35 2017
@@ -3606,8 +3606,8 @@ public class ShoppingCart implements Ite
         }
     }
 
-    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) {

Modified: ofbiz/trunk/applications/order/template/entry/SetItemShipGroups.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/SetItemShipGroups.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/SetItemShipGroups.ftl (original)
+++ ofbiz/trunk/applications/order/template/entry/SetItemShipGroups.ftl Sun Jan 15 07:37:35 2017
@@ -65,7 +65,7 @@ under the License.
                 <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>

Modified: ofbiz/trunk/applications/order/template/entry/SplitShip.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/SplitShip.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/SplitShip.ftl (original)
+++ ofbiz/trunk/applications/order/template/entry/SplitShip.ftl Sun Jan 15 07:37:35 2017
@@ -185,7 +185,7 @@ function submitForm(form, mode, value) {
                       </#if>
                       <#-- end code to display a small image of the product -->
                       <a href="<@o...@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 @@ function submitForm(form, mode, value) {
 
                     <#else>
                       <#-- this is a non-product item -->
-                      <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+                      <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
                     </#if>
                   </div>
 

Modified: ofbiz/trunk/applications/order/template/entry/cart/MiniCart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/cart/MiniCart.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/cart/MiniCart.ftl (original)
+++ ofbiz/trunk/applications/order/template/entry/cart/MiniCart.ftl Sun Jan 15 07:37:35 2017
@@ -60,9 +60,9 @@ under the License.
                 <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>

Modified: ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl (original)
+++ ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl Sun Jan 15 07:37:35 2017
@@ -80,8 +80,8 @@ under the License.
                   <#if cartLine.getProductId()??>
                     <#-- product item -->
                     <a href="<@o...@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 @@ under the License.
                     </#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 = "">

Modified: ofbiz/trunk/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy (original)
+++ ofbiz/trunk/plugins/ecommerce/groovyScripts/order/CheckoutReview.groovy Sun Jan 15 07:37:35 2017
@@ -30,7 +30,7 @@ import org.apache.ofbiz.webapp.website.W
 cart = session.getAttribute("shoppingCart")
 context.cart = cart
 
-orderItems = cart.makeOrderItems()
+orderItems = cart.makeOrderItems(dispatcher)
 context.orderItems = orderItems
 
 orderAdjustments = cart.makeAllAdjustments()

Modified: ofbiz/trunk/plugins/ecommerce/template/cart/ShowCart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/ecommerce/template/cart/ShowCart.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/ecommerce/template/cart/ShowCart.ftl (original)
+++ ofbiz/trunk/plugins/ecommerce/template/cart/ShowCart.ftl Sun Jan 15 07:37:35 2017
@@ -265,8 +265,8 @@ under the License.
                       <#-- ${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 @@ under the License.
 
                     <#else>
                       <#-- this is a non-product item -->
-                      ${cartLine.getItemTypeDescription()!}: ${cartLine.getName()!}
+                      ${cartLine.getItemTypeDescription()!}: ${cartLine.getName(dispatcher)!}
                     </#if>
 
                     <#assign attrs = cartLine.getOrderItemAttributes()/>

Modified: ofbiz/trunk/plugins/ecommerce/template/cart/UpdateCart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/ecommerce/template/cart/UpdateCart.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/ecommerce/template/cart/UpdateCart.ftl (original)
+++ ofbiz/trunk/plugins/ecommerce/template/cart/UpdateCart.ftl Sun Jan 15 07:37:35 2017
@@ -87,7 +87,7 @@ under the License.
             <td headers="orderItem">
               <img src="<@o...@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 @@ under the License.
                     </#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>

Modified: ofbiz/trunk/plugins/ecommerce/template/order/SplitShip.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/ecommerce/template/order/SplitShip.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/ecommerce/template/order/SplitShip.ftl (original)
+++ ofbiz/trunk/plugins/ecommerce/template/order/SplitShip.ftl Sun Jan 15 07:37:35 2017
@@ -185,7 +185,7 @@ function submitForm(form, mode, value) {
                       </#if>
                       <#-- end code to display a small image of the product -->
                       <a href="<@o...@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 @@ function submitForm(form, mode, value) {
 
                     <#else>
                       <#-- this is a non-product item -->
-                      <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName()!}
+                      <b>${cartLine.getItemTypeDescription()!}</b> : ${cartLine.getName(dispatcher)!}
                     </#if>
                   </div>
 

Modified: ofbiz/trunk/plugins/webpos/template/cart/ShowCart.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/webpos/template/cart/ShowCart.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/webpos/template/cart/ShowCart.ftl (original)
+++ ofbiz/trunk/plugins/webpos/template/cart/ShowCart.ftl Sun Jan 15 07:37:35 2017
@@ -110,10 +110,10 @@ under the License.
                   <img src="<@o...@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>

Modified: ofbiz/trunk/plugins/webpos/template/cart/ShowCartItemSelected.ftl
URL: http://svn.apache.org/viewvc/ofbiz/trunk/plugins/webpos/template/cart/ShowCartItemSelected.ftl?rev=1778889&r1=1778888&r2=1778889&view=diff
==============================================================================
--- ofbiz/trunk/plugins/webpos/template/cart/ShowCartItemSelected.ftl (original)
+++ ofbiz/trunk/plugins/webpos/template/cart/ShowCartItemSelected.ftl Sun Jan 15 07:37:35 2017
@@ -39,17 +39,17 @@ under the License.
             ${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>&nbsp;