Author: deepak
Date: Wed May 25 09:16:08 2016
New Revision: 1745462
URL: http://svn.apache.org/viewvc?rev=1745462&view=rev
Log:
(OFBIZ-7078) Manually merged r#1744781
Log:
=======================================================
Extend OrderAdjustment entity and add isManual field
=======================================================
Thanks Rohit Koushal for your contribution.
Modified:
ofbiz/branches/release14.12/applications/order/entitydef/entitymodel.xml
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/branches/release14.12/applications/order/webapp/ordermgr/order/editorderitems.ftl
Modified:
ofbiz/branches/release14.12/applications/order/entitydef/entitymodel.xml
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/entitydef/entitymodel.xml?rev=1745462&r1=1745461&r2=1745462&view=diff
==============================================================================
--- ofbiz/branches/release14.12/applications/order/entitydef/entitymodel.xml
(original)
+++ ofbiz/branches/release14.12/applications/order/entitydef/entitymodel.xml
Wed May 25 09:16:08 2016
@@ -91,6 +91,7 @@ under the License.
</field>
<field name="includeInTax" type="indicator"></field>
<field name="includeInShipping" type="indicator"></field>
+ <field name="isManual" type="indicator"></field>
<field name="createdDate" type="date-time"></field>
<field name="createdByUserLogin" type="id-vlong"></field>
<field name="lastModifiedDate" type="date-time"></field>
Modified:
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1745462&r1=1745461&r2=1745462&view=diff
==============================================================================
---
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/order/OrderServices.java
Wed May 25 09:16:08 2016
@@ -1640,7 +1640,7 @@ public class OrderServices {
BigDecimal totalManuallyAddedOrderTax = ZERO;
for (GenericValue orderTaxAdjustment : orderTaxAdjustments) {
String comment = orderTaxAdjustment.getString("comments");
- if (orderTaxAdjustment.get("amount") != null && comment !=null &&
comment.startsWith("Added manually by")) {
+ if (orderTaxAdjustment.get("amount") != null &&
"Y".equals(orderTaxAdjustment.getString("isManual"))) {
totalManuallyAddedOrderTax =
totalManuallyAddedOrderTax.add(orderTaxAdjustment.getBigDecimal("amount").setScale(taxDecimals,
taxRounding));
}
}
@@ -4325,7 +4325,7 @@ public class OrderServices {
// Removing objects from toStore list for old
Shipping and Handling Charges Adjustment and Sales Tax Adjustment.
removeList.add(stored);
}
- if (stored.get("comments") != null &&
((String)stored.get("comments")).startsWith("Added manually by")) {
+ if ("Y".equals(stored.getString("isManual"))) {
// Removing objects from toStore list for Manually
added Adjustment.
removeList.add(stored);
}
@@ -4335,7 +4335,7 @@ public class OrderServices {
}
for (GenericValue toAdd: toAddList) {
if ("OrderAdjustment".equals(toAdd.getEntityName())) {
- if (toAdd.get("comments") != null &&
((String)toAdd.get("comments")).startsWith("Added manually by") &&
(("PROMOTION_ADJUSTMENT".equals(toAdd.get("orderAdjustmentTypeId"))) ||
+ if ("Y".equals(toAdd.getString("isManual")) &&
(("PROMOTION_ADJUSTMENT".equals(toAdd.get("orderAdjustmentTypeId"))) ||
("SHIPPING_CHARGES".equals(toAdd.get("orderAdjustmentTypeId"))) ||
("SALES_TAX".equals(toAdd.get("orderAdjustmentTypeId"))))) {
toStore.add(toAdd);
}
Modified:
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1745462&r1=1745461&r2=1745462&view=diff
==============================================================================
---
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
(original)
+++
ofbiz/branches/release14.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
Wed May 25 09:16:08 2016
@@ -1496,8 +1496,7 @@ public class ShoppingCartEvents {
&&
((String)adjustment.get("description")).startsWith("Tax adjustment due")) {
cart.addAdjustment(adjustment);
}
- if ( adjustment.get("comments") != null
- &&
((String)adjustment.get("comments")).startsWith("Added manually by")) {
+ if ("Y".equals(adjustment.getString("isManual"))) {
cart.addAdjustment(adjustment);
}
}
Modified:
ofbiz/branches/release14.12/applications/order/webapp/ordermgr/order/editorderitems.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release14.12/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=1745462&r1=1745461&r2=1745462&view=diff
==============================================================================
---
ofbiz/branches/release14.12/applications/order/webapp/ordermgr/order/editorderitems.ftl
(original)
+++
ofbiz/branches/release14.12/applications/order/webapp/ordermgr/order/editorderitems.ftl
Wed May 25 09:16:08 2016
@@ -353,6 +353,7 @@ under the License.
<#if security.hasEntityPermission("ORDERMGR", "_UPDATE", session) &&
orderHeader.statusId != "ORDER_COMPLETED" && orderHeader.statusId !=
"ORDER_CANCELLED" && orderHeader.statusId != "ORDER_REJECTED">
<form name="addAdjustmentForm" method="post"
action="<@ofbizUrl>createOrderAdjustment</@ofbizUrl>">
<input type="hidden" name="comments" value="Added manually by
[${userLogin.userLoginId}]"/>
+ <input type="hidden" name="isManual" value="Y"/>
<input type="hidden" name="orderId" value="${orderId!}"/>
<table class="basic-table" cellspacing="0">
<tr><td colspan="3"><hr /></td></tr>