You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by mo...@apache.org on 2011/01/08 11:34:58 UTC
svn commit: r1056686 - in /ofbiz/trunk/applications/order:
entitydef/entitymodel_view.xml src/org/ofbiz/order/order/OrderReadHelper.java
Author: mor
Date: Sat Jan 8 10:34:58 2011
New Revision: 1056686
URL: http://svn.apache.org/viewvc?rev=1056686&view=rev
Log:
Bug fix - If an order placed with a billing account is edited then the billing account amount under payment section on order detail page wasn't updated to the new order amount.
Modified:
ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
Modified: ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml?rev=1056686&r1=1056685&r2=1056686&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml (original)
+++ ofbiz/trunk/applications/order/entitydef/entitymodel_view.xml Sat Jan 8 10:34:58 2011
@@ -911,11 +911,10 @@ under the License.
<alias entity-alias="OPP" name="paymentMethodTypeId" group-by="true"/>
<alias entity-alias="PMT" name="description" group-by="true"/>
<alias entity-alias="OPP" name="maxAmount" function="sum"/>
- <!-- these can be used for query, but generally won't be included in the fields-to-select -->
- <alias entity-alias="OH" name="orderId"/>
- <alias entity-alias="OH" name="orderTypeId"/>
- <alias entity-alias="OH" name="orderDate"/>
- <alias entity-alias="OH" name="billingAccountId"/>
+ <alias entity-alias="OH" name="orderId" group-by="true"/>
+ <alias entity-alias="OH" name="orderTypeId" group-by="true"/>
+ <alias entity-alias="OH" name="orderDate" group-by="true"/>
+ <alias entity-alias="OH" name="billingAccountId" group-by="true"/>
<alias entity-alias="OPP" name="preferenceStatusId" field="statusId" group-by="true"/>
<view-link entity-alias="OH" rel-entity-alias="OPP">
<key-map field-name="orderId"/>
Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1056686&r1=1056685&r2=1056686&view=diff
==============================================================================
--- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Sat Jan 8 10:34:58 2011
@@ -679,8 +679,17 @@ public class OrderReadHelper {
if (getBillingAccount() == null) {
return BigDecimal.ZERO;
} else {
- List<GenericValue> paymentPreferences = getPaymentPreferences();
- GenericValue billingAccountPaymentPreference = EntityUtil.getFirst(EntityUtil.filterByAnd(paymentPreferences, UtilMisc.toMap("paymentMethodTypeId", "EXT_BILLACT")));
+ List<GenericValue> paymentPreferences = null;
+ try {
+ Delegator delegator = orderHeader.getDelegator();
+ paymentPreferences = delegator.findByAnd("OrderPurchasePaymentSummary", UtilMisc.toMap("orderId", orderHeader.getString("orderId")));
+ } catch (GenericEntityException e) {
+ Debug.logWarning(e, module);
+ }
+ List<EntityExpr> exprs = UtilMisc.toList(
+ EntityCondition.makeCondition("paymentMethodTypeId", "EXT_BILLACT"),
+ EntityCondition.makeCondition("preferenceStatusId", EntityOperator.NOT_EQUAL, "PAYMENT_CANCELLED"));
+ GenericValue billingAccountPaymentPreference = EntityUtil.getFirst(EntityUtil.filterByAnd(paymentPreferences, exprs));
if ((billingAccountPaymentPreference != null) && (billingAccountPaymentPreference.getBigDecimal("maxAmount") != null)) {
return billingAccountPaymentPreference.getBigDecimal("maxAmount");
} else {