Author: jleroux
Date: Wed May 31 16:09:11 2017
New Revision: 1797066

URL: http://svn.apache.org/viewvc?rev=1797066&view=rev
Log:
Improved: Greater precise value overriding price in order
(OFBIZ-9145)

I encounter a problem when try to re-enter orders originally created in another 
system (not ofbiz). And I found some cases when it's not possible to reproduce 
it exactly due to some promo rules triggered in this another system. 
But I must. Difference .01 is important.

Solution would be if I can change the unit price in an existing order using 
value with 3 digits after decimal point. I found that if I add new order item 
and check "Override" price I am able to enter more precise values.

But if I update unit price in an existing order item I am not, updateOrderItems 
rounds it to 2 digits. Exactly the same intention but works differently.

This makes me think we can remove rounding in second case. 
I believe if user want to change the unit price he knows why.

jleroux: despite slightly changing the behaviour of updateOrderItems, I see no
crucial reasons why we would not do that. The consistency aspect is here 
important.


Thanks: Oleg Andreyev

Modified:
    
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java

Modified: 
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: 
http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1797066&r1=1797065&r2=1797066&view=diff
==============================================================================
--- 
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
 (original)
+++ 
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
 Wed May 31 16:09:11 2017
@@ -3738,7 +3738,6 @@ public class OrderServices {
                             Debug.logError(e, module);
                             return ServiceUtil.returnError(e.getMessage());
                         }
-                        price = price.setScale(orderDecimals, orderRounding);
                         cartItem.setBasePrice(price);
                         cartItem.setIsModifiedPrice(true);
                         Debug.logInfo("Set item price: [" + itemSeqId + "] " + 
price, module);
@@ -6198,7 +6197,7 @@ public class OrderServices {
                             .where(cond)
                             .orderBy("entryDate ASC");
 
-                    try (EntityListIterator eli = eq.queryIterator()){
+                    try (EntityListIterator eli = eq.queryIterator()) {
                         GenericValue orderHeader;
                         while ((orderHeader = eli.next()) != null) {
                             orderIds.add(orderHeader.getString("orderId"));


Reply via email to