You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by er...@apache.org on 2012/06/19 23:36:33 UTC
svn commit: r1351866 [19/48] - in /ofbiz/branches/20120329_portletWidget: ./
applications/accounting/ applications/accounting/config/
applications/accounting/data/ applications/accounting/entitydef/
applications/accounting/script/org/ofbiz/accounting/i...
Modified: ofbiz/branches/20120329_portletWidget/applications/order/ofbiz-component.xml
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/ofbiz-component.xml?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/ofbiz-component.xml (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/ofbiz-component.xml Tue Jun 19 21:36:11 2012
@@ -34,7 +34,7 @@ under the License.
<entity-resource type="data" reader-name="seed" loader="main" location="data/OrderTypeData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/OrderPortletData.xml"/>
<entity-resource type="data" reader-name="seed-initial" loader="main" location="data/OrderScheduledServices.xml"/>
- <entity-resource type="data" reader-name="seed" loader="main" location="data/OrderSecurityData.xml"/>
+ <entity-resource type="data" reader-name="security" loader="main" location="data/OrderSecurityData.xml"/>
<entity-resource type="data" reader-name="seed" loader="main" location="data/OrderHelpData.xml"/>
<entity-resource type="data" reader-name="demo" loader="main" location="data/OrderDemoUser.xml"/>
<entity-resource type="data" reader-name="demo" loader="main" location="data/OrderDemoData.xml"/>
Propchange: ofbiz/branches/20120329_portletWidget/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml
------------------------------------------------------------------------------
Merged /ofbiz/trunk/applications/order/script/org/ofbiz/order/customer/CheckoutMapProcs.xml:r1340642-1346323
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java Tue Jun 19 21:36:11 2012
@@ -179,7 +179,7 @@ public class OrderChangeHelper {
if (orderHeader != null) {
List<GenericValue> orderItems = null;
try {
- orderItems = orderHeader.getRelated("OrderItem");
+ orderItems = orderHeader.getRelated("OrderItem", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get OrderItem records for OrderHeader : " + orderId, module);
}
@@ -189,14 +189,14 @@ public class OrderChangeHelper {
GenericValue product = null;
try {
- product = orderItem.getRelatedOne("Product");
+ product = orderItem.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get Product record for OrderItem : " + orderId + "/" + orderItemSeqId, module);
}
if (product != null) {
GenericValue productType = null;
try {
- productType = product.getRelatedOne("ProductType");
+ productType = product.getRelatedOne("ProductType", false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get ProductType from Product : " + product, module);
}
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java Tue Jun 19 21:36:11 2012
@@ -50,7 +50,7 @@ public class OrderContentWrapper {
public static final String module = OrderContentWrapper.class.getName();
public static final String SEPARATOR = "::"; // cache key separator
- public static UtilCache<String, String> orderContentCache;
+ private static final UtilCache<String, String> orderContentCache = UtilCache.createUtilCache("order.content", true); // use soft reference to free up memory if needed
public static OrderContentWrapper makeOrderContentWrapper(GenericValue order, HttpServletRequest request) {
return new OrderContentWrapper(order, request);
@@ -66,9 +66,6 @@ public class OrderContentWrapper {
this.order = order;
this.locale = locale;
this.mimeTypeId = mimeTypeId;
- if (orderContentCache == null) {
- orderContentCache = UtilCache.createUtilCache("order.content", true); // use soft reference to free up memory if needed
- }
}
public OrderContentWrapper(GenericValue order, HttpServletRequest request) {
@@ -76,9 +73,6 @@ public class OrderContentWrapper {
this.order = order;
this.locale = UtilHttp.getLocale(request);
this.mimeTypeId = "text/html";
- if (orderContentCache == null) {
- orderContentCache = UtilCache.createUtilCache("order.content", true); // use soft reference to free up memory if needed
- }
}
public String get(String orderContentTypeId) {
@@ -102,17 +96,16 @@ public class OrderContentWrapper {
String cacheKey = orderContentTypeId + SEPARATOR + locale + SEPARATOR + mimeTypeId + SEPARATOR + order.get("orderId") + SEPARATOR + orderItemSeqId;
try {
- if (orderContentCache != null && orderContentCache.get(cacheKey) != null) {
- return orderContentCache.get(cacheKey);
+ String cachedValue = orderContentCache.get(cacheKey);
+ if (cachedValue != null) {
+ return cachedValue;
}
Writer outWriter = new StringWriter();
getOrderContentAsText(null, null, order, orderContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter);
String outString = outWriter.toString();
if (outString.length() > 0) {
- if (orderContentCache != null) {
- orderContentCache.put(cacheKey, outString);
- }
+ outString = orderContentCache.putIfAbsentAndGet(cacheKey, outString);
}
return outString;
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderEvents.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderEvents.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderEvents.java Tue Jun 19 21:36:11 2012
@@ -111,9 +111,9 @@ public class OrderEvents {
for (String orderItemSeqId : orderItemSeqIds) {
try {
GenericValue orderItem = delegator.findOne("OrderItem", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), false);
- List<GenericValue> orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc");
+ List<GenericValue> orderItemShipGroupAssocs = orderItem.getRelated("OrderItemShipGroupAssoc", null, null, false);
for (GenericValue orderItemShipGroupAssoc : orderItemShipGroupAssocs) {
- GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup");
+ GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup", false);
String shipGroupSeqId = orderItemShipGroup.getString("shipGroupSeqId");
Map<String, Object> contextMap = FastMap.newInstance();
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderListState.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderListState.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderListState.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderListState.java Tue Jun 19 21:36:11 2012
@@ -241,7 +241,7 @@ public class OrderListState implements S
}
List<EntityCondition> statusConditions = FastList.newInstance();
- for(String status : orderFilterState.keySet()) {
+ for(String status : orderStatusState.keySet()) {
if (!hasStatus(status)) continue;
statusConditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameterToOrderStatusId.get(status)));
}
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java Tue Jun 19 21:36:11 2012
@@ -103,7 +103,7 @@ public class OrderReadHelper {
} else if (this.orderHeader == null && orderItems != null) {
GenericValue firstItem = EntityUtil.getFirst(orderItems);
try {
- this.orderHeader = firstItem.getRelatedOne("OrderHeader");
+ this.orderHeader = firstItem.getRelatedOne("OrderHeader", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
this.orderHeader = null;
@@ -186,7 +186,7 @@ public class OrderReadHelper {
public List<GenericValue> getAdjustments() {
if (adjustments == null) {
try {
- adjustments = orderHeader.getRelated("OrderAdjustment");
+ adjustments = orderHeader.getRelated("OrderAdjustment", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -199,7 +199,7 @@ public class OrderReadHelper {
public List<GenericValue> getPaymentPreferences() {
if (paymentPrefs == null) {
try {
- paymentPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("orderPaymentPreferenceId"));
+ paymentPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("orderPaymentPreferenceId"), false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -219,7 +219,7 @@ public class OrderReadHelper {
try {
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"),
EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_CONFIRMED"));
- payments = paymentPref.getRelated("Payment");
+ payments = paymentPref.getRelated("Payment", null, null, false);
payments = EntityUtil.filterByOr(payments, exprs);
List<EntityExpr> conds = UtilMisc.toList(EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_PAYMENT"),
EntityCondition.makeCondition("paymentTypeId", EntityOperator.EQUALS, "CUSTOMER_DEPOSIT"),
@@ -296,7 +296,7 @@ public class OrderReadHelper {
if (prefs != null) {
for(GenericValue payPref : prefs) {
try {
- orderPayments.addAll(payPref.getRelated("Payment"));
+ orderPayments.addAll(payPref.getRelated("Payment", null, null, false));
} catch (GenericEntityException e) {
Debug.logError(e, module);
return null;
@@ -309,7 +309,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderStatuses() {
if (orderStatuses == null) {
try {
- orderStatuses = orderHeader.getRelated("OrderStatus");
+ orderStatuses = orderHeader.getRelated("OrderStatus", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -319,7 +319,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderTerms() {
try {
- return orderHeader.getRelated("OrderTerm");
+ return orderHeader.getRelated("OrderTerm", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return null;
@@ -346,10 +346,10 @@ public class OrderReadHelper {
UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false);
if (shipGroup != null) {
- GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod");
+ GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false);
if (carrierShipmentMethod != null) {
- GenericValue shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType");
+ GenericValue shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", false);
if (shipmentMethodType != null) {
return UtilFormatOut.checkNull(shipGroup.getString("carrierPartyId")) + " " +
@@ -370,10 +370,10 @@ public class OrderReadHelper {
UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false);
if (shipGroup != null) {
- GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod");
+ GenericValue carrierShipmentMethod = shipGroup.getRelatedOne("CarrierShipmentMethod", false);
if (carrierShipmentMethod != null) {
- GenericValue shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType");
+ GenericValue shipmentMethodType = carrierShipmentMethod.getRelatedOne("ShipmentMethodType", false);
if (shipmentMethodType != null) {
return UtilFormatOut.checkNull(shipmentMethodType.getString("shipmentMethodTypeId")) + "@" + UtilFormatOut.checkNull(shipGroup.getString("carrierPartyId"));
@@ -396,9 +396,9 @@ public class OrderReadHelper {
public boolean hasPhysicalProductItems() throws GenericEntityException {
for(GenericValue orderItem : this.getOrderItems()) {
- GenericValue product = orderItem.getRelatedOneCache("Product");
+ GenericValue product = orderItem.getRelatedOne("Product", true);
if (product != null) {
- GenericValue productType = product.getRelatedOneCache("ProductType");
+ GenericValue productType = product.getRelatedOne("ProductType", true);
if ("Y".equals(productType.getString("isPhysical"))) {
return true;
}
@@ -419,7 +419,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderItemShipGroups() {
try {
- return orderHeader.getRelated("OrderItemShipGroup", UtilMisc.toList("shipGroupSeqId"));
+ return orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipGroupSeqId"), false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -453,7 +453,7 @@ public class OrderReadHelper {
UtilMisc.toMap("orderId", orderHeader.getString("orderId"), "shipGroupSeqId", shipGroupSeqId), false);
if (shipGroup != null) {
- return shipGroup.getRelatedOne("PostalAddress");
+ return shipGroup.getRelatedOne("PostalAddress", false);
}
} catch (GenericEntityException e) {
@@ -466,14 +466,13 @@ public class OrderReadHelper {
@Deprecated
public GenericValue getShippingAddress() {
try {
- GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderContactMech", UtilMisc.toMap(
- "contactMechPurposeTypeId", "SHIPPING_LOCATION")));
+ GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "SHIPPING_LOCATION"), null, false));
if (orderContactMech != null) {
- GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech");
+ GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false);
if (contactMech != null) {
- return contactMech.getRelatedOne("PostalAddress");
+ return contactMech.getRelatedOne("PostalAddress", false);
}
}
} catch (GenericEntityException e) {
@@ -508,13 +507,13 @@ public class OrderReadHelper {
public GenericValue getBillingAddress() {
GenericValue billingAddress = null;
try {
- GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION")));
+ GenericValue orderContactMech = EntityUtil.getFirst(orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", "BILLING_LOCATION"), null, false));
if (orderContactMech != null) {
- GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech");
+ GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false);
if (contactMech != null) {
- billingAddress = contactMech.getRelatedOne("PostalAddress");
+ billingAddress = contactMech.getRelatedOne("PostalAddress", false);
}
}
} catch (GenericEntityException e) {
@@ -526,7 +525,7 @@ public class OrderReadHelper {
GenericValue billingAccount = getBillingAccount();
if (billingAccount != null) {
try {
- billingAddress = billingAccount.getRelatedOne("PostalAddress");
+ billingAddress = billingAccount.getRelatedOne("PostalAddress", false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -535,15 +534,15 @@ public class OrderReadHelper {
GenericValue paymentPreference = EntityUtil.getFirst(getPaymentPreferences());
if (paymentPreference != null) {
try {
- GenericValue paymentMethod = paymentPreference.getRelatedOne("PaymentMethod");
+ GenericValue paymentMethod = paymentPreference.getRelatedOne("PaymentMethod", false);
if (paymentMethod != null) {
- GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard");
+ GenericValue creditCard = paymentMethod.getRelatedOne("CreditCard", false);
if (creditCard != null) {
- billingAddress = creditCard.getRelatedOne("PostalAddress");
+ billingAddress = creditCard.getRelatedOne("PostalAddress", false);
} else {
- GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount");
+ GenericValue eftAccount = paymentMethod.getRelatedOne("EftAccount", false);
if (eftAccount != null) {
- billingAddress = eftAccount.getRelatedOne("PostalAddress");
+ billingAddress = eftAccount.getRelatedOne("PostalAddress", false);
}
}
}
@@ -558,8 +557,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderContactMechs(String purposeTypeId) {
try {
- return orderHeader.getRelatedByAnd("OrderContactMech",
- UtilMisc.toMap("contactMechPurposeTypeId", purposeTypeId));
+ return orderHeader.getRelated("OrderContactMech", UtilMisc.toMap("contactMechPurposeTypeId", purposeTypeId), null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -568,7 +566,7 @@ public class OrderReadHelper {
public Timestamp getEarliestShipByDate() {
try {
- List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", UtilMisc.toList("shipByDate"));
+ List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipByDate"), false);
if (groups.size() > 0) {
GenericValue group = groups.get(0);
return group.getTimestamp("shipByDate");
@@ -581,7 +579,7 @@ public class OrderReadHelper {
public Timestamp getLatestShipAfterDate() {
try {
- List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", UtilMisc.toList("shipAfterDate DESC"));
+ List<GenericValue> groups = orderHeader.getRelated("OrderItemShipGroup", null, UtilMisc.toList("shipAfterDate DESC"), false);
if (groups.size() > 0) {
GenericValue group = groups.get(0);
return group.getTimestamp("shipAfterDate");
@@ -595,7 +593,7 @@ public class OrderReadHelper {
public String getCurrentStatusString() {
GenericValue statusItem = null;
try {
- statusItem = orderHeader.getRelatedOneCache("StatusItem");
+ statusItem = orderHeader.getRelatedOne("StatusItem", true);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -618,7 +616,7 @@ public class OrderReadHelper {
boolean isCurrent = true;
while (orderStatusIter.hasNext()) {
GenericValue orderStatus = orderStatusIter.next();
- GenericValue statusItem = orderStatus.getRelatedOneCache("StatusItem");
+ GenericValue statusItem = orderStatus.getRelatedOne("StatusItem", true);
if (statusItem != null) {
orderStatusString.append(statusItem.get("description", locale));
@@ -649,7 +647,7 @@ public class OrderReadHelper {
public GenericValue getBillingAccount() {
GenericValue billingAccount = null;
try {
- billingAccount = orderHeader.getRelatedOne("BillingAccount");
+ billingAccount = orderHeader.getRelatedOne("BillingAccount", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -729,7 +727,7 @@ public class OrderReadHelper {
Delegator delegator = orderHeader.getDelegator();
GenericValue partyObject = null;
try {
- GenericValue orderRole = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", roleTypeId)));
+ GenericValue orderRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", UtilMisc.toMap("roleTypeId", roleTypeId), null, false));
if (orderRole != null) {
partyObject = delegator.findOne("Person", UtilMisc.toMap("partyId", orderRole.getString("partyId")), false);
@@ -746,7 +744,7 @@ public class OrderReadHelper {
public String getDistributorId() {
try {
- GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", "DISTRIBUTOR")));
+ GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", UtilMisc.toMap("roleTypeId", "DISTRIBUTOR"), null, false));
return distributorRole == null ? null : distributorRole.getString("partyId");
} catch (GenericEntityException e) {
@@ -757,7 +755,7 @@ public class OrderReadHelper {
public String getAffiliateId() {
try {
- GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderRole", UtilMisc.toMap("roleTypeId", "AFFILIATE")));
+ GenericEntity distributorRole = EntityUtil.getFirst(orderHeader.getRelated("OrderRole", UtilMisc.toMap("roleTypeId", "AFFILIATE"), null, false));
return distributorRole == null ? null : distributorRole.getString("partyId");
} catch (GenericEntityException e) {
@@ -800,7 +798,7 @@ public class OrderReadHelper {
// get the ADDITIONAL_FEATURE adjustments
List<GenericValue> additionalFeatures = null;
try {
- additionalFeatures = item.getRelatedByAnd("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"));
+ additionalFeatures = item.getRelated("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module);
}
@@ -846,7 +844,7 @@ public class OrderReadHelper {
// get the ADDITIONAL_FEATURE adjustments
List<GenericValue> additionalFeatures = null;
try {
- additionalFeatures = item.getRelatedByAnd("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"));
+ additionalFeatures = item.getRelated("OrderAdjustment", UtilMisc.toMap("orderAdjustmentTypeId", "ADDITIONAL_FEATURE"), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module);
}
@@ -876,7 +874,7 @@ public class OrderReadHelper {
for(GenericValue item : validItems) {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 0", module);
}
@@ -898,7 +896,7 @@ public class OrderReadHelper {
for(GenericValue item : validItems) {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 0", module);
}
@@ -920,7 +918,7 @@ public class OrderReadHelper {
for(GenericValue item : validItems) {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 0", module);
return ZERO;
@@ -953,7 +951,7 @@ public class OrderReadHelper {
for(GenericValue item : validItems) {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 0", module);
return ZERO;
@@ -986,7 +984,7 @@ public class OrderReadHelper {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 0", module);
return BigDecimal.ZERO;
@@ -1068,7 +1066,7 @@ public class OrderReadHelper {
try {
// get a set of invoice IDs that belong to the order
- List<GenericValue> orderItemBillings = orderHeader.getRelatedCache("OrderItemBilling");
+ List<GenericValue> orderItemBillings = orderHeader.getRelated("OrderItemBilling", null, null, true);
Set<String> invoiceIds = new HashSet<String>();
for(GenericValue orderItemBilling : orderItemBillings) {
invoiceIds.add(orderItemBilling.getString("invoiceId"));
@@ -1100,7 +1098,7 @@ public class OrderReadHelper {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem", module);
return BigDecimal.ZERO;
@@ -1149,7 +1147,7 @@ public class OrderReadHelper {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting Product from OrderItem; returning 1", module);
return 1;
@@ -1170,7 +1168,7 @@ public class OrderReadHelper {
}
if (virtual != null) {
try {
- GenericValue virtualProduct = virtual.getRelatedOne("MainProduct");
+ GenericValue virtualProduct = virtual.getRelatedOne("MainProduct", false);
pieces = virtualProduct.getLong("piecesIncluded");
} catch (GenericEntityException e) {
Debug.logError(e, "Problem getting virtual product");
@@ -1226,7 +1224,7 @@ public class OrderReadHelper {
if (orderContactMechs != null) {
for(GenericValue orderContactMech : orderContactMechs) {
try {
- GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech");
+ GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false);
emails.append(emails.length() > 0 ? "," : "").append(contactMech.getString("infoString"));
} catch (GenericEntityException e) {
Debug.logWarning(e, "Problems getting contact mech from order contact mech", module);
@@ -1258,14 +1256,14 @@ public class OrderReadHelper {
if ("PAYMENT_CANCELLED".equals(pref.get("statusId")) || "PAYMENT_DECLINED".equals(pref.get("statusId"))) {
continue;
} else if ("PAYMENT_SETTLED".equals(pref.get("statusId"))) {
- List<GenericValue> responses = pref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"));
+ List<GenericValue> responses = pref.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"), null, false);
for(GenericValue response : responses) {
BigDecimal amount = response.getBigDecimal("amount");
if (amount != null) {
openAmount = openAmount.add(amount);
}
}
- responses = pref.getRelatedByAnd("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_REFUND"));
+ responses = pref.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_REFUND"), null, false);
for(GenericValue response : responses) {
BigDecimal amount = response.getBigDecimal("amount");
if (amount != null) {
@@ -1336,7 +1334,7 @@ public class OrderReadHelper {
public List<GenericValue> getOrderItems() {
if (orderItems == null) {
try {
- orderItems = orderHeader.getRelated("OrderItem", UtilMisc.toList("orderItemSeqId"));
+ orderItems = orderHeader.getRelated("OrderItem", null, UtilMisc.toList("orderItemSeqId"), false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -1402,7 +1400,7 @@ public class OrderReadHelper {
for(GenericValue item : items) {
List<GenericValue> receipts = null;
try {
- receipts = item.getRelated("ShipmentReceipt");
+ receipts = item.getRelated("ShipmentReceipt", null, null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -1436,7 +1434,7 @@ public class OrderReadHelper {
for(GenericValue item : items) {
List<GenericValue> receipts = null;
try {
- receipts = item.getRelated("ShipmentReceipt");
+ receipts = item.getRelated("ShipmentReceipt", null, null, false);
} catch (GenericEntityException e) {
Debug.logWarning(e, module);
}
@@ -1478,14 +1476,14 @@ public class OrderReadHelper {
if (item.get("productId") != null) {
GenericValue product = null;
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get Product from OrderItem", module);
}
if (product != null) {
GenericValue productType = null;
try {
- productType = product.getRelatedOne("ProductType");
+ productType = product.getRelatedOne("ProductType", false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get ProductType from Product", module);
}
@@ -1497,7 +1495,7 @@ public class OrderReadHelper {
// make sure we have an OrderItemBilling record
List<GenericValue> orderItemBillings = null;
try {
- orderItemBillings = item.getRelated("OrderItemBilling");
+ orderItemBillings = item.getRelated("OrderItemBilling", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Unable to get OrderItemBilling from OrderItem");
}
@@ -1506,7 +1504,7 @@ public class OrderReadHelper {
// get the ProductContent records
List<GenericValue> productContents = null;
try {
- productContents = product.getRelated("ProductContent");
+ productContents = product.getRelated("ProductContent", null, null, false);
} catch (GenericEntityException e) {
Debug.logError("Unable to get ProductContent from Product", module);
}
@@ -1554,7 +1552,7 @@ public class OrderReadHelper {
List<GenericValue> workOrderItemFulFillments = delegator.findByAnd("WorkOrderItemFulfillment", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId), null, true);
if (!UtilValidate.isEmpty(workOrderItemFulFillments)) {
workOrderItemFulFillment = EntityUtil.getFirst(workOrderItemFulFillments);
- workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort");
+ workEffort = workOrderItemFulFillment.getRelatedOne("WorkEffort", false);
}
} catch (GenericEntityException e) {
return null;
@@ -1569,7 +1567,7 @@ public class OrderReadHelper {
public String getCurrentItemStatus(GenericValue orderItem) {
GenericValue statusItem = null;
try {
- statusItem = orderItem.getRelatedOne("StatusItem");
+ statusItem = orderItem.getRelatedOne("StatusItem", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Trouble getting StatusItem : " + orderItem, module);
}
@@ -1886,7 +1884,7 @@ public class OrderReadHelper {
// sum up the return items that have a return item response with a billing account defined
try {
for(GenericValue returnItem : returnedItems) {
- GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
+ GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse", false);
if (returnItemResponse == null) continue;
if (returnItemResponse.get("billingAccountId") == null) continue;
@@ -2098,7 +2096,7 @@ public class OrderReadHelper {
public String getAdjustmentType(GenericValue adjustment) {
GenericValue adjustmentType = null;
try {
- adjustmentType = adjustment.getRelatedOne("OrderAdjustmentType");
+ adjustmentType = adjustment.getRelatedOne("OrderAdjustmentType", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Problems with order adjustment", module);
}
@@ -2116,7 +2114,7 @@ public class OrderReadHelper {
public String getCurrentItemStatusString(GenericValue orderItem) {
GenericValue statusItem = null;
try {
- statusItem = orderItem.getRelatedOneCache("StatusItem");
+ statusItem = orderItem.getRelatedOne("StatusItem", true);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -2410,7 +2408,7 @@ public class OrderReadHelper {
GenericValue WorkOrderItemFulfillment = iter.next();
GenericValue workEffort = null;
try {
- workEffort = WorkOrderItemFulfillment.getRelatedOneCache("WorkEffort");
+ workEffort = WorkOrderItemFulfillment.getRelatedOne("WorkEffort", true);
} catch (GenericEntityException e) {}
result = result.multiply(getWorkEffortRentalQuantity(workEffort));
}
@@ -2669,8 +2667,7 @@ public class OrderReadHelper {
} else if (security.hasEntityPermission("ORDERMGR", "_ROLEVIEW", userLogin)) {
List<GenericValue> orderRoles = null;
try {
- orderRoles = orderHeader.getRelatedByAnd("OrderRole",
- UtilMisc.toMap("partyId", userLogin.getString("partyId")));
+ orderRoles = orderHeader.getRelated("OrderRole", UtilMisc.toMap("partyId", userLogin.getString("partyId")), null, false);
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot get OrderRole from OrderHeader", module);
}
@@ -2744,7 +2741,7 @@ public class OrderReadHelper {
BigDecimal invoiced = BigDecimal.ZERO;
try {
// this is simply the sum of quantity billed in all related OrderItemBillings
- List<GenericValue> billings = orderItem.getRelated("OrderItemBilling");
+ List<GenericValue> billings = orderItem.getRelated("OrderItemBilling", null, null, false);
for(GenericValue billing : billings) {
BigDecimal quantity = billing.getBigDecimal("quantity");
if (quantity != null) {
@@ -2777,7 +2774,7 @@ public class OrderReadHelper {
String attributeValue = null;
if (orderItem != null) {
try {
- GenericValue orderItemAttribute = EntityUtil.getFirst(orderItem.getRelatedByAnd("OrderItemAttribute", UtilMisc.toMap("attrName", attributeName)));
+ GenericValue orderItemAttribute = EntityUtil.getFirst(orderItem.getRelated("OrderItemAttribute", UtilMisc.toMap("attrName", attributeName), null, false));
if (orderItemAttribute != null) {
attributeValue = orderItemAttribute.getString("attrValue");
}
@@ -2792,7 +2789,7 @@ public class OrderReadHelper {
String attributeValue = null;
if (orderHeader != null) {
try {
- GenericValue orderAttribute = EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderAttribute", UtilMisc.toMap("attrName", attributeName)));
+ GenericValue orderAttribute = EntityUtil.getFirst(orderHeader.getRelated("OrderAttribute", UtilMisc.toMap("attrName", attributeName), null, false));
if (orderAttribute != null) {
attributeValue = orderAttribute.getString("attrValue");
}
Modified: ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1351866&r1=1351865&r2=1351866&view=diff
==============================================================================
--- ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original)
+++ ofbiz/branches/20120329_portletWidget/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Tue Jun 19 21:36:11 2012
@@ -170,7 +170,7 @@ public class OrderReturnServices {
GenericValue issue = EntityUtil.getFirst(itemIssue);
GenericValue inventoryItem = null;
try {
- inventoryItem = issue.getRelatedOne("InventoryItem");
+ inventoryItem = issue.getRelatedOne("InventoryItem", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
throw new GeneralRuntimeException(e.getMessage());
@@ -213,7 +213,7 @@ public class OrderReturnServices {
List<GenericValue> returnItems = null;
List<GenericValue> returnAdjustments = FastList.newInstance();
try {
- returnItems = returnHeader.getRelated("ReturnItem");
+ returnItems = returnHeader.getRelated("ReturnItem", null, null, false);
returnAdjustments = delegator.findList("ReturnAdjustment", EntityCondition.makeCondition(
EntityCondition.makeCondition("returnId", EntityOperator.EQUALS, returnId), EntityOperator.AND,
EntityCondition.makeCondition("returnItemSeqId", EntityOperator.EQUALS, "_NA_")), null, UtilMisc.toList("returnAdjustmentTypeId"), null, true);
@@ -230,7 +230,7 @@ public class OrderReturnServices {
GenericValue firstItem = EntityUtil.getFirst(returnItems);
GenericValue orderHeader = null;
try {
- orderHeader = firstItem.getRelatedOne("OrderHeader");
+ orderHeader = firstItem.getRelatedOne("OrderHeader", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -356,7 +356,7 @@ public class OrderReturnServices {
EntityCondition.makeCondition("returnId", EntityOperator.EQUALS, returnId), EntityOperator.AND,
EntityCondition.makeCondition("returnTypeId", EntityOperator.EQUALS, "RTN_WAIT_REPLACE_RES")), null, UtilMisc.toList("createdStamp"), null, false);
for (GenericValue returnItem : returnItems) {
- GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
+ GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse", false);
if (returnItemResponse != null) {
String replacementOrderId = returnItemResponse.getString("replacementOrderId");
Map<String, Object> svcCtx = UtilMisc.<String, Object>toMap("orderId", replacementOrderId, "userLogin", userLogin);
@@ -385,7 +385,7 @@ public class OrderReturnServices {
Locale locale = (Locale) context.get("locale");
if (orderItem.get("productId") != null) {
try {
- product = orderItem.getRelatedOne("Product");
+ product = orderItem.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, "ERROR: Unable to get Product from OrderItem", module);
}
@@ -419,7 +419,7 @@ public class OrderReturnServices {
if (returnable && (itemStatus.equals("ITEM_APPROVED") || itemStatus.equals("ITEM_COMPLETED"))) {
List<GenericValue> returnedItems = null;
try {
- returnedItems = orderItem.getRelated("ReturnItem");
+ returnedItems = orderItem.getRelated("ReturnItem", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -432,7 +432,7 @@ public class OrderReturnServices {
for(GenericValue returnItem : returnedItems) {
GenericValue returnHeader = null;
try {
- returnHeader = returnItem.getRelatedOne("ReturnHeader");
+ returnHeader = returnItem.getRelatedOne("ReturnHeader", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -499,7 +499,7 @@ public class OrderReturnServices {
for(GenericValue orderItemQuantityIssued : orderItemQuantitiesIssued) {
GenericValue item = null;
try {
- item = orderItemQuantityIssued.getRelatedOne("OrderItem");
+ item = orderItemQuantityIssued.getRelatedOne("OrderItem", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -511,7 +511,7 @@ public class OrderReturnServices {
BigDecimal quantityIssued = orderItemQuantityIssued.getBigDecimal("quantityIssued");
if (UtilValidate.isEmpty(quantityIssued) || quantityIssued.compareTo(BigDecimal.ZERO) == 0) {
try {
- GenericValue itemProduct = item.getRelatedOne("Product");
+ GenericValue itemProduct = item.getRelatedOne("Product", false);
if (ProductWorker.isPhysical(itemProduct)) {
continue;
}
@@ -548,7 +548,7 @@ public class OrderReturnServices {
GenericValue product = null;
if (item.get("productId") != null) {
try {
- product = item.getRelatedOne("Product");
+ product = item.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -567,7 +567,7 @@ public class OrderReturnServices {
// Order item adjustments
List<GenericValue> itemAdjustments = null;
try {
- itemAdjustments = item.getRelated("OrderAdjustment");
+ itemAdjustments = item.getRelated("OrderAdjustment", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -612,7 +612,7 @@ public class OrderReturnServices {
try {
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
if (returnHeader != null) {
- returnItems = returnHeader.getRelated("ReturnItem");
+ returnItems = returnHeader.getRelated("ReturnItem", null, null, false);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Problems looking up return information", module);
@@ -642,7 +642,7 @@ public class OrderReturnServices {
// considered completed after the return is accepted
if ("RETURN_ACCEPTED".equals(returnHeader.getString("statusId"))) {
try {
- GenericValue itemProduct = item.getRelatedOne("Product");
+ GenericValue itemProduct = item.getRelatedOne("Product", false);
if (!ProductWorker.isPhysical(itemProduct)) {
completedItems.add(item);
}
@@ -705,7 +705,7 @@ public class OrderReturnServices {
try {
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
if (returnHeader != null) {
- returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_CREDIT"));
+ returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_CREDIT"), null, false);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Problems looking up return information", module);
@@ -743,7 +743,7 @@ public class OrderReturnServices {
}
if (UtilValidate.isNotEmpty(returnItem)) {
try {
- orderHeader = returnItem.getRelatedOne("OrderHeader");
+ orderHeader = returnItem.getRelatedOne("OrderHeader", false);
} catch (GenericEntityException e) {
return ServiceUtil.returnError(e.getMessage());
}
@@ -1070,8 +1070,8 @@ public class OrderReturnServices {
try {
// get the related product stores via the orders related to this return
- List<GenericValue> orders = EntityUtil.getRelated("OrderHeader", returnItems);
- List<GenericValue> productStores = EntityUtil.getRelated("ProductStore", orders);
+ List<GenericValue> orders = EntityUtil.getRelated("OrderHeader", null, returnItems, false);
+ List<GenericValue> productStores = EntityUtil.getRelated("ProductStore", null, orders, false);
// find the minimum storeCreditValidDays of all the ProductStores associated with all the Orders on the Return, skipping null ones
Long storeCreditValidDays = null;
@@ -1132,7 +1132,7 @@ public class OrderReturnServices {
List<GenericValue> orderPayPrefs = FastList.newInstance();
try {
orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
- orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount"));
+ orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false);
} catch (GenericEntityException e) {
Debug.logError("Problem looking up order information for orderId #" + orderId, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,
@@ -1143,7 +1143,7 @@ public class OrderReturnServices {
if (UtilValidate.isEmpty(orderPayPrefs)) {
List<GenericValue> returnItemResponses = FastList.newInstance();
try {
- returnItemResponses = orderHeader.getRelated("ReplacementReturnItemResponse");
+ returnItemResponses = orderHeader.getRelated("ReplacementReturnItemResponse", null, null, false);
} catch (GenericEntityException e) {
Debug.logError("Problem getting ReturnItemResponses", module);
return ServiceUtil.returnError(e.getMessage());
@@ -1153,8 +1153,8 @@ public class OrderReturnServices {
GenericValue returnItem = null;
GenericValue returnHeader = null;
try {
- returnItem = EntityUtil.getFirst(returnItemResponse.getRelated("ReturnItem"));
- returnHeader = returnItem.getRelatedOne("ReturnHeader");
+ returnItem = EntityUtil.getFirst(returnItemResponse.getRelated("ReturnItem", null, null, false));
+ returnHeader = returnItem.getRelatedOne("ReturnHeader", false);
} catch (GenericEntityException e) {
Debug.logError("Problem getting ReturnItem", module);
return ServiceUtil.returnError(e.getMessage());
@@ -1193,7 +1193,7 @@ public class OrderReturnServices {
try {
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
if (returnHeader != null) {
- returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId));
+ returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId), null, false);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Problems looking up return information", module);
@@ -1234,7 +1234,7 @@ public class OrderReturnServices {
try {
orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", orderId), false);
// sort these desending by maxAmount
- orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount"));
+ orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false);
List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_SETTLED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PAYMENT_RECEIVED"));
orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs);
@@ -1245,7 +1245,7 @@ public class OrderReturnServices {
if (UtilValidate.isNotEmpty(orderItemAssocs)) {
String originalOrderId = EntityUtil.getFirst(orderItemAssocs).getString("orderId");
orderHeader = delegator.findOne("OrderHeader", UtilMisc.toMap("orderId", originalOrderId), false);
- orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", UtilMisc.toList("-maxAmount"));
+ orderPayPrefs = orderHeader.getRelated("OrderPaymentPreference", null, UtilMisc.toList("-maxAmount"), false);
orderPayPrefs = EntityUtil.filterByOr(orderPayPrefs, exprs);
orderId = originalOrderId;
}
@@ -1274,7 +1274,7 @@ public class OrderReturnServices {
if (UtilValidate.isNotEmpty(orgAcctgPref)) {
try {
- orgAcctgPref.getRelatedOne("PaymentMethod");
+ orgAcctgPref.getRelatedOne("PaymentMethod", false);
} catch (GenericEntityException e) {
Debug.logError("Error retrieving related refundPaymentMethod from PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), module);
}
@@ -1522,7 +1522,7 @@ public class OrderReturnServices {
GenericValue orderHeader = null;
try {
- orderHeader = paymentPref.getRelatedOne("OrderHeader");
+ orderHeader = paymentPref.getRelatedOne("OrderHeader", false);
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot get OrderHeader from OrderPaymentPreference", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1628,11 +1628,11 @@ public class OrderReturnServices {
// for each return item in the response, get the list of return item billings and then a list of invoices
Map<String, GenericValue> returnInvoices = FastMap.newInstance(); // key is invoiceId, value is Invoice GenericValue
- List<GenericValue> items = response.getRelated("ReturnItem");
+ List<GenericValue> items = response.getRelated("ReturnItem", null, null, false);
for (GenericValue item : items) {
- List<GenericValue> billings = item.getRelated("ReturnItemBilling");
+ List<GenericValue> billings = item.getRelated("ReturnItemBilling", null, null, false);
for (GenericValue billing : billings) {
- GenericValue invoice = billing.getRelatedOne("Invoice");
+ GenericValue invoice = billing.getRelatedOne("Invoice", false);
// put the invoice in the map if it doesn't already exist (a very loopy way of doing group by invoiceId without creating a view)
if (returnInvoices.get(invoice.getString("invoiceId")) == null) {
@@ -1645,7 +1645,7 @@ public class OrderReturnServices {
Map<String, BigDecimal> invoiceTotals = FastMap.newInstance(); // key is invoiceId, value is the sum of all billings for that invoice
BigDecimal grandTotal = ZERO; // The sum of all return invoice totals
for (GenericValue invoice : returnInvoices.values()) {
- List<GenericValue> billings = invoice.getRelated("ReturnItemBilling");
+ List<GenericValue> billings = invoice.getRelated("ReturnItemBilling", null, null, false);
BigDecimal runningTotal = ZERO;
for (GenericValue billing : billings) {
runningTotal = runningTotal.add(billing.getBigDecimal("amount").multiply(billing.getBigDecimal("quantity")).setScale(decimals, rounding));
@@ -1668,7 +1668,7 @@ public class OrderReturnServices {
input.put("amountApplied", amountApplied);
input.put("userLogin", userLogin);
if (response.get("billingAccountId") != null) {
- GenericValue billingAccount = response.getRelatedOne("BillingAccount");
+ GenericValue billingAccount = response.getRelatedOne("BillingAccount", false);
if (billingAccount != null) {
input.put("billingAccountId", response.get("billingAccountId"));
}
@@ -1705,7 +1705,7 @@ public class OrderReturnServices {
try {
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
if (returnHeader != null) {
- returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId));
+ returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", returnTypeId), null, false);
}
} catch (GenericEntityException e) {
Debug.logError(e, "Problems looking up return information", module);
@@ -1764,7 +1764,7 @@ public class OrderReturnServices {
List<GenericValue> contactMechs = FastList.newInstance();
List<GenericValue> orderCm = null;
try {
- orderCm = orderHeader.getRelated("OrderContactMech");
+ orderCm = orderHeader.getRelated("OrderContactMech", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -1781,7 +1781,7 @@ public class OrderReturnServices {
List shipmentPrefs = new ArrayList();
List orderSp = null;
try {
- orderSp = orderHeader.getRelated("OrderShipmentPreference");
+ orderSp = orderHeader.getRelated("OrderShipmentPreference", null, null, false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -1808,8 +1808,8 @@ public class OrderReturnServices {
GenericValue orderItem = null;
GenericValue product = null;
try {
- orderItem = returnItem.getRelatedOne("OrderItem");
- product = orderItem.getRelatedOne("Product");
+ orderItem = returnItem.getRelatedOne("OrderItem", false);
+ product = orderItem.getRelatedOne("Product", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
continue;
@@ -1825,11 +1825,9 @@ public class OrderReturnServices {
if ("CUSTOMER_RETURN".equals(returnHeaderTypeId)) {
try {
if (UtilValidate.isNotEmpty(product)) {
- GenericValue refurbItemAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(product.getRelated("MainProductAssoc",
- UtilMisc.toMap("productAssocTypeId", "PRODUCT_REFURB"),
- UtilMisc.toList("sequenceNum"))));
+ GenericValue refurbItemAssoc = EntityUtil.getFirst(EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REFURB"), UtilMisc.toList("sequenceNum"), false)));
if (UtilValidate.isNotEmpty(refurbItemAssoc)) {
- refurbItem = refurbItemAssoc.getRelatedOne("AssocProduct");
+ refurbItem = refurbItemAssoc.getRelatedOne("AssocProduct", false);
}
}
} catch (GenericEntityException e) {
@@ -1884,10 +1882,10 @@ public class OrderReturnServices {
//
GenericValue orderItemShipGroupAssoc = null;
try {
- orderItemShipGroupAssoc = EntityUtil.getFirst(orderItem.getRelated("OrderItemShipGroupAssoc"));
+ orderItemShipGroupAssoc = EntityUtil.getFirst(orderItem.getRelated("OrderItemShipGroupAssoc", null, null, false));
if (orderItemShipGroupAssoc != null) {
if (!orderItemShipGroupIds.contains(orderItemShipGroupAssoc.getString("shipGroupSeqId"))) {
- GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup");
+ GenericValue orderItemShipGroup = orderItemShipGroupAssoc.getRelatedOne("OrderItemShipGroup", false);
GenericValue newOrderItemShipGroup = (GenericValue)orderItemShipGroup.clone();
newOrderItemShipGroup.set("orderId", null);
orderItemShipGroupInfo.add(newOrderItemShipGroup);
@@ -1910,8 +1908,7 @@ public class OrderReturnServices {
List<GenericValue> repairItems = null;
try {
if (UtilValidate.isNotEmpty(product)) {
- repairItems = EntityUtil.filterByDate(product.getRelated("MainProductAssoc",
- UtilMisc.toMap("productAssocTypeId", "PRODUCT_REPAIR_SRV"), UtilMisc.toList("sequenceNum")));
+ repairItems = EntityUtil.filterByDate(product.getRelated("MainProductAssoc", UtilMisc.toMap("productAssocTypeId", "PRODUCT_REPAIR_SRV"), UtilMisc.toList("sequenceNum"), false));
}
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -1921,7 +1918,7 @@ public class OrderReturnServices {
for(GenericValue repairItem : repairItems) {
GenericValue repairItemProduct = null;
try {
- repairItemProduct = repairItem.getRelatedOne("AssocProduct");
+ repairItemProduct = repairItem.getRelatedOne("AssocProduct", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
continue;
@@ -2024,7 +2021,7 @@ public class OrderReturnServices {
if ((additionalItemTotal.compareTo(BigDecimal.ZERO) > 0) || ("RTN_CSREPLACE".equals(returnTypeId) && orderPriceTotal.compareTo(ZERO) > 0)) {
GenericValue paymentMethod = null;
try {
- paymentMethod = returnHeader.getRelatedOne("PaymentMethod");
+ paymentMethod = returnHeader.getRelatedOne("PaymentMethod", false);
} catch (GenericEntityException e) {
Debug.logError(e, module);
}
@@ -2055,13 +2052,13 @@ public class OrderReturnServices {
// we'll assume new order is under same terms as original. note orderTerms is a required parameter of storeOrder
try {
- orderMap.put("orderTerms", orderHeader.getRelated("OrderTerm"));
+ orderMap.put("orderTerms", orderHeader.getRelated("OrderTerm", null, null, false));
} catch (GenericEntityException e) {
Debug.logError(e, "Cannot create replacement order because order terms for original order are not available", module);
}
// we'll assume the new order has the same order roles of the original one
try {
- List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole");
+ List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole", null, null, false);
Map<String, List<String>> orderRolesMap = FastMap.newInstance();
if (orderRoles != null) {
for(GenericValue orderRole : orderRoles) {
@@ -2191,7 +2188,7 @@ public class OrderReturnServices {
try {
returnHeader = delegator.findOne("ReturnHeader", UtilMisc.toMap("returnId", returnId), false);
if (returnHeader != null) {
- returnItems = returnHeader.getRelatedByAnd("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_REFUND"));
+ returnItems = returnHeader.getRelated("ReturnItem", UtilMisc.toMap("returnTypeId", "RTN_REFUND"), null, false);
}
} catch (GenericEntityException e) {
Debug.logError(e, module);
@@ -2317,10 +2314,10 @@ public class OrderReturnServices {
for(GenericValue returnItem : returnItems) {
String orderId = returnItem.getString("orderId");
try {
- GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse");
+ GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse", false);
if ((returnItemResponse != null) && (orderId != null)) {
// TODO should we filter on payment's status (PMNT_SENT,PMNT_RECEIVED)
- GenericValue payment = returnItemResponse.getRelatedOne("Payment");
+ GenericValue payment = returnItemResponse.getRelatedOne("Payment", false);
if ((payment != null) && (payment.getBigDecimal("amount") != null) &&
!paymentList.contains(payment.get("paymentId"))) {
UtilMisc.addToBigDecimalInMap(returnAmountByOrder, orderId, payment.getBigDecimal("amount"));
@@ -2410,7 +2407,7 @@ public class OrderReturnServices {
String returnHeaderTypeId = ((returnHeader != null) && (returnHeader.getString("returnHeaderTypeId") != null)) ? returnHeader.getString("returnHeaderTypeId") : "CUSTOMER_RETURN";
returnItemTypeMap = delegator.findOne("ReturnItemTypeMap",
UtilMisc.toMap("returnHeaderTypeId", returnHeaderTypeId, "returnItemMapKey", orderAdjustment.get("orderAdjustmentTypeId")), false);
- returnAdjustmentType = returnItemTypeMap.getRelatedOne("ReturnAdjustmentType");
+ returnAdjustmentType = returnItemTypeMap.getRelatedOne("ReturnAdjustmentType", false);
if (returnAdjustmentType != null && UtilValidate.isEmpty(description)) {
description = returnAdjustmentType.getString("description");
}
@@ -2418,7 +2415,7 @@ public class OrderReturnServices {
returnItem = delegator.findOne("ReturnItem",
UtilMisc.toMap("returnId", returnId, "returnItemSeqId", returnItemSeqId), false);
Debug.logInfo("returnId:" + returnId + ",returnItemSeqId:" + returnItemSeqId, module);
- orderItem = returnItem.getRelatedOne("OrderItem");
+ orderItem = returnItem.getRelatedOne("OrderItem", false);
} else {
// we don't have the returnItemSeqId but before we consider this
// an header adjustment we try to get a return item in this return
@@ -2430,7 +2427,7 @@ public class OrderReturnServices {
"orderId", orderAdjustment.getString("orderId"),
"orderItemSeqId", orderAdjustment.getString("orderItemSeqId")), null, false));
if (UtilValidate.isNotEmpty(returnItem)) {
- orderItem = returnItem.getRelatedOne("OrderItem");
+ orderItem = returnItem.getRelatedOne("OrderItem", false);
}
}
}