Author: deepak
Date: Wed May 25 09:06:22 2016 New Revision: 1745460 URL: http://svn.apache.org/viewvc?rev=1745460&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/release15.12/applications/datamodel/entitydef/order-entitymodel.xml ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/branches/release15.12/applications/order/webapp/ordermgr/order/editorderitems.ftl Modified: ofbiz/branches/release15.12/applications/datamodel/entitydef/order-entitymodel.xml URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/datamodel/entitydef/order-entitymodel.xml?rev=1745460&r1=1745459&r2=1745460&view=diff ============================================================================== --- ofbiz/branches/release15.12/applications/datamodel/entitydef/order-entitymodel.xml (original) +++ ofbiz/branches/release15.12/applications/datamodel/entitydef/order-entitymodel.xml Wed May 25 09:06:22 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/release15.12/applications/order/src/org/ofbiz/order/order/OrderServices.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=1745460&r1=1745459&r2=1745460&view=diff ============================================================================== --- ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/order/OrderServices.java (original) +++ ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/order/OrderServices.java Wed May 25 09:06:22 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)); } } @@ -4322,7 +4321,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); } @@ -4332,7 +4331,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/release15.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1745460&r1=1745459&r2=1745460&view=diff ============================================================================== --- ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original) +++ ofbiz/branches/release15.12/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java Wed May 25 09:06:22 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/branches/release15.12/applications/order/webapp/ordermgr/order/editorderitems.ftl URL: http://svn.apache.org/viewvc/ofbiz/branches/release15.12/applications/order/webapp/ordermgr/order/editorderitems.ftl?rev=1745460&r1=1745459&r2=1745460&view=diff ============================================================================== --- ofbiz/branches/release15.12/applications/order/webapp/ordermgr/order/editorderitems.ftl (original) +++ ofbiz/branches/release15.12/applications/order/webapp/ordermgr/order/editorderitems.ftl Wed May 25 09:06:22 2016 @@ -352,6 +352,7 @@ under the License. <#-- add new adjustment --> <#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="isManual" value="Y"/> <input type="hidden" name="comments" value="Added manually by [${userLogin.userLoginId}]"/> <input type="hidden" name="orderId" value="${orderId!}"/> <table class="basic-table" cellspacing="0"> |
Free forum by Nabble | Edit this page |