Author: ashish
Date: Sat Oct 18 12:17:25 2014
New Revision: 1632777
URL: http://svn.apache.org/r1632777
Log:
Applied patch from jira issue - OFBIZ-5714 - Comment does not save.
===========================================================
1. find P.O.
2. select approaved p.o.
3. edit items
4 add item (at bottom of screen)
5. Comment does not save.
Note! shouldn't the comment be displayed on some of the P.O. screens?
I only know it does not save as I edited the .FTL on viewpo and pdf to include
comment. Comments from the orignal create P.O. show up, ALso should be able to
edit a comment, when edit items is entered.
===========================================================
Thanks Joel for creating the issue and Thanks Akash for providing the patch.
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl
ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
Modified:
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1632777&r1=1632776&r2=1632777&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java
Sat Oct 18 12:17:25 2014
@@ -3557,6 +3557,9 @@ public class OrderServices {
item.setIsModifiedPrice(true);
}
+ item.setItemComment(changeComments);
+ item.setDesiredDeliveryDate(itemDesiredDeliveryDate);
+ cart.clearItemShipInfo(item);
cart.setItemShipGroupQty(item, item.getQuantity(),
shipGroupIdx);
} else {
ShoppingCartItem item = ShoppingCartItem.makeItem(null,
productId, null, quantity, null, null, null, null, null, null, null, null,
prodCatalogId, null, null, null, dispatcher, cart, null, null, null,
Boolean.FALSE, Boolean.FALSE);
@@ -3715,6 +3718,15 @@ public class OrderServices {
}
}
+ // Update the item comment
+ if (itemCommentMap != null &&
itemCommentMap.containsKey(itemSeqId)) {
+ String comments = itemCommentMap.get(itemSeqId);
+ if (UtilValidate.isNotEmpty(comments)) {
+ cartItem.setItemComment(comments);
+ Debug.logInfo("Set item comment: [" + itemSeqId + "] "
+ comments, module);
+ }
+ }
+
// update the order item attributes
if (itemAttributesMap != null) {
// go through the item attributes map once to get a list
of key names
@@ -4247,6 +4259,7 @@ public class OrderServices {
String oldItemDescription =
oldOrderItem.getString("itemDescription") != null ?
oldOrderItem.getString("itemDescription") : "";
BigDecimal oldQuantity =
oldOrderItem.getBigDecimal("quantity") != null ?
oldOrderItem.getBigDecimal("quantity") : BigDecimal.ZERO;
BigDecimal oldUnitPrice =
oldOrderItem.getBigDecimal("unitPrice") != null ?
oldOrderItem.getBigDecimal("unitPrice") : BigDecimal.ZERO;
+ String oldItemComment = oldOrderItem.getString("comments")
!= null ? oldOrderItem.getString("comments") : "";
boolean changeFound = false;
Map<String, Object> modifiedItem = FastMap.newInstance();
@@ -4255,6 +4268,11 @@ public class OrderServices {
changeFound = true;
}
+ if
(!oldItemComment.equals(valueObj.getString("comments"))) {
+ modifiedItem.put("changeComments",
valueObj.getString("comments"));
+ changeFound = true;
+ }
+
BigDecimal quantityDif =
valueObj.getBigDecimal("quantity").subtract(oldQuantity);
BigDecimal unitPriceDif =
valueObj.getBigDecimal("unitPrice").subtract(oldUnitPrice);
if (quantityDif.compareTo(BigDecimal.ZERO) != 0) {
@@ -4269,15 +4287,10 @@ public class OrderServices {
// found changes to store
Map<String, String> itemReasonMap =
UtilGenerics.checkMap(changeMap.get("itemReasonMap"));
- Map<String, String> itemCommentMap =
UtilGenerics.checkMap(changeMap.get("itemCommentMap"));
if (UtilValidate.isNotEmpty(itemReasonMap)) {
String changeReasonId =
itemReasonMap.get(valueObj.getString("orderItemSeqId"));
modifiedItem.put("reasonEnumId", changeReasonId);
}
- if (UtilValidate.isNotEmpty(itemCommentMap)) {
- String changeComments =
itemCommentMap.get(valueObj.getString("orderItemSeqId"));
- modifiedItem.put("changeComments", changeComments);
- }
modifiedItem.put("orderId",
valueObj.getString("orderId"));
modifiedItem.put("orderItemSeqId",
valueObj.getString("orderItemSeqId"));
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy?rev=1632777&r1=1632776&r2=1632777&view=diff
==============================================================================
---
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
(original)
+++
ofbiz/trunk/applications/order/webapp/ordermgr/WEB-INF/actions/order/OrderView.groovy
Sat Oct 18 12:17:25 2014
@@ -25,6 +25,7 @@ import org.ofbiz.entity.condition.*;
import org.ofbiz.entity.util.*;
import org.ofbiz.base.util.*;
import org.ofbiz.base.util.collections.*;
+import org.ofbiz.entity.util.EntityQuery;
import org.ofbiz.order.order.*;
import org.ofbiz.party.contact.*;
import org.ofbiz.product.inventory.InventoryWorker;
@@ -55,9 +56,11 @@ def partyId = null;
orderHeader = null;
orderItems = null;
orderAdjustments = null;
+comments = null;
if (orderId) {
orderHeader = delegator.findOne("OrderHeader", [orderId : orderId], false);
+ comments = EntityQuery.use(delegator).select("orderItemSeqId",
"changeComments", "changeDatetime",
"changeUserLogin").from("OrderItemChange").where(UtilMisc.toList(EntityCondition.makeCondition("orderId",
EntityOperator.EQUALS, orderId))).orderBy("-changeDatetime").queryList();
}
if (orderHeader) {
@@ -73,6 +76,7 @@ if (orderHeader) {
orderTerms = orderHeader.getRelated("OrderTerm", null, null, false);
context.orderHeader = orderHeader;
+ context.comments = comments;
context.orderReadHelper = orderReadHelper;
context.orderItems = orderItems;
context.orderAdjustments = orderAdjustments;
Modified:
ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=1632777&r1=1632776&r2=1632777&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/editorderitems.ftl Sat
Oct 18 12:17:25 2014
@@ -193,7 +193,7 @@ under the License.
</#list>
</select>
<span
class="label">${uiLabelMap.CommonComments}</span>
- <input type="text"
name="icm_${orderItem.orderItemSeqId}" value="" size="30" maxlength="60"/>
+ <input type="text"
name="icm_${orderItem.orderItemSeqId}" value="${orderItem.comments!}" size="30"
maxlength="60"/>
<#if (orderHeader.orderTypeId == 'PURCHASE_ORDER')>
<span
class="label">${uiLabelMap.OrderEstimatedShipDate}</span>
<@htmlTemplate.renderDateTimeField
name="isdm_${orderItem.orderItemSeqId}" value="${orderItem.estimatedShipDate!}"
event="" action="" className="" alert="" title="Format: yyyy-MM-dd
HH:mm:ss.SSS" size="25" maxlength="30" id="isdm_${orderItem.orderItemSeqId}"
dateType="date" shortDateInput=false timeDropdownParamName=""
defaultDateTimeString="" localizedIconTitle="" timeDropdown="" timeHourName=""
classString="" hour1="" hour2="" timeMinutesName="" minutes="" isTwelveHour=""
ampmName="" amSelected="" pmSelected="" compositeType="" formName=""/>
Modified: ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl?rev=1632777&r1=1632776&r2=1632777&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl
(original)
+++ ofbiz/trunk/applications/order/webapp/ordermgr/order/orderitems.ftl Sat Oct
18 12:17:25 2014
@@ -656,6 +656,47 @@ under the License.
</tr>
</#list>
</#if>
+ <#if orderItem.comments?has_content>
+ <tr<#if itemClass == "1">
class="alternate-row"</#if>>
+ <td> </td>
+ <td>
+ <div class= "screenlet">
+ <div class = "screenlet-body">
+ <table>
+ <tr>
+ <td align="right">
+ <span
class="label">${uiLabelMap.CommonComments}</span>
+ </td>
+ <td align="">
+ <span
class="label">${uiLabelMap.CommonCurrent}:</span> ${orderItem.comments}
+ <#assign orderItemSeqId =
orderItem.orderItemSeqId!>
+ <#if comments?has_content>
+ <hr/>
+ <#list comments as comm>
+ <#if
comm.orderItemSeqId?has_content && orderItemSeqId?has_content &&
comm.orderItemSeqId == orderItemSeqId>
+ <#if
comm.changeComments?has_content>
+ <div>
+ ${(comm.changeComments)!}
+
+ <#if
comm.changeDatetime?has_content>${Static["org.ofbiz.base.util.UtilFormatOut"].formatDateTime(comm.changeDatetime,
"", locale, timeZone)?default("0000-00-00 00:00:00")}</#if>
${uiLabelMap.CommonBy} - [${(comm.changeUserLogin)!}]
+ </div>
+ </#if>
+ </#if>
+ </#list>
+ </#if>
+ </td>
+ </tr>
+ </table>
+ </div>
+ </div>
+ </td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ <td></td>
+ </tr>
+ </#if>
<#if itemClass == "2">
<#assign itemClass = "1">
<#else>