Author: jleroux
Date: Sat Dec 17 21:59:29 2011
New Revision: 1220283

URL: http://svn.apache.org/viewvc?rev=1220283&view=rev
Log:
A patch from Joe Eckard "Add methods to OrderReadHelper to retrieve attributes" 
https://issues.apache.org/jira/browse/OFBIZ-2800

We agreed to commit in trunk but not to backport to releases

Modified:
    
ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java

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=1220283&r1=1220282&r2=1220283&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 Dec 17 21:59:29 2011
@@ -2884,6 +2884,37 @@ public class OrderReadHelper {
        return EntityUtil.orderBy(EntityUtil.filterByAnd(newOrderStatuses, 
contraints2), UtilMisc.toList("-statusDatetime"));
    }
 
+    public static String getOrderItemAttribute(GenericValue orderItem, String 
attributeName) {
+        String attributeValue = null;
+        if (orderItem != null) {
+            try {
+                GenericValue orderItemAttribute = 
EntityUtil.getFirst(orderItem.getRelatedByAnd("OrderItemAttribute", 
UtilMisc.toMap("attrName", attributeName)));
+                if (orderItemAttribute != null) {
+                    attributeValue = orderItemAttribute.getString("attrValue");
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+        }
+        return attributeValue;
+    }
+
+    public String getOrderAttribute(String attributeName) {
+        String attributeValue = null;
+        if (orderHeader != null) {
+            try {
+                GenericValue orderAttribute = 
EntityUtil.getFirst(orderHeader.getRelatedByAnd("OrderAttribute", 
UtilMisc.toMap("attrName", attributeName)));
+                if (orderAttribute != null) {
+                    attributeValue = orderAttribute.getString("attrValue");
+                }
+            } catch (GenericEntityException e) {
+                Debug.logError(e, module);
+            }
+        }
+        return attributeValue;
+    }
+    
+
    public static Map<String, Object> 
getOrderTaxByTaxAuthGeoAndParty(List<GenericValue> orderAdjustments) {
        BigDecimal taxGrandTotal = BigDecimal.ZERO;
        List<Map<String, Object>> taxByTaxAuthGeoAndPartyList = 
FastList.newInstance();


Reply via email to