Author: deepak
Date: Fri May 20 18:03:11 2016 New Revision: 1744781 URL: http://svn.apache.org/viewvc?rev=1744781&view=rev Log: (OFBIZ-7078) Applied patch from jira issue. ======================================================= Extend OrderAdjustment entity and add isManual field ======================================================= Thanks Rohit Koushal for your contribution. Modified: ofbiz/trunk/applications/datamodel/entitydef/order-entitymodel.xml ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/template/order/EditOrderItems.ftl Modified: ofbiz/trunk/applications/datamodel/entitydef/order-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/datamodel/entitydef/order-entitymodel.xml?rev=1744781&r1=1744780&r2=1744781&view=diff ============================================================================== --- ofbiz/trunk/applications/datamodel/entitydef/order-entitymodel.xml (original) +++ ofbiz/trunk/applications/datamodel/entitydef/order-entitymodel.xml Fri May 20 18:03:11 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/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=1744781&r1=1744780&r2=1744781&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 Fri May 20 18:03:11 2016 @@ -1636,8 +1636,7 @@ public class OrderServices { // Accumulate the total manually added tax adjustment 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)); } } @@ -4276,7 +4275,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); } @@ -4286,7 +4285,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/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1744781&r1=1744780&r2=1744781&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Fri May 20 18:03:11 2016 @@ -1493,8 +1493,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/trunk/applications/order/template/order/EditOrderItems.ftl URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/template/order/EditOrderItems.ftl?rev=1744781&r1=1744780&r2=1744781&view=diff ============================================================================== --- ofbiz/trunk/applications/order/template/order/EditOrderItems.ftl (original) +++ ofbiz/trunk/applications/order/template/order/EditOrderItems.ftl Fri May 20 18:03:11 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> |
Free forum by Nabble | Edit this page |