Author: deepak
Date: Wed May 25 09:21:45 2016
New Revision: 1745463
URL: http://svn.apache.org/viewvc?rev=1745463&view=rev
Log:
OFBIZ-7078) Manually merged r#1744781
=======================================================
Extend OrderAdjustment entity and add isManual field
=======================================================
Thanks Rohit Koushal for your contribution.
Modified:
ofbiz/branches/release13.07/applications/order/entitydef/entitymodel.xml
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/order/editorderitems.ftl
Modified:
ofbiz/branches/release13.07/applications/order/entitydef/entitymodel.xml
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/entitydef/entitymodel.xml?rev=1745463&r1=1745462&r2=1745463&view=diff
==============================================================================
--- ofbiz/branches/release13.07/applications/order/entitydef/entitymodel.xml
(original)
+++ ofbiz/branches/release13.07/applications/order/entitydef/entitymodel.xml
Wed May 25 09:21:45 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/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1745463&r1=1745462&r2=1745463&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/order/OrderServices.java
Wed May 25 09:21:45 2016
@@ -1593,7 +1593,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));
}
}
@@ -4221,7 +4221,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);
}
@@ -4231,7 +4231,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/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1745463&r1=1745462&r2=1745463&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
(original)
+++
ofbiz/branches/release13.07/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java
Wed May 25 09:21:45 2016
@@ -1498,8 +1498,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/release13.07/applications/order/webapp/ordermgr/order/editorderitems.ftl
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release13.07/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=1745463&r1=1745462&r2=1745463&view=diff
==============================================================================
---
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/order/editorderitems.ftl
(original)
+++
ofbiz/branches/release13.07/applications/order/webapp/ordermgr/order/editorderitems.ftl
Wed May 25 09:21:45 2016
@@ -340,6 +340,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?if_exists}"/>
<table class="basic-table" cellspacing="0">
<tr><td colspan="3"><hr /></td></tr>