Author: mor
Date: Thu Jan 20 11:00:39 2011
New Revision: 1061214
URL: http://svn.apache.org/viewvc?rev=1061214&view=rev
Log:
Merged from trunk r1056686.
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/branches/release10.04/applications/order/entitydef/entitymodel_view.xml
ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
Modified:
ofbiz/branches/release10.04/applications/order/entitydef/entitymodel_view.xml
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/entitydef/entitymodel_view.xml?rev=1061214&r1=1061213&r2=1061214&view=diff
==============================================================================
---
ofbiz/branches/release10.04/applications/order/entitydef/entitymodel_view.xml
(original)
+++
ofbiz/branches/release10.04/applications/order/entitydef/entitymodel_view.xml
Thu Jan 20 11:00:39 2011
@@ -913,11 +913,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/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL:
http://svn.apache.org/viewvc/ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1061214&r1=1061213&r2=1061214&view=diff
==============================================================================
---
ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
(original)
+++
ofbiz/branches/release10.04/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
Thu Jan 20 11:00:39 2011
@@ -675,8 +675,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 {