Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Thu Aug 8 12:28:01 2013 @@ -125,7 +125,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", productionRunId, "workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED"), null, false); if (!UtilValidate.isEmpty(products)) { - for(GenericValue product : products) { + for (GenericValue product : products) { product.set("statusId", "WEGS_CANCELLED"); product.store(); } @@ -134,7 +134,7 @@ public class ProductionRunServices { // change the tasks status to PRUN_CANCELLED List<GenericValue> tasks = productionRun.getProductionRunRoutingTasks(); String taskId = null; - for(GenericValue oneTask : tasks) { + for (GenericValue oneTask : tasks) { taskId = oneTask.getString("workEffortId"); serviceContext.clear(); serviceContext.put("workEffortId", taskId); @@ -146,7 +146,7 @@ public class ProductionRunServices { UtilMisc.toMap("workEffortId", taskId, "workEffortGoodStdTypeId", "PRUNT_PROD_NEEDED", "statusId", "WEGS_CREATED"), null, false); if (!UtilValidate.isEmpty(components)) { - for(GenericValue component : components) { + for (GenericValue component : components) { component.set("statusId", "WEGS_CANCELLED"); component.store(); } @@ -300,7 +300,7 @@ public class ProductionRunServices { // Multi creation (like clone) ProductionRunTask and GoodAssoc boolean first = true; - for(GenericValue routingTaskAssoc : routingTaskAssocs) { + for (GenericValue routingTaskAssoc : routingTaskAssocs) { if (EntityUtil.isValueActive(routingTaskAssoc, startDate)) { GenericValue routingTask = null; try { @@ -359,7 +359,7 @@ public class ProductionRunServices { // Now we iterate thru the components returned by the getManufacturingComponents service // TODO: if in the BOM a routingWorkEffortId is specified, but the task is not in the routing // the component is not added to the production run. - for(BOMNode node : components) { + for (BOMNode node : components) { // The components variable contains a list of BOMNodes: // each node represents a product (component). GenericValue productBom = node.getProductAssoc(); @@ -422,7 +422,7 @@ public class ProductionRunServices { } if (workEffortPartyAssignments != null) { - for(GenericValue workEffortPartyAssignment : workEffortPartyAssignments) { + for (GenericValue workEffortPartyAssignment : workEffortPartyAssignments) { Map<String, Object> partyToWorkEffort = UtilMisc.<String, Object>toMap( "workEffortId", productionRunTaskId, "partyId", workEffortPartyAssignment.getString("partyId"), @@ -587,7 +587,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_SCHEDULED - for(GenericValue task : productionRun.getProductionRunRoutingTasks()) { + for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", statusId); @@ -619,7 +619,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_DOC_PRINTED - for(GenericValue task : productionRun.getProductionRunRoutingTasks()) { + for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", "PRUN_DOC_PRINTED"); @@ -709,7 +709,7 @@ public class ProductionRunServices { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunStatusNotChanged", locale)); } // change the production run tasks status to PRUN_CLOSED - for(GenericValue task : productionRun.getProductionRunRoutingTasks()) { + for (GenericValue task : productionRun.getProductionRunRoutingTasks()) { serviceContext.clear(); serviceContext.put("workEffortId", task.getString("workEffortId")); serviceContext.put("currentStatusId", "PRUN_CLOSED"); @@ -981,7 +981,7 @@ public class ProductionRunServices { // base currency uom of the owner of the facility in which the task is running BigDecimal totalCost = ZERO; BigDecimal totalCostNoMaterials = ZERO; - for(GenericValue costComponent : costComponents) { + for (GenericValue costComponent : costComponents) { BigDecimal cost = costComponent.getBigDecimal("cost"); totalCost = totalCost.add(cost); if (!"ACTUAL_MAT_COST".equals(costComponent.getString("costComponentTypeId"))) { @@ -1011,7 +1011,7 @@ public class ProductionRunServices { UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", workEffortId)); BigDecimal productionRunHeaderCost = (BigDecimal)outputMap.get("totalCost"); totalCost = totalCost.add(productionRunHeaderCost); - for(GenericValue task : tasks) { + for (GenericValue task : tasks) { outputMap = dispatcher.runSync("getWorkEffortCosts", UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", task.getString("workEffortId"))); BigDecimal taskCost = (BigDecimal)outputMap.get("totalCost"); @@ -1139,7 +1139,7 @@ public class ProductionRunServices { // materials costs: these are the costs derived from the materials used by the production run task try { Map<String, BigDecimal> materialsCostByCurrency = FastMap.newInstance(); - for(GenericValue inventoryConsumed : delegator.findByAnd("WorkEffortAndInventoryAssign", + for (GenericValue inventoryConsumed : delegator.findByAnd("WorkEffortAndInventoryAssign", UtilMisc.toMap("workEffortId", productionRunTaskId), null, false)) { BigDecimal quantity = inventoryConsumed.getBigDecimal("quantity"); BigDecimal unitCost = inventoryConsumed.getBigDecimal("unitCost"); @@ -1154,7 +1154,7 @@ public class ProductionRunServices { materialsCost = materialsCost.add(unitCost.multiply(quantity)).setScale(decimals, rounding); materialsCostByCurrency.put(currencyUomId, materialsCost); } - for(String currencyUomId : materialsCostByCurrency.keySet()) { + for (String currencyUomId : materialsCostByCurrency.keySet()) { BigDecimal materialsCost = materialsCostByCurrency.get(currencyUomId); Map<String, Object> inMap = UtilMisc.<String, Object>toMap("userLogin", userLogin, "workEffortId", productionRunTaskId); @@ -1509,7 +1509,7 @@ public class ProductionRunServices { Debug.logError(e.getMessage(), module); } if (workEffortPartyAssignments != null) { - for(GenericValue workEffortPartyAssignment : workEffortPartyAssignments) { + for (GenericValue workEffortPartyAssignment : workEffortPartyAssignments) { Map<String, Object> partyToWorkEffort = UtilMisc.<String, Object>toMap( "workEffortId", productionRunTaskId, "partyId", workEffortPartyAssignment.getString("partyId"), @@ -1949,7 +1949,7 @@ public class ProductionRunServices { // If less than passed quantity then return an error message. try { BigDecimal totalIssued = BigDecimal.ZERO; - for(GenericValue issuance : delegator.findByAnd("WorkEffortAndInventoryAssign", + for (GenericValue issuance : delegator.findByAnd("WorkEffortAndInventoryAssign", UtilMisc.toMap("workEffortId", productionRunTaskId, "productId", productId), null, false)) { BigDecimal issued = issuance.getBigDecimal("quantity"); if (issued != null) { @@ -1957,7 +1957,7 @@ public class ProductionRunServices { } } BigDecimal totalReturned = BigDecimal.ZERO; - for(GenericValue returned : delegator.findByAnd("WorkEffortAndInventoryProduced", + for (GenericValue returned : delegator.findByAnd("WorkEffortAndInventoryProduced", UtilMisc.toMap("workEffortId", productionRunTaskId, "productId", productId), null, false)) { GenericValue returnDetail = EntityUtil.getFirst(delegator.findByAnd("InventoryItemDetail", UtilMisc.toMap("inventoryItemId", returned.getString("inventoryItemId")), UtilMisc.toList("inventoryItemDetailSeqId"), false)); if (returnDetail != null) { @@ -2307,9 +2307,9 @@ public class ProductionRunServices { result.put("productionRunId", productionRunId); Map<String, BigDecimal> components = FastMap.newInstance(); - for(ConfigOption co : config.getSelectedOptions()) { + for (ConfigOption co : config.getSelectedOptions()) { //components.addAll(co.getComponents()); - for(GenericValue selComponent : co.getComponents()) { + for (GenericValue selComponent : co.getComponents()) { BigDecimal componentQuantity = null; if (selComponent.get("quantity") != null) { componentQuantity = selComponent.getBigDecimal("quantity"); @@ -2385,7 +2385,7 @@ public class ProductionRunServices { } } - for(Map.Entry<String, BigDecimal> component : components.entrySet()) { + for (Map.Entry<String, BigDecimal> component : components.entrySet()) { String productId = component.getKey(); BigDecimal componentQuantity = component.getValue(); if (componentQuantity == null) { @@ -3033,7 +3033,7 @@ public class ProductionRunServices { if (UtilValidate.isEmpty(components)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingProductionRunCannotDecomposingInventoryItemNoComponentsFound", UtilMisc.toMap("productId", inventoryItem.getString("productId")), locale)); } - for(Map<String, Object> component : components) { + for (Map<String, Object> component : components) { // get the component's standard cost serviceContext.clear(); serviceContext = UtilMisc.toMap("productId", ((GenericValue)component.get("product")).getString("productId"), @@ -3078,7 +3078,7 @@ public class ProductionRunServices { List<GenericValue> resultList = delegator.findByAnd("WorkEffortAndGoods", UtilMisc.toMap("workEffortGoodStdTypeId", "PRUN_PROD_DELIV", "statusId", "WEGS_CREATED", "workEffortTypeId", "PROD_ORDER_HEADER"), null, false); - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || "PRUN_CREATED".equals(genericResult.getString("currentStatusId"))) { continue; @@ -3121,7 +3121,7 @@ public class ProductionRunServices { "itemStatusId", "ITEM_APPROVED"), UtilMisc.toList("orderId"), false); String orderId = null; GenericValue orderDeliverySchedule = null; - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String newOrderId = genericResult.getString("orderId"); if (!newOrderId.equals(orderId)) { orderDeliverySchedule = null; @@ -3172,7 +3172,7 @@ public class ProductionRunServices { List<GenericValue> backorders = delegator.findList("OrderItemAndShipGrpInvResAndItem", EntityCondition.makeCondition(backordersCondList, EntityOperator.AND), null, UtilMisc.toList("shipBeforeDate"), null, false); - for(GenericValue genericResult : backorders) { + for (GenericValue genericResult : backorders) { String productId = genericResult.getString("productId"); GenericValue orderItemShipGroup = delegator.findOne("OrderItemShipGroup", UtilMisc.toMap("orderId", genericResult.get("orderId"), "shipGroupSeqId", genericResult.get("shipGroupSeqId")), false); @@ -3190,7 +3190,7 @@ public class ProductionRunServices { TreeMap<Timestamp, Object> productMap = products.get(productId); SortedMap<Timestamp, Object> subsetMap = productMap.headMap(requiredByDate); // iterate and 'reserve' - for(Timestamp currentDate : subsetMap.keySet()) { + for (Timestamp currentDate : subsetMap.keySet()) { Map<String, Object> currentDateMap = UtilGenerics.checkMap(subsetMap.get(currentDate)); //List reservations = (List)currentDateMap.get("reservations"); BigDecimal remainingQty = (BigDecimal)currentDateMap.get("remainingQty"); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/mrp/MrpServices.java Thu Aug 8 12:28:01 2013 @@ -102,7 +102,7 @@ public class MrpServices { } if (listResult != null) { try { - for(GenericValue tmpRequirement : listResult) { + for (GenericValue tmpRequirement : listResult) { listResultRoles.addAll(tmpRequirement.getRelated("RequirementRole", null, null, false)); //int numOfRecordsRemoved = delegator.removeRelated("RequirementRole", tmpRequirement); } @@ -151,7 +151,7 @@ public class MrpServices { Debug.logError(e, "Error : parameters = "+parameters,module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); } - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); BigDecimal reservedQuantity = genericResult.getBigDecimal("reservedQuantity"); BigDecimal shipGroupQuantity = genericResult.getBigDecimal("quantity"); @@ -210,7 +210,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); } - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); BigDecimal eventQuantityTmp = genericResult.getBigDecimal("quantity"); if (productId == null || eventQuantityTmp == null) { @@ -247,7 +247,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpEventFindError", locale)); } - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String newOrderId = genericResult.getString("orderId"); if (!newOrderId.equals(orderId)) { orderDeliverySchedule = null; @@ -311,7 +311,7 @@ public class MrpServices { "statusId", "WEGS_CREATED", "facilityId", facilityId); try { resultList = delegator.findByAnd("WorkEffortAndGoods", parameters, null, false); - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) || "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { @@ -346,7 +346,7 @@ public class MrpServices { "statusId", "WEGS_CREATED", "workEffortTypeId", "PROD_ORDER_HEADER", "facilityId", facilityId); try { resultList = delegator.findByAnd("WorkEffortAndGoods", parameters, null, false); - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { if ("PRUN_CLOSED".equals(genericResult.getString("currentStatusId")) || "PRUN_COMPLETED".equals(genericResult.getString("currentStatusId")) || "PRUN_CANCELLED".equals(genericResult.getString("currentStatusId"))) { @@ -389,7 +389,7 @@ public class MrpServices { Debug.logError(e, "Unable to retrieve ProductFacility records.", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindProductFacility", locale)); } - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String productId = genericResult.getString("productId"); BigDecimal minimumStock = genericResult.getBigDecimal("minimumStock"); if (minimumStock == null) { @@ -433,7 +433,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindSalesForecasts", locale)); } - for(GenericValue genericResult : resultList) { + for (GenericValue genericResult : resultList) { String customTimePeriodId = genericResult.getString("customTimePeriodId"); GenericValue customTimePeriod = null; try { @@ -451,7 +451,7 @@ public class MrpServices { } catch (GenericEntityException e) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpCannotFindSalesForecastDetails", locale)); } - for(GenericValue sfd : salesForecastDetails) { + for (GenericValue sfd : salesForecastDetails) { String productId = sfd.getString("productId"); BigDecimal eventQuantityTmp = sfd.getBigDecimal("quantity"); if (productId == null || eventQuantityTmp == null) { @@ -535,7 +535,7 @@ public class MrpServices { Delegator delegator = product.getDelegator(); if (UtilValidate.isNotEmpty(listComponent)) { - for(BOMNode node : listComponent) { + for (BOMNode node : listComponent) { GenericValue productComponent = node.getProductAssoc(); // read the startDate for the component String routingTask = node.getProductAssoc().getString("routingWorkEffortId"); @@ -598,7 +598,7 @@ public class MrpServices { if (UtilValidate.isEmpty(facilities)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource, "ManufacturingMrpFacilityGroupIsNotAssociatedToFacility", UtilMisc.toMap("facilityGroupId", facilityGroupId), locale)); } - for(GenericValue facilityMember : facilities) { + for (GenericValue facilityMember : facilities) { GenericValue facility = facilityMember.getRelatedOne("Facility", false); if ("WAREHOUSE".equals(facility.getString("facilityTypeId")) && UtilValidate.isEmpty(facilityId)) { facilityId = facility.getString("facilityId"); @@ -671,7 +671,7 @@ public class MrpServices { bomLevelWithNoEvent = 0; oldProductId = ""; - for(GenericValue inventoryEventForMRP : listInventoryEventForMRP) { + for (GenericValue inventoryEventForMRP : listInventoryEventForMRP) { productId = inventoryEventForMRP.getString("productId"); eventQuantity = inventoryEventForMRP.getBigDecimal("quantity"); Modified: ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java (original) +++ ofbiz/trunk/applications/manufacturing/src/org/ofbiz/manufacturing/techdata/TechDataServices.java Thu Aug 8 12:28:01 2013 @@ -131,7 +131,7 @@ public class TechDataServices { } if (listRoutingTaskAssoc != null) { - for(GenericValue routingTaskAssoc : listRoutingTaskAssoc) { + for (GenericValue routingTaskAssoc : listRoutingTaskAssoc) { if (! workEffortIdFrom.equals(routingTaskAssoc.getString("workEffortIdFrom")) || ! workEffortIdTo.equals(routingTaskAssoc.getString("workEffortIdTo")) || ! workEffortAssocTypeId.equals(routingTaskAssoc.getString("workEffortAssocTypeId")) || Modified: ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java (original) +++ ofbiz/trunk/applications/marketing/src/org/ofbiz/sfa/vcard/VCard.java Thu Aug 8 12:28:01 2013 @@ -198,7 +198,7 @@ public class VCard { String serviceName = (String) context.get("serviceName"); Map<String, Object> serviceContext = UtilGenerics.cast(context.get("serviceContext")); if(UtilValidate.isNotEmpty(serviceContext)) { - for(Map.Entry<String, Object> entry : serviceContext.entrySet()) { + for (Map.Entry<String, Object> entry : serviceContext.entrySet()) { serviceCtx.put(entry.getKey(), entry.getValue()); } } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Thu Aug 8 12:28:01 2013 @@ -82,7 +82,7 @@ public class OrderManagerEvents { return "error"; } if (paymentPrefs != null) { - for(GenericValue ppref : paymentPrefs) { + for (GenericValue ppref : paymentPrefs) { // update the preference to received // TODO: updating payment preferences should be done as a service ppref.set("statusId", "PAYMENT_RECEIVED"); @@ -189,7 +189,7 @@ public class OrderManagerEvents { return "error"; } - for(GenericValue paymentMethod : paymentMethods) { + for (GenericValue paymentMethod : paymentMethods) { String paymentMethodId = paymentMethod.getString("paymentMethodId"); String paymentMethodAmountStr = request.getParameter(paymentMethodId + "_amount"); String paymentMethodReference = request.getParameter(paymentMethodId + "_reference"); @@ -231,7 +231,7 @@ public class OrderManagerEvents { List<GenericValue> toBeStored = FastList.newInstance(); - for(GenericValue paymentMethodType : paymentMethodTypes) { + for (GenericValue paymentMethodType : paymentMethodTypes) { String paymentMethodTypeId = paymentMethodType.getString("paymentMethodTypeId"); String amountStr = request.getParameter(paymentMethodTypeId + "_amount"); String paymentReference = request.getParameter(paymentMethodTypeId + "_reference"); @@ -300,7 +300,7 @@ public class OrderManagerEvents { Debug.logError(e, "ERROR: Unable to get existing payment preferences from order", module); } if (UtilValidate.isNotEmpty(currentPrefs)) { - for(GenericValue cp : currentPrefs) { + for (GenericValue cp : currentPrefs) { String paymentMethodType = cp.getString("paymentMethodTypeId"); if ("EXT_OFFLINE".equals(paymentMethodType)) { offlineValue = cp; Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java Thu Aug 8 12:28:01 2013 @@ -184,7 +184,7 @@ public class OrderChangeHelper { Debug.logError(e, "ERROR: Unable to get OrderItem records for OrderHeader : " + orderId, module); } if (UtilValidate.isNotEmpty(orderItems)) { - for(GenericValue orderItem : orderItems) { + for (GenericValue orderItem : orderItems) { String orderItemSeqId = orderItem.getString("orderItemSeqId"); GenericValue product = null; @@ -261,7 +261,7 @@ public class OrderChangeHelper { } List<GenericValue> opps = orh.getPaymentPreferences(); - for(GenericValue opp : opps) { + for (GenericValue opp : opps) { if ("PAYMENT_RECEIVED".equals(opp.getString("statusId"))) { List<GenericValue> payments = orh.getOrderPayments(opp); if (UtilValidate.isEmpty(payments)) { Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java Thu Aug 8 12:28:01 2013 @@ -167,7 +167,7 @@ public class OrderListState implements S } private void changeOrderListStates(HttpServletRequest request) { - for(String param : parameterToOrderStatusId.keySet()) { + for (String param : parameterToOrderStatusId.keySet()) { String value = request.getParameter(param); if ("Y".equals(value)) { orderStatusState.put(param, "Y"); @@ -175,7 +175,7 @@ public class OrderListState implements S orderStatusState.put(param, "N"); } } - for(String param : parameterToOrderTypeId.keySet()) { + for (String param : parameterToOrderTypeId.keySet()) { String value = request.getParameter(param); if ("Y".equals(value)) { orderTypeState.put(param, "Y"); @@ -183,7 +183,7 @@ public class OrderListState implements S orderTypeState.put(param, "N"); } } - for(String param : parameterToFilterId.keySet()) { + for (String param : parameterToFilterId.keySet()) { String value = request.getParameter(param); if ("Y".equals(value)) { orderFilterState.put(param, "Y"); @@ -241,12 +241,12 @@ public class OrderListState implements S } List<EntityCondition> statusConditions = FastList.newInstance(); - for(String status : orderStatusState.keySet()) { + for (String status : orderStatusState.keySet()) { if (!hasStatus(status)) continue; statusConditions.add(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, parameterToOrderStatusId.get(status))); } List<EntityCondition> typeConditions = FastList.newInstance(); - for(String type : orderTypeState.keySet()) { + for (String type : orderTypeState.keySet()) { if (!hasType(type)) continue; typeConditions.add(EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, parameterToOrderTypeId.get(type))); } Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderLookupServices.java Thu Aug 8 12:28:01 2013 @@ -118,7 +118,7 @@ public class OrderLookupServices { List<String> orderTypeList = UtilGenerics.checkList(context.get("orderTypeId")); if (orderTypeList != null) { List<EntityExpr> orExprs = FastList.newInstance(); - for(String orderTypeId : orderTypeList) { + for (String orderTypeId : orderTypeList) { paramList.add("orderTypeId=" + orderTypeId); if (!"PURCHASE_ORDER".equals(orderTypeId) || ("PURCHASE_ORDER".equals(orderTypeId) && canViewPo)) { @@ -137,7 +137,7 @@ public class OrderLookupServices { List<String> orderStatusList = UtilGenerics.checkList(context.get("orderStatusId")); if (orderStatusList != null) { List<EntityCondition> orExprs = FastList.newInstance(); - for(String orderStatusId : orderStatusList) { + for (String orderStatusId : orderStatusList) { paramList.add("orderStatusId=" + orderStatusId); if ("PENDING".equals(orderStatusId)) { List<EntityExpr> pendExprs = FastList.newInstance(); @@ -155,7 +155,7 @@ public class OrderLookupServices { List<String> productStoreList = UtilGenerics.checkList(context.get("productStoreId")); if (productStoreList != null) { List<EntityExpr> orExprs = FastList.newInstance(); - for(String productStoreId : productStoreList) { + for (String productStoreId : productStoreList) { paramList.add("productStoreId=" + productStoreId); orExprs.add(EntityCondition.makeCondition("productStoreId", EntityOperator.EQUALS, productStoreId)); } @@ -165,7 +165,7 @@ public class OrderLookupServices { List<String> webSiteList = UtilGenerics.checkList(context.get("orderWebSiteId")); if (webSiteList != null) { List<EntityExpr> orExprs = FastList.newInstance(); - for(String webSiteId : webSiteList) { + for (String webSiteId : webSiteList) { paramList.add("webSiteId=" + webSiteId); orExprs.add(EntityCondition.makeCondition("webSiteId", EntityOperator.EQUALS, webSiteId)); } @@ -175,7 +175,7 @@ public class OrderLookupServices { List<String> saleChannelList = UtilGenerics.checkList(context.get("salesChannelEnumId")); if (saleChannelList != null) { List<EntityExpr> orExprs = FastList.newInstance(); - for(String salesChannelEnumId : saleChannelList) { + for (String salesChannelEnumId : saleChannelList) { paramList.add("salesChannelEnumId=" + salesChannelEnumId); orExprs.add(EntityCondition.makeCondition("salesChannelEnumId", EntityOperator.EQUALS, salesChannelEnumId)); } @@ -328,7 +328,7 @@ public class OrderLookupServices { if (roleTypeList != null) { fieldsToSelect.add("roleTypeId"); List<EntityExpr> orExprs = FastList.newInstance(); - for(String roleTypeId : roleTypeList) { + for (String roleTypeId : roleTypeList) { paramList.add("roleTypeId=" + roleTypeId); orExprs.add(makeExpr("roleTypeId", roleTypeId)); } @@ -402,7 +402,7 @@ public class OrderLookupServices { } List<GenericValue> variants = UtilGenerics.checkList(varLookup.get("assocProducts")); if (variants != null) { - for(GenericValue v : variants) { + for (GenericValue v : variants) { orExprs.add(EntityCondition.makeCondition("productId", EntityOperator.EQUALS, v.getString("productIdTo"))); } } @@ -651,7 +651,7 @@ public class OrderLookupServices { if ("Y".equals(doFilter) && orderList.size() > 0) { paramList.add("filterInventoryProblems=Y"); - for(GenericValue orderHeader : orderList) { + for (GenericValue orderHeader : orderList) { OrderReadHelper orh = new OrderReadHelper(orderHeader); BigDecimal backorderQty = orh.getOrderBackorderQuantity(); if (backorderQty.compareTo(BigDecimal.ZERO) == 1) { @@ -692,7 +692,7 @@ public class OrderLookupServices { } if (doPoFilter && orderList.size() > 0) { - for(GenericValue orderHeader : orderList) { + for (GenericValue orderHeader : orderList) { OrderReadHelper orh = new OrderReadHelper(orderHeader); String orderType = orh.getOrderTypeId(); String orderId = orh.getOrderId(); 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=1511742&r1=1511741&r2=1511742&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 Thu Aug 8 12:28:01 2013 @@ -214,7 +214,7 @@ public class OrderReadHelper { public Map<String, BigDecimal> getReceivedPaymentTotalsByPaymentMethod() { Map<String, BigDecimal> paymentMethodAmounts = FastMap.newInstance(); List<GenericValue> paymentPrefs = getPaymentPreferences(); - for(GenericValue paymentPref : paymentPrefs) { + for (GenericValue paymentPref : paymentPrefs) { List<GenericValue> payments = FastList.newInstance(); try { List<EntityExpr> exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "PMNT_RECEIVED"), @@ -232,7 +232,7 @@ public class OrderReadHelper { } BigDecimal chargedToPaymentPref = ZERO; - for(GenericValue payment : payments) { + for (GenericValue payment : payments) { if (payment.get("amount") != null) { chargedToPaymentPref = chargedToPaymentPref.add(payment.getBigDecimal("amount")).setScale(scale+1, rounding); } @@ -259,7 +259,7 @@ public class OrderReadHelper { public Map<String, BigDecimal> getReturnedTotalsByPaymentMethod() { Map<String, BigDecimal> paymentMethodAmounts = FastMap.newInstance(); List<GenericValue> paymentPrefs = getPaymentPreferences(); - for(GenericValue paymentPref : paymentPrefs) { + for (GenericValue paymentPref : paymentPrefs) { List<GenericValue> returnItemResponses = FastList.newInstance(); try { returnItemResponses = orderHeader.getDelegator().findByAnd("ReturnItemResponse", UtilMisc.toMap("orderPaymentPreferenceId", paymentPref.getString("orderPaymentPreferenceId")), null, false); @@ -267,7 +267,7 @@ public class OrderReadHelper { Debug.logError(e, module); } BigDecimal refundedToPaymentPref = ZERO; - for(GenericValue returnItemResponse : returnItemResponses) { + for (GenericValue returnItemResponse : returnItemResponses) { refundedToPaymentPref = refundedToPaymentPref.add(returnItemResponse.getBigDecimal("responseAmount")).setScale(scale+1, rounding); } @@ -294,7 +294,7 @@ public class OrderReadHelper { prefs = UtilMisc.toList(orderPaymentPreference); } if (prefs != null) { - for(GenericValue payPref : prefs) { + for (GenericValue payPref : prefs) { try { orderPayments.addAll(payPref.getRelated("Payment", null, null, false)); } catch (GenericEntityException e) { @@ -395,7 +395,7 @@ public class OrderReadHelper { } public boolean hasPhysicalProductItems() throws GenericEntityException { - for(GenericValue orderItem : this.getOrderItems()) { + for (GenericValue orderItem : this.getOrderItems()) { GenericValue product = orderItem.getRelatedOne("Product", true); if (product != null) { GenericValue productType = product.getRelatedOne("ProductType", true); @@ -430,7 +430,7 @@ public class OrderReadHelper { List<GenericValue> shippingLocations = FastList.newInstance(); List<GenericValue> shippingCms = this.getOrderContactMechs("SHIPPING_LOCATION"); if (shippingCms != null) { - for(GenericValue ocm : shippingCms) { + for (GenericValue ocm : shippingCms) { if (ocm != null) { try { GenericValue addr = ocm.getDelegator().findOne("PostalAddress", @@ -485,7 +485,7 @@ public class OrderReadHelper { List<GenericValue> billingLocations = FastList.newInstance(); List<GenericValue> billingCms = this.getOrderContactMechs("BILLING_LOCATION"); if (billingCms != null) { - for(GenericValue ocm : billingCms) { + for (GenericValue ocm : billingCms) { if (ocm != null) { try { GenericValue addr = ocm.getDelegator().findOne("PostalAddress", @@ -789,7 +789,7 @@ public class OrderReadHelper { Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module); } if (featureAppls != null) { - for(GenericValue appl : featureAppls) { + for (GenericValue appl : featureAppls) { featureSet.add(appl.getString("productFeatureId")); } } @@ -803,7 +803,7 @@ public class OrderReadHelper { Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module); } if (additionalFeatures != null) { - for(GenericValue adj : additionalFeatures) { + for (GenericValue adj : additionalFeatures) { String featureId = adj.getString("productFeatureId"); if (featureId != null) { featureSet.add(featureId); @@ -818,7 +818,7 @@ public class OrderReadHelper { Map<String, BigDecimal> featureMap = FastMap.newInstance(); List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { List<GenericValue> featureAppls = null; if (item.get("productId") != null) { try { @@ -830,7 +830,7 @@ public class OrderReadHelper { Debug.logError(e, "Unable to get ProductFeatureAppl for item : " + item, module); } if (featureAppls != null) { - for(GenericValue appl : featureAppls) { + for (GenericValue appl : featureAppls) { BigDecimal lastQuantity = featureMap.get(appl.getString("productFeatureId")); if (lastQuantity == null) { lastQuantity = BigDecimal.ZERO; @@ -849,7 +849,7 @@ public class OrderReadHelper { Debug.logError(e, "Unable to get OrderAdjustment from item : " + item, module); } if (additionalFeatures != null) { - for(GenericValue adj : additionalFeatures) { + for (GenericValue adj : additionalFeatures) { String featureId = adj.getString("productFeatureId"); if (featureId != null) { BigDecimal lastQuantity = featureMap.get(featureId); @@ -871,7 +871,7 @@ public class OrderReadHelper { boolean shippingApplies = false; List<GenericValue> validItems = this.getValidOrderItems(); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { GenericValue product = null; try { product = item.getRelatedOne("Product", false); @@ -893,7 +893,7 @@ public class OrderReadHelper { boolean taxApplies = false; List<GenericValue> validItems = this.getValidOrderItems(); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { GenericValue product = null; try { product = item.getRelatedOne("Product", false); @@ -915,7 +915,7 @@ public class OrderReadHelper { BigDecimal shippableTotal = ZERO; List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { GenericValue product = null; try { product = item.getRelatedOne("Product", false); @@ -937,7 +937,7 @@ public class OrderReadHelper { BigDecimal shippableQuantity = ZERO; List<GenericValue> shipGroups = getOrderItemShipGroups(); if (UtilValidate.isNotEmpty(shipGroups)) { - for(GenericValue shipGroup : shipGroups) { + for (GenericValue shipGroup : shipGroups) { shippableQuantity = shippableQuantity.add(getShippableQuantity(shipGroup.getString("shipGroupSeqId"))); } } @@ -948,7 +948,7 @@ public class OrderReadHelper { BigDecimal shippableQuantity = ZERO; List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { GenericValue product = null; try { product = item.getRelatedOne("Product", false); @@ -970,7 +970,7 @@ public class OrderReadHelper { BigDecimal shippableWeight = ZERO; List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { shippableWeight = shippableWeight.add(this.getItemWeight(item).multiply(getOrderItemQuantity(item))).setScale(scale, rounding); } } @@ -1022,7 +1022,7 @@ public class OrderReadHelper { List<GenericValue> validItems = getValidOrderItems(); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { shippableSizes.add(this.getItemSize(item)); } } @@ -1035,7 +1035,7 @@ public class OrderReadHelper { */ public BigDecimal getOrderPaymentPreferenceTotalByType(String paymentMethodTypeId) { BigDecimal total = ZERO; - for(GenericValue preference : getPaymentPreferences()) { + for (GenericValue preference : getPaymentPreferences()) { if (preference.get("maxAmount") == null) continue; if (paymentMethodTypeId == null || paymentMethodTypeId.equals(preference.get("paymentMethodTypeId"))) { total = total.add(preference.getBigDecimal("maxAmount")).setScale(scale, rounding); @@ -1068,7 +1068,7 @@ public class OrderReadHelper { // get a set of invoice IDs that belong to the order List<GenericValue> orderItemBillings = orderHeader.getRelated("OrderItemBilling", null, null, true); Set<String> invoiceIds = new HashSet<String>(); - for(GenericValue orderItemBilling : orderItemBillings) { + for (GenericValue orderItemBilling : orderItemBillings) { invoiceIds.add(orderItemBilling.getString("invoiceId")); } @@ -1190,7 +1190,7 @@ public class OrderReadHelper { List<GenericValue> validItems = getValidOrderItems(shipGroupSeqId); if (validItems != null) { - for(GenericValue item : validItems) { + for (GenericValue item : validItems) { shippableInfo.add(this.getItemInfoMap(item)); } } @@ -1222,7 +1222,7 @@ public class OrderReadHelper { StringBuilder emails = new StringBuilder(); if (orderContactMechs != null) { - for(GenericValue orderContactMech : orderContactMechs) { + for (GenericValue orderContactMech : orderContactMechs) { try { GenericValue contactMech = orderContactMech.getRelatedOne("ContactMech", false); emails.append(emails.length() > 0 ? "," : "").append(contactMech.getString("infoString")); @@ -1252,19 +1252,19 @@ public class OrderReadHelper { List<GenericValue> prefs = getPaymentPreferences(); // add up the covered amount, but skip preferences which are declined or cancelled - for(GenericValue pref : prefs) { + for (GenericValue pref : prefs) { 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.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_CAPTURE"), null, false); - for(GenericValue response : responses) { + for (GenericValue response : responses) { BigDecimal amount = response.getBigDecimal("amount"); if (amount != null) { openAmount = openAmount.add(amount); } } responses = pref.getRelated("PaymentGatewayResponse", UtilMisc.toMap("transCodeEnumId", "PGT_REFUND"), null, false); - for(GenericValue response : responses) { + for (GenericValue response : responses) { BigDecimal amount = response.getBigDecimal("amount"); if (amount != null) { openAmount = openAmount.subtract(amount); @@ -1397,7 +1397,7 @@ public class OrderReadHelper { public boolean getRejectedOrderItems() { List<GenericValue> items = getOrderItems(); - for(GenericValue item : items) { + for (GenericValue item : items) { List<GenericValue> receipts = null; try { receipts = item.getRelated("ShipmentReceipt", null, null, false); @@ -1405,7 +1405,7 @@ public class OrderReadHelper { Debug.logWarning(e, module); } if (UtilValidate.isNotEmpty(receipts)) { - for(GenericValue rec : receipts) { + for (GenericValue rec : receipts) { BigDecimal rejected = rec.getBigDecimal("quantityRejected"); if (rejected != null && rejected.compareTo(BigDecimal.ZERO) > 0) { return true; @@ -1431,7 +1431,7 @@ public class OrderReadHelper { return false; }*/ List<GenericValue> items = getOrderItems(); - for(GenericValue item : items) { + for (GenericValue item : items) { List<GenericValue> receipts = null; try { receipts = item.getRelated("ShipmentReceipt", null, null, false); @@ -1439,7 +1439,7 @@ public class OrderReadHelper { Debug.logWarning(e, module); } if (UtilValidate.isNotEmpty(receipts)) { - for(GenericValue rec : receipts) { + for (GenericValue rec : receipts) { BigDecimal acceptedQuantity = rec.getBigDecimal("quantityAccepted"); BigDecimal orderedQuantity = (BigDecimal) item.get("quantity"); if (acceptedQuantity.intValue() != orderedQuantity.intValue() && acceptedQuantity.intValue() > 0) { @@ -1472,7 +1472,7 @@ public class OrderReadHelper { EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED"), EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_COMPLETED")); List<GenericValue> items = EntityUtil.filterByOr(getOrderItems(), exprs); - for(GenericValue item : items) { + for (GenericValue item : items) { if (item.get("productId") != null) { GenericValue product = null; try { @@ -1518,7 +1518,7 @@ public class OrderReadHelper { if (UtilValidate.isNotEmpty(productContents)) { // make sure we are still within the allowed timeframe and use limits - for(GenericValue productContent : productContents) { + for (GenericValue productContent : productContents) { Timestamp fromDate = productContent.getTimestamp("purchaseFromDate"); Timestamp thruDate = productContent.getTimestamp("purchaseThruDate"); if (fromDate == null || item.getTimestamp("orderDate").after(fromDate)) { @@ -1678,7 +1678,7 @@ public class OrderReadHelper { // since we don't have a handy grouped view entity, we'll have to group the return items by hand Map<String, BigDecimal> returnMap = FastMap.newInstance(); - for(GenericValue orderItem : this.getValidOrderItems()) { + for (GenericValue orderItem : this.getValidOrderItems()) { List<GenericValue> group = EntityUtil.filterByAnd(returnItems, UtilMisc.toList( EntityCondition.makeCondition("orderId", orderItem.get("orderId")), EntityCondition.makeCondition("orderItemSeqId", orderItem.get("orderItemSeqId")), @@ -1686,7 +1686,7 @@ public class OrderReadHelper { // add up the returned quantities for this group TODO: received quantity should be used eventually BigDecimal returned = BigDecimal.ZERO; - for(GenericValue returnItem : group) { + for (GenericValue returnItem : group) { if (returnItem.getBigDecimal("returnQuantity") != null) { returned = returned.add(returnItem.getBigDecimal("returnQuantity")); } @@ -1722,7 +1722,7 @@ public class OrderReadHelper { returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED"))); BigDecimal returnedQuantity = ZERO; - for(GenericValue returnedItem : returnedItems) { + for (GenericValue returnedItem : returnedItems) { if (returnedItem.get("returnQuantity") != null) { returnedQuantity = returnedQuantity.add(returnedItem.getBigDecimal("returnQuantity")).setScale(scale, rounding); } @@ -1755,7 +1755,7 @@ public class OrderReadHelper { BigDecimal returnedAmount = ZERO; String orderId = orderHeader.getString("orderId"); List<String> returnHeaderList = FastList.newInstance(); - for(GenericValue returnedItem : returnedItems) { + for (GenericValue returnedItem : returnedItems) { if ((returnedItem.get("returnPrice") != null) && (returnedItem.get("returnQuantity") != null)) { returnedAmount = returnedAmount.add(returnedItem.getBigDecimal("returnPrice").multiply(returnedItem.getBigDecimal("returnQuantity")).setScale(scale, rounding)); } @@ -1766,7 +1766,7 @@ public class OrderReadHelper { } } //get returnedAmount from returnHeader adjustments whose orderId must equals to current orderHeader.orderId - for(String returnId : returnHeaderList) { + for (String returnId : returnHeaderList) { Map<String, Object> returnHeaderAdjFilter = UtilMisc.<String, Object>toMap("returnId", returnId, "returnItemSeqId", "_NA_", "returnTypeId", returnTypeId); returnedAmount =returnedAmount.add(getReturnAdjustmentTotal(orderHeader.getDelegator(), returnHeaderAdjFilter)).setScale(scale, rounding); } @@ -1806,7 +1806,7 @@ public class OrderReadHelper { returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED"))); Map<String, BigDecimal> itemReturnedQuantities = FastMap.newInstance(); - for(GenericValue returnedItem : returnedItems) { + for (GenericValue returnedItem : returnedItems) { String orderItemSeqId = returnedItem.getString("orderItemSeqId"); BigDecimal returnedQuantity = returnedItem.getBigDecimal("returnQuantity"); if (orderItemSeqId != null && returnedQuantity != null) { @@ -1824,7 +1824,7 @@ public class OrderReadHelper { BigDecimal totalTaxNotReturned = ZERO; BigDecimal totalShippingNotReturned = ZERO; - for(GenericValue orderItem : this.getValidOrderItems()) { + for (GenericValue orderItem : this.getValidOrderItems()) { BigDecimal itemQuantityDbl = orderItem.getBigDecimal("quantity"); if (itemQuantityDbl == null || itemQuantityDbl.compareTo(ZERO) == 0) { continue; @@ -1883,7 +1883,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) { + for (GenericValue returnItem : returnedItems) { GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse", false); if (returnItemResponse == null) continue; if (returnItemResponse.get("billingAccountId") == null) continue; @@ -1921,10 +1921,10 @@ public class OrderReadHelper { BigDecimal backorder = ZERO; List<GenericValue> items = this.getValidOrderItems(); if (items != null) { - for(GenericValue item : items) { + for (GenericValue item : items) { List<GenericValue> reses = this.getOrderItemShipGrpInvResList(item); if (reses != null) { - for(GenericValue res : reses) { + for (GenericValue res : reses) { BigDecimal nav = res.getBigDecimal("quantityNotAvailable"); if (nav != null) { backorder = backorder.add(nav).setScale(scale, rounding); @@ -1953,7 +1953,7 @@ public class OrderReadHelper { } if (picked != null) { - for(GenericValue pickedItem : picked) { + for (GenericValue pickedItem : picked) { BigDecimal issueQty = pickedItem.getBigDecimal("quantity"); if (issueQty != null) { quantityPicked = quantityPicked.add(issueQty).setScale(scale, rounding); @@ -1967,7 +1967,7 @@ public class OrderReadHelper { BigDecimal quantityShipped = ZERO; List<GenericValue> issuance = getOrderItemIssuances(orderItem); if (issuance != null) { - for(GenericValue issue : issuance) { + for (GenericValue issue : issuance) { BigDecimal issueQty = issue.getBigDecimal("quantity"); BigDecimal cancelQty = issue.getBigDecimal("cancelQuantity"); if (cancelQty == null) { @@ -1987,7 +1987,7 @@ public class OrderReadHelper { List<GenericValue> reses = getOrderItemShipGrpInvResList(orderItem); if (reses != null) { - for(GenericValue res : reses) { + for (GenericValue res : reses) { BigDecimal quantity = res.getBigDecimal("quantity"); if (quantity != null) { reserved = reserved.add(quantity).setScale(scale, rounding); @@ -2005,7 +2005,7 @@ public class OrderReadHelper { List<GenericValue> reses = getOrderItemShipGrpInvResList(orderItem); if (reses != null) { - for(GenericValue res : reses) { + for (GenericValue res : reses) { Timestamp promised = res.getTimestamp("currentPromisedDate"); if (promised == null) { promised = res.getTimestamp("promisedDatetime"); @@ -2542,7 +2542,7 @@ public class OrderReadHelper { if (UtilValidate.isNotEmpty(adjustments)) { List<GenericValue> filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping); - for(GenericValue orderAdjustment : filteredAdjs) { + for (GenericValue orderAdjustment : filteredAdjs) { adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustment(orderAdjustment, quantity, unitPrice)); } } @@ -2554,7 +2554,7 @@ public class OrderReadHelper { if (UtilValidate.isNotEmpty(adjustments)) { List<GenericValue> filteredAdjs = filterOrderAdjustments(adjustments, includeOther, includeTax, includeShipping, forTax, forShipping); - for(GenericValue orderAdjustment : filteredAdjs) { + for (GenericValue orderAdjustment : filteredAdjs) { adjTotal = adjTotal.add(OrderReadHelper.calcItemAdjustmentRecurringBd(orderAdjustment, quantity, unitPrice)).setScale(scale, rounding); } } @@ -2591,7 +2591,7 @@ public class OrderReadHelper { List<GenericValue> newOrderAdjustmentsList = FastList.newInstance(); if (UtilValidate.isNotEmpty(adjustments)) { - for(GenericValue orderAdjustment : adjustments) { + for (GenericValue orderAdjustment : adjustments) { boolean includeAdjustment = false; if ("SALES_TAX".equals(orderAdjustment.getString("orderAdjustmentTypeId")) || @@ -2640,7 +2640,7 @@ public class OrderReadHelper { } if (UtilValidate.isNotEmpty(openOrders)) { - for(GenericValue order : openOrders) { + for (GenericValue order : openOrders) { BigDecimal thisQty = order.getBigDecimal("quantity"); if (thisQty == null) { thisQty = BigDecimal.ZERO; @@ -2693,7 +2693,7 @@ public class OrderReadHelper { List<GenericValue> orderHeaderAdjustments = this.getOrderHeaderAdjustments(); List<GenericValue> filteredAdjustments = FastList.newInstance(); if (orderHeaderAdjustments != null) { - for(GenericValue orderAdjustment : orderHeaderAdjustments) { + for (GenericValue orderAdjustment : orderHeaderAdjustments) { long count = 0; try { count = orderHeader.getDelegator().findCountByCondition("ReturnAdjustment", EntityCondition.makeCondition("orderAdjustmentId", EntityOperator.EQUALS, orderAdjustment.get("orderAdjustmentId")), null, null); @@ -2721,7 +2721,7 @@ public class OrderReadHelper { // TODO: find on a view-entity with a sum is probably more efficient adjustments = delegator.findByAnd("ReturnAdjustment", condition, null, false); if (adjustments != null) { - for(GenericValue returnAdjustment : adjustments) { + for (GenericValue returnAdjustment : adjustments) { total = total.add(setScaleByType("RET_SALES_TAX_ADJ".equals(returnAdjustment.get("returnAdjustmentTypeId")),returnAdjustment.getBigDecimal("amount"))); } } @@ -2742,7 +2742,7 @@ public class OrderReadHelper { try { // this is simply the sum of quantity billed in all related OrderItemBillings List<GenericValue> billings = orderItem.getRelated("OrderItemBilling", null, null, false); - for(GenericValue billing : billings) { + for (GenericValue billing : billings) { BigDecimal quantity = billing.getBigDecimal("quantity"); if (quantity != null) { invoiced = invoiced.add(quantity); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java?rev=1511742&r1=1511741&r2=1511742&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java Thu Aug 8 12:28:01 2013 @@ -428,7 +428,7 @@ public class OrderReturnServices { returnableQuantity = orderQty; } else { BigDecimal returnedQty = BigDecimal.ZERO; - for(GenericValue returnItem : returnedItems) { + for (GenericValue returnItem : returnedItems) { GenericValue returnHeader = null; try { returnHeader = returnItem.getRelatedOne("ReturnHeader", false); @@ -495,7 +495,7 @@ public class OrderReturnServices { } if (orderItemQuantitiesIssued != null) { - for(GenericValue orderItemQuantityIssued : orderItemQuantitiesIssued) { + for (GenericValue orderItemQuantityIssued : orderItemQuantitiesIssued) { GenericValue item = null; try { item = orderItemQuantityIssued.getRelatedOne("OrderItem", false); @@ -573,7 +573,7 @@ public class OrderReturnServices { "OrderErrorUnableToGetOrderAdjustmentsFromItem", locale)); } if (UtilValidate.isNotEmpty(itemAdjustments)) { - for(GenericValue itemAdjustment : itemAdjustments) { + for (GenericValue itemAdjustment : itemAdjustments) { returnInfo = FastMap.newInstance(); returnInfo.put("returnableQuantity", BigDecimal.ONE); // TODO: the returnablePrice should be set to the amount minus the already returned amount @@ -630,7 +630,7 @@ public class OrderReturnServices { List<GenericValue> completedItems = FastList.newInstance(); if (returnHeader != null && UtilValidate.isNotEmpty(returnItems)) { - for(GenericValue item : returnItems) { + for (GenericValue item : returnItems) { String itemStatus = item != null ? item.getString("statusId") : null; if (itemStatus != null) { // both completed and cancelled items qualify for completed status change @@ -874,7 +874,7 @@ public class OrderReturnServices { // first, compute the total credit from the return items BigDecimal creditTotal = ZERO; - for(GenericValue item : returnItems) { + for (GenericValue item : returnItems) { BigDecimal quantity = item.getBigDecimal("returnQuantity"); BigDecimal price = item.getBigDecimal("returnPrice"); if (quantity == null) quantity = ZERO; @@ -954,7 +954,7 @@ public class OrderReturnServices { String itemResponseId = (String) serviceResults.get("returnItemResponseId"); // loop through the items again to update them and store a status change history - for(GenericValue item : returnItems) { + for (GenericValue item : returnItems) { Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", "RETURN_COMPLETED", "userLogin", userLogin); // store the item changes (attached responseId) try { @@ -1031,14 +1031,14 @@ public class OrderReturnServices { ), EntityOperator.AND); List<GenericValue> orderPaymentPreferenceSums = delegator.findList("OrderPurchasePaymentSummary", whereConditions, UtilMisc.toSet("maxAmount"), null, null, false); - for(GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) { + for (GenericValue orderPaymentPreferenceSum : orderPaymentPreferenceSums) { BigDecimal maxAmount = orderPaymentPreferenceSum.getBigDecimal("maxAmount"); balance = maxAmount != null ? balance.subtract(maxAmount) : balance; } List<GenericValue> paymentAppls = delegator.findByAnd("PaymentApplication", UtilMisc.toMap("billingAccountId", billingAccountId), null, false); // TODO: cancelled payments? - for(GenericValue paymentAppl : paymentAppls) { + for (GenericValue paymentAppl : paymentAppls) { if (paymentAppl.getString("invoiceId") == null) { BigDecimal amountApplied = paymentAppl.getBigDecimal("amountApplied"); balance = balance.add(amountApplied); @@ -1076,7 +1076,7 @@ public class OrderReturnServices { // find the minimum storeCreditValidDays of all the ProductStores associated with all the Orders on the Return, skipping null ones Long storeCreditValidDays = null; - for(GenericValue productStore : productStores) { + for (GenericValue productStore : productStores) { Long thisStoreValidDays = productStore.getLong("storeCreditValidDays"); if (thisStoreValidDays == null) continue; @@ -1302,7 +1302,7 @@ public class OrderReturnServices { * the intent is to get the refundable amounts per orderPaymentPreference, grouped by payment method type. */ Map<String, List<Map<String, Object>>> prefSplitMap = FastMap.newInstance(); - for(GenericValue orderPayPref : orderPayPrefs) { + for (GenericValue orderPayPref : orderPayPrefs) { String paymentMethodTypeId = orderPayPref.getString("paymentMethodTypeId"); String orderPayPrefKey = orderPayPref.getString("paymentMethodId") != null ? orderPayPref.getString("paymentMethodId") : orderPayPref.getString("paymentMethodTypeId"); @@ -1470,7 +1470,7 @@ public class OrderReturnServices { String responseId = (String) serviceResults.get("returnItemResponseId"); // Set the response on each item - for(GenericValue item : items) { + for (GenericValue item : items) { Map<String, Object> returnItemMap = UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "returnId", item.get("returnId"), "returnItemSeqId", item.get("returnItemSeqId"), "statusId", returnItemStatusId, "userLogin", userLogin); //Debug.logInfo("Updating item status", module); try { @@ -1770,7 +1770,7 @@ public class OrderReturnServices { Debug.logError(e, module); } if (orderCm != null) { - for(GenericValue v : orderCm) { + for (GenericValue v : orderCm) { contactMechs.add(GenericValue.create(v)); } orderMap.put("orderContactMechs", contactMechs); @@ -1805,7 +1805,7 @@ public class OrderReturnServices { List<GenericValue> orderItemAssocs = FastList.newInstance(); if (returnItemList != null) { int itemCount = 1; - for(GenericValue returnItem : returnItemList) { + for (GenericValue returnItem : returnItemList) { GenericValue orderItem = null; GenericValue product = null; try { @@ -1916,7 +1916,7 @@ public class OrderReturnServices { continue; } if (UtilValidate.isNotEmpty(repairItems)) { - for(GenericValue repairItem : repairItems) { + for (GenericValue repairItem : repairItems) { GenericValue repairItemProduct = null; try { repairItemProduct = repairItem.getRelatedOne("AssocProduct", false); @@ -2062,7 +2062,7 @@ public class OrderReturnServices { List<GenericValue> orderRoles = orderHeader.getRelated("OrderRole", null, null, false); Map<String, List<String>> orderRolesMap = FastMap.newInstance(); if (orderRoles != null) { - for(GenericValue orderRole : orderRoles) { + for (GenericValue orderRole : orderRoles) { List<String> parties = orderRolesMap.get(orderRole.getString("roleTypeId")); if (parties == null) { parties = FastList.newInstance(); @@ -2139,7 +2139,7 @@ public class OrderReturnServices { "OrderProblemCreatingReturnItemResponseRecord", locale)); } - for(GenericValue returnItem : returnItemList) { + for (GenericValue returnItem : returnItemList) { Map<String, Object> updateReturnItemCtx = FastMap.newInstance(); updateReturnItemCtx.put("returnId", returnId); updateReturnItemCtx.put("returnItemSeqId", returnItem.get("returnItemSeqId")); @@ -2197,7 +2197,7 @@ public class OrderReturnServices { } if (returnItems != null) { - for(GenericValue returnItem : returnItems) { + for (GenericValue returnItem : returnItems) { String orderItemSeqId = returnItem.getString("orderItemSeqId"); String orderId = returnItem.getString("orderId"); @@ -2212,7 +2212,7 @@ public class OrderReturnServices { // cancel all current subscriptions if (subscriptions != null) { - for(GenericValue subscription : subscriptions) { + for (GenericValue subscription : subscriptions) { Timestamp thruDate = subscription.getTimestamp("thruDate"); if (thruDate == null || thruDate.after(now)) { subscription.set("thruDate", now); @@ -2241,7 +2241,7 @@ public class OrderReturnServices { * @param returnTypeId the return type id */ public static void groupReturnItemsByOrder(List<GenericValue> returnItems, Map<String, List<GenericValue>> returnItemsByOrderId, Map<String, BigDecimal> totalByOrder, Delegator delegator, String returnId, String returnTypeId) { - for(GenericValue returnItem : returnItems) { + for (GenericValue returnItem : returnItems) { String orderId = returnItem.getString("orderId"); if (orderId != null) { if (returnItemsByOrderId != null) { @@ -2284,7 +2284,7 @@ public class OrderReturnServices { // We may also have some order-level adjustments, so we need to go through each order again and add those as well if ((totalByOrder != null) && (totalByOrder.keySet() != null)) { - for(String orderId : totalByOrder.keySet()) { + for (String orderId : totalByOrder.keySet()) { // find returnAdjustment for returnHeader Map<String, Object> condition = UtilMisc.<String, Object>toMap("returnId", returnId, "returnItemSeqId", org.ofbiz.common.DataModelConstants.SEQ_ID_NA, @@ -2312,7 +2312,7 @@ public class OrderReturnServices { } if ((returnItems != null) && (returnItems.size() > 0)) { List<String> paymentList = FastList.newInstance(); - for(GenericValue returnItem : returnItems) { + for (GenericValue returnItem : returnItems) { String orderId = returnItem.getString("orderId"); try { GenericValue returnItemResponse = returnItem.getRelatedOne("ReturnItemResponse", false); @@ -2357,7 +2357,7 @@ public class OrderReturnServices { } if ((returnAmountByOrder != null) && (returnAmountByOrder.keySet() != null)) { - for(String orderId : returnAmountByOrder.keySet()) { + for (String orderId : returnAmountByOrder.keySet()) { BigDecimal returnAmount = returnAmountByOrder.get(orderId); if (returnAmount.abs().compareTo(new BigDecimal("0.000001")) < 0) { Debug.logError("Order [" + orderId + "] refund amount[ " + returnAmount + "] less than zero", module); @@ -2610,7 +2610,7 @@ public class OrderReturnServices { // TODO: find on a view-entity with a sum is probably more efficient adjustments = delegator.findByAnd("ReturnAdjustment", condition, null, false); if (adjustments != null) { - for(GenericValue returnAdjustment : adjustments) { + for (GenericValue returnAdjustment : adjustments) { if ((returnAdjustment != null) && (returnAdjustment.get("amount") != null)) { total = total.add(returnAdjustment.getBigDecimal("amount")); } |
Free forum by Nabble | Edit this page |