Author: diveshdutta
Date: Sat Jun 18 23:44:57 2016 New Revision: 1749107 URL: http://svn.apache.org/viewvc?rev=1749107&view=rev Log: [OFBIZ-7187] Now Comment added while adding products to cart are editable at cart item level, added text field for item comment in cart item. Added support in modifyCart to update the item comment. Comment will be updated on Recalculate Order for selected item. Thanks Mohammad Kathawala for the patch and thanks Swapnil Shah for suggesting the improvement. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java?rev=1749107&r1=1749106&r2=1749107&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java Sat Jun 18 23:44:57 2016 @@ -678,6 +678,7 @@ public class ShoppingCartHelper { BigDecimal oldQuantity = BigDecimal.ONE.negate(); String oldDescription = ""; + String oldItemComment = ""; BigDecimal oldPrice = BigDecimal.ONE.negate(); if (this.cart.isReadOnlyCart()) { @@ -699,6 +700,7 @@ public class ShoppingCartHelper { String quantString = (String) context.get(parameterName); BigDecimal quantity = BigDecimal.ONE.negate(); String itemDescription = ""; + String itemComment = ""; if (quantString != null) quantString = quantString.trim(); // get the cart item @@ -719,6 +721,8 @@ public class ShoppingCartHelper { } } else if (parameterName.toUpperCase().startsWith("DESCRIPTION")) { itemDescription = quantString; // the quantString is actually the description if the field name starts with DESCRIPTION + } else if (parameterName.toUpperCase().startsWith("COMMENT")) { + itemComment= quantString; // the quantString is actually the comment if the field name starts with COMMENT } else if (parameterName.startsWith("reservStart")) { if (quantString.length() ==0) { // should have format: yyyy-mm-dd hh:mm:ss.fffffffff @@ -803,6 +807,7 @@ public class ShoppingCartHelper { } else { if (item != null) { try { + oldItemComment = item.getItemComment(); // if, on a purchase order, the quantity has changed, get the new SupplierProduct entity for this quantity level. if (cart.getOrderType().equals("PURCHASE_ORDER")) { oldQuantity = item.getQuantity(); @@ -863,6 +868,16 @@ public class ShoppingCartHelper { } } } + + if (parameterName.toUpperCase().startsWith("COMMENT")) { + if (!oldItemComment.equals(itemComment)) { + if (security.hasEntityPermission("ORDERMGR", "_CREATE", userLogin)) { + if (item != null) { + item.setItemComment(itemComment); + } + } + } + } if (parameterName.toUpperCase().startsWith("PRICE")) { NumberFormat pf = NumberFormat.getCurrencyInstance(locale); 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=1749107&r1=1749106&r2=1749107&view=diff ============================================================================== --- ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl (original) +++ ofbiz/trunk/applications/order/template/entry/cart/ShowCartItems.ftl Sat Jun 18 23:44:57 2016 @@ -132,8 +132,8 @@ under the License. </#if> <#if cartLine.getItemComment()?has_content> <tr><td><div>${uiLabelMap.CommonComment} : </div></td> - <td><div>${cartLine.getItemComment()!}</div> - </td></tr> + <td><div><input size="60" type="text" name="comment_${cartLineIndex}" value="${cartLine.getItemComment()?default("")}"/><br /></div></td> + </tr> </#if> <#if cartLine.getDesiredDeliveryDate()?has_content> <tr><td><div>${uiLabelMap.OrderDesiredDeliveryDate}: </div></td> |
Free forum by Nabble | Edit this page |