ofbiz-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bibr...@apache.org
Subject svn commit: r630962 - /ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java
Date Mon, 25 Feb 2008 19:21:58 GMT
Author: bibryam
Date: Mon Feb 25 11:21:56 2008
New Revision: 630962

URL: http://svn.apache.org/viewvc?rev=630962&view=rev
Log:
Applied fix from trunk for revision: 630958  

Modified:
    ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java

Modified: ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java?rev=630962&r1=630961&r2=630962&view=diff
==============================================================================
--- ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java
(original)
+++ ofbiz/branches/release4.0/applications/order/src/org/ofbiz/order/order/OrderServices.java
Mon Feb 25 11:21:56 2008
@@ -580,6 +580,7 @@
         // and connect them with the orderitem over the WorkOrderItemFulfillment
         // create also the techData calendars to keep track of availability of the fixed
asset.
         if (workEfforts != null && workEfforts.size() > 0) {
+            List tempList = new LinkedList();
             Iterator we = workEfforts.iterator();
             while (we.hasNext()) {
                 // create the entity maps required.
@@ -605,15 +606,33 @@
                 catch (GenericEntityException e) {
                     Debug.logInfo("TechData calendar does not exist yet so create for fixedAsset:
" + fixedAsset.get("fixedAssetId") ,module);
                 }
+                if (techDataCalendar == null) {
+                    Iterator fai = tempList.iterator();
+                    while (fai.hasNext()) {
+                        GenericValue currentValue = (GenericValue) fai.next();
+                        if ("FixedAsset".equals(currentValue.getEntityName()) &&
currentValue.getString("fixedAssetId").equals(workEffort.getString("fixedAssetId"))) {
+                            fixedAsset = currentValue;
+                            break;
+                        }
+                    }
+                    Iterator tdci = tempList.iterator();
+                    while (tdci.hasNext()) {
+                        GenericValue currentValue = (GenericValue) tdci.next();
+                        if ("TechDataCalendar".equals(currentValue.getEntityName()) &&
currentValue.getString("calendarId").equals(fixedAsset.getString("calendarId"))) {
+                            techDataCalendar = currentValue;
+                            break;
+                        }
+                    }
+                }
                 if(techDataCalendar == null ) {
                     techDataCalendar = delegator.makeValue("TechDataCalendar", null);
                     Debug.logInfo("create techdata calendar because it does not exist",module);
                     String calendarId = delegator.getNextSeqId("techDataCalendar");
                     techDataCalendar.set("calendarId", calendarId);
-                    toBeStored.add(techDataCalendar);
+                    tempList.add(techDataCalendar);
                     Debug.logInfo("update fixed Asset",module);
                     fixedAsset.set("calendarId",calendarId);
-                    toBeStored.add(fixedAsset);
+                    tempList.add(fixedAsset);
                 }
                 // then create the workEffort and the workOrderItemFulfillment to connect
to the order and orderItem
                 workOrderItemFulfillment.set("orderItemSeqId", workEffort.get("workEffortId").toString());
// orderItemSeqNo is stored here so save first
@@ -644,6 +663,17 @@
                     catch (GenericEntityException e) {
                         Debug.logInfo(" techData excday record not found so creating........",
module);
                     }
+                    if (techDataCalendarExcDay == null) {
+                        Iterator tdcedi = tempList.iterator();
+                        while (tdcedi.hasNext()) {
+                        	GenericValue currentValue = (GenericValue) tdcedi.next();
+                            if ("TechDataCalendarExcDay".equals(currentValue.getEntityName())
&& currentValue.getString("calendarId").equals(fixedAsset.getString("calendarId"))
+                                    && currentValue.getTimestamp("exceptionDateStartTime").equals(exceptionDateStartTime))
{
+                                techDataCalendarExcDay = currentValue;
+                                break;
+                            }
+                        }
+                    }
                     if (techDataCalendarExcDay == null)    {
                         techDataCalendarExcDay = delegator.makeValue("TechDataCalendarExcDay",
null);
                         techDataCalendarExcDay.set("calendarId", fixedAsset.get("calendarId"));
@@ -669,11 +699,14 @@
                         }
                     }
                     techDataCalendarExcDay.set("usedCapacity", newUsedCapacity);
-                    toBeStored.add(techDataCalendarExcDay);
+                    tempList.add(techDataCalendarExcDay);
 //                  Debug.logInfo("Update success CalendarID: " + techDataCalendarExcDay.get("calendarId").toString()
+
 //                            " and for date: " + techDataCalendarExcDay.get("exceptionDateStartTime").toString()
+
 //                            " and for quantity: " + techDataCalendarExcDay.getDouble("usedCapacity").toString(),
module);
                 }
+            }
+            if (tempList.size() > 0) {
+                toBeStored.addAll(tempList);
             }
         }
         if (errorMessages.size() > 0) {



Mime
View raw message