Author: doogie
Date: Sat Mar 21 23:44:41 2009 New Revision: 757091 URL: http://svn.apache.org/viewvc?rev=757091&view=rev Log: Fix purely empty whitespace lines, and remove trailing whitespace. Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderChangeHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderListState.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReadHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderReturnServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/quote/QuoteServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/requirement/RequirementServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartEventListener.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CartItemModifyException.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/CheckOutHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ItemNotFoundException.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartItem.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/WebShoppingCart.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductDisplayWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductPromoWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/product/ProductStoreCartAwareEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppingcart/shipping/ShippingEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/shoppinglist/ShoppingListServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskEvents.java ofbiz/trunk/applications/order/src/org/ofbiz/order/task/TaskWorker.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/OrderTestServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/PurchaseOrderTest.java ofbiz/trunk/applications/order/src/org/ofbiz/order/test/SalesOrderTest.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareException.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareServices.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/taxware/TaxwareUTL.java ofbiz/trunk/applications/order/src/org/ofbiz/order/thirdparty/zipsales/ZipSalesServices.java 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=757091&r1=757090&r2=757091&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/OrderManagerEvents.java Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -83,7 +83,7 @@ Iterator i = paymentPrefs.iterator(); while (i.hasNext()) { // update the preference to received - // TODO: updating payment preferences should be done as a service + // TODO: updating payment preferences should be done as a service GenericValue ppref = (GenericValue) i.next(); ppref.set("statusId", "PAYMENT_RECEIVED"); ppref.set("authDate", UtilDateTime.nowTimestamp()); @@ -92,7 +92,7 @@ // create a payment record Map results = null; try { - results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("orderPaymentPreferenceId", ppref.get("orderPaymentPreferenceId"), + results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("orderPaymentPreferenceId", ppref.get("orderPaymentPreferenceId"), "paymentFromId", placingCustomer.getString("partyId"), "comments", "Payment received offline and manually entered.")); } catch (GenericServiceException e) { Debug.logError(e, "Failed to execute service createPaymentFromPreference", module); @@ -101,7 +101,7 @@ } if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) { - Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); + Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); request.setAttribute("_ERROR_MESSAGE_", (String) results.get(ModelService.ERROR_MESSAGE)); return "error"; } @@ -204,7 +204,7 @@ if (userLogin != null) { paymentPreference.set("createdByUserLogin", userLogin.getString("userLoginId")); } - + try { delegator.create(paymentPreference); } catch (GenericEntityException ex) { @@ -216,15 +216,15 @@ // create a payment record Map results = null; try { - results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, - "orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "paymentRefNum", paymentReference, + results = dispatcher.runSync("createPaymentFromPreference", UtilMisc.toMap("userLogin", userLogin, + "orderPaymentPreferenceId", paymentPreference.get("orderPaymentPreferenceId"), "paymentRefNum", paymentReference, "paymentFromId", placingCustomer.getString("partyId"), "comments", "Payment received offline and manually entered.")); } catch (GenericServiceException e) { Debug.logError(e, "Failed to execute service createPaymentFromPreference", module); request.setAttribute("_ERROR_MESSAGE_", e.getMessage()); return "error"; } - + if ((results == null) || (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR))) { Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); request.setAttribute("_ERROR_MESSAGE_", (String) results.get(ModelService.ERROR_MESSAGE)); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java?rev=757091&r1=757090&r2=757091&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/finaccount/FinAccountHelper.java Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -45,7 +45,7 @@ * */ public class FinAccountHelper { - + public static final String module = FinAccountHelper.class.getName(); /** * A word on precision: since we're just adding and subtracting, the interim figures should have one more decimal place of precision than the final numbers. @@ -53,22 +53,22 @@ public static int decimals = UtilNumber.getBigDecimalScale("finaccount.decimals"); public static int rounding = UtilNumber.getBigDecimalRoundingMode("finaccount.rounding"); public static final BigDecimal ZERO = BigDecimal.ZERO.setScale(decimals, rounding); - + public static final String giftCertFinAccountTypeId = "GIFTCERT_ACCOUNT"; public static final boolean defaultPinRequired = false; - + // pool of available characters for account codes, here numbers plus uppercase characters static char[] char_pool = new char[10+26]; static { int j = 0; for (int i = "0".charAt(0); i <= "9".charAt(0); i++) { char_pool[j++] = (char) i; - } + } for (int i = "A".charAt(0); i <= "Z".charAt(0); i++) { char_pool[j++] = (char) i; } } - + /** * A convenience method which adds transactions.get(0).get(fieldName) to initialValue, all done in BigDecimal to decimals and rounding @@ -123,12 +123,12 @@ count++; if (count > 999999) { throw new GenericEntityException("Unable to locate unique FinAccountCode! Length [" + codeLength + "]"); - } + } } return newAccountCode.toString(); } - + /** * Gets the first (and should be only) FinAccount based on finAccountCode, which will be cleaned up to be only uppercase and alphanumeric * @param finAccountCode @@ -141,21 +141,21 @@ if (finAccountCode == null) { return null; } - + Pattern filterRegex = Pattern.compile("[^0-9A-Z]"); finAccountCode = finAccountCode.toUpperCase().replaceAll(filterRegex.pattern(), ""); - + // now we need to get the encrypted version of the fin account code the user passed in to look up against FinAccount // we do this by making a temporary generic entity with same finAccountCode and then doing a match ModelEntity finAccountEntity = delegator.getModelEntity("FinAccount"); GenericEntity encryptedFinAccount = GenericEntity.createGenericEntity(finAccountEntity, UtilMisc.toMap("finAccountCode", finAccountCode)); delegator.encryptFields(encryptedFinAccount); String encryptedFinAccountCode = encryptedFinAccount.getString("finAccountCode"); - + // now look for the account List accounts = delegator.findByAnd("FinAccount", UtilMisc.toMap("finAccountCode", encryptedFinAccountCode)); accounts = EntityUtil.filterByDate(accounts); - + if ((accounts == null) || (accounts.size() == 0)) { // OK to display - not a code anyway Debug.logWarning("No fin account found for account code [" + finAccountCode + "]", module); @@ -168,11 +168,11 @@ return (GenericValue) accounts.get(0); } } - + /** * Sum of all DEPOSIT and ADJUSTMENT transactions minus all WITHDRAWAL transactions whose transactionDate is before asOfDateTime - * @param finAccountId + * @param finAccountId * @param asOfDateTime * @param delegator * @return @@ -180,13 +180,13 @@ */ public static BigDecimal getBalance(String finAccountId, Timestamp asOfDateTime, GenericDelegator delegator) throws GenericEntityException { if (asOfDateTime == null) asOfDateTime = UtilDateTime.nowTimestamp(); - + BigDecimal incrementTotal = ZERO; // total amount of transactions which increase balance BigDecimal decrementTotal = ZERO; // decrease balance GenericValue finAccount = delegator.findByPrimaryKeyCache("FinAccount", UtilMisc.toMap("finAccountId", finAccountId)); String currencyUomId = finAccount.getString("currencyUomId"); - + // find the sum of all transactions which increase the value EntityConditionList incrementConditions = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId), @@ -208,7 +208,7 @@ EntityOperator.AND); transSums = delegator.findList("FinAccountTransSum", decrementConditions, UtilMisc.toSet("amount"), null, null, false); decrementTotal = addFirstEntryAmount(decrementTotal, transSums, "amount", (decimals+1), rounding); - + // the net balance is just the incrementTotal minus the decrementTotal return incrementTotal.subtract(decrementTotal).setScale(decimals, rounding); } @@ -225,24 +225,24 @@ if (asOfDateTime == null) asOfDateTime = UtilDateTime.nowTimestamp(); BigDecimal netBalance = getBalance(finAccountId, asOfDateTime, delegator); - + // find sum of all authorizations which are not expired and which were authorized before as of time EntityConditionList authorizationConditions = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("finAccountId", EntityOperator.EQUALS, finAccountId), EntityCondition.makeCondition("authorizationDate", EntityOperator.LESS_THAN_EQUAL_TO, asOfDateTime), EntityUtil.getFilterByDateExpr(asOfDateTime)), EntityOperator.AND); - + List authSums = delegator.findList("FinAccountAuthSum", authorizationConditions, UtilMisc.toSet("amount"), null, null, false); - + BigDecimal authorizationsTotal = addFirstEntryAmount(ZERO, authSums, "amount", (decimals+1), rounding); - + // the total available balance is transactions total minus authorizations total return netBalance.subtract(authorizationsTotal).setScale(decimals, rounding); } public static boolean validateFinAccount(GenericValue finAccount) { - return false; + return false; } /** @@ -259,7 +259,7 @@ } catch (GenericEntityException e) { Debug.logError(e, module); } - + if (finAccount != null) { String dbPin = finAccount.getString("finAccountCode"); Debug.logInfo("FinAccount Pin Validation: [Sent: " + pinNumber + "] [Actual: " + dbPin + "]", module); 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=757091&r1=757090&r2=757091&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 Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -190,7 +190,7 @@ GenericValue orderItem = (GenericValue) oii.next(); String orderItemSeqId = orderItem.getString("orderItemSeqId"); GenericValue product = null; - + try { product = orderItem.getRelatedOne("Product"); } catch (GenericEntityException e) { @@ -205,7 +205,7 @@ } if (productType != null) { String isDigital = productType.getString("isDigital"); - if (isDigital != null && "Y".equalsIgnoreCase(isDigital)) { + if (isDigital != null && "Y".equalsIgnoreCase(isDigital)) { // update the status Map digitalStatusFields = UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "statusId", digitalItemStatus, "userLogin", userLogin); Map digitalStatusChange = dispatcher.runSync("changeOrderItemStatus", digitalStatusFields); @@ -271,8 +271,8 @@ List payments = orh.getOrderPayments(opp); if (payments == null || payments.size() == 0) { // only do this one time; if we have payment already for this pref ignore. - Map results = dispatcher.runSync("createPaymentFromPreference", - UtilMisc.<String, Object>toMap("userLogin", userLogin, "orderPaymentPreferenceId", opp.getString("orderPaymentPreferenceId"), + Map results = dispatcher.runSync("createPaymentFromPreference", + UtilMisc.<String, Object>toMap("userLogin", userLogin, "orderPaymentPreferenceId", opp.getString("orderPaymentPreferenceId"), "paymentRefNum", UtilDateTime.nowTimestamp().toString(), "paymentFromId", partyId)); if (results.get(ModelService.RESPONSE_MESSAGE).equals(ModelService.RESPOND_ERROR)) { Debug.logError((String) results.get(ModelService.ERROR_MESSAGE), module); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java?rev=757091&r1=757090&r2=757091&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderContentWrapper.java Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -45,12 +45,12 @@ * */ public class OrderContentWrapper { - + public static final String module = OrderContentWrapper.class.getName(); public static final String SEPARATOR = "::"; // cache key separator - + public static UtilCache orderContentCache; - + public static OrderContentWrapper makeOrderContentWrapper(GenericValue order, HttpServletRequest request) { return new OrderContentWrapper(order, request); } @@ -59,7 +59,7 @@ protected GenericValue order; protected Locale locale; protected String mimeTypeId; - + public OrderContentWrapper(LocalDispatcher dispatcher, GenericValue order, Locale locale, String mimeTypeId) { this.dispatcher = dispatcher; this.order = order; @@ -69,7 +69,7 @@ orderContentCache = new UtilCache("order.content", true); // use soft reference to free up memory if needed } } - + public OrderContentWrapper(GenericValue order, HttpServletRequest request) { this.dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); this.order = order; @@ -79,11 +79,11 @@ orderContentCache = new UtilCache("order.content", true); // use soft reference to free up memory if needed } } - + public String get(String orderContentTypeId) { return getOrderContentAsText(order, orderContentTypeId, locale, mimeTypeId, order.getDelegator(), dispatcher); } - + public static String getOrderContentAsText(GenericValue order, String orderContentTypeId, HttpServletRequest request) { LocalDispatcher dispatcher = (LocalDispatcher) request.getAttribute("dispatcher"); return getOrderContentAsText(order, orderContentTypeId, UtilHttp.getLocale(request), "text/html", order.getDelegator(), dispatcher); @@ -92,19 +92,19 @@ public static String getOrderContentAsText(GenericValue order, String orderContentTypeId, Locale locale, LocalDispatcher dispatcher) { return getOrderContentAsText(order, orderContentTypeId, locale, null, null, dispatcher); } - + public static String getOrderContentAsText(GenericValue order, String orderContentTypeId, Locale locale, String mimeTypeId, GenericDelegator delegator, LocalDispatcher dispatcher) { /* caching: there is one cache created, "order.content" Each order's content is cached with a key of * contentTypeId::locale::mimeType::orderId::orderItemSeqId, or whatever the SEPARATOR is defined above to be. */ String orderItemSeqId = (order.getEntityName().equals("OrderItem")? order.getString("orderItemSeqId"): "_NA_"); - + String cacheKey = orderContentTypeId + SEPARATOR + locale + SEPARATOR + mimeTypeId + SEPARATOR + order.get("orderId") + SEPARATOR + orderItemSeqId; try { if (orderContentCache != null && orderContentCache.get(cacheKey) != null) { return (String) orderContentCache.get(cacheKey); } - + Writer outWriter = new StringWriter(); getOrderContentAsText(null, null, order, orderContentTypeId, locale, mimeTypeId, delegator, dispatcher, outWriter); String outString = outWriter.toString(); @@ -123,7 +123,7 @@ return ""; } } - + public static void getOrderContentAsText(String orderId, String orderItemSeqId, GenericValue order, String orderContentTypeId, Locale locale, String mimeTypeId, GenericDelegator delegator, LocalDispatcher dispatcher, Writer outWriter) throws GeneralException, IOException { if (orderId == null && order != null) { orderId = order.getString("orderId"); @@ -131,15 +131,15 @@ if (orderItemSeqId == null && order != null) { orderItemSeqId = (order.getEntityName().equals("OrderItem")? order.getString("orderItemSeqId"): "_NA_"); } - + if (delegator == null && order != null) { delegator = order.getDelegator(); } - + if (UtilValidate.isEmpty(mimeTypeId)) { mimeTypeId = "text/html"; } - + List orderContentList = delegator.findByAndCache("OrderContent", UtilMisc.toMap("orderId", orderId, "orderItemSeqId", orderItemSeqId, "orderContentTypeId", orderContentTypeId), UtilMisc.toList("-fromDate")); orderContentList = EntityUtil.filterByDate(orderContentList); GenericValue orderContent = EntityUtil.getFirst(orderContentList); Modified: ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java?rev=757091&r1=757090&r2=757091&view=diff ============================================================================== --- ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java (original) +++ ofbiz/trunk/applications/order/src/org/ofbiz/order/order/OrderEvents.java Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -49,21 +49,21 @@ GenericDelegator delegator = (GenericDelegator) request.getAttribute("delegator"); GenericValue userLogin = (GenericValue) session.getAttribute("userLogin"); String dataResourceId = request.getParameter("dataResourceId"); - + try { // has the userLogin.partyId ordered a product with DIGITAL_DOWNLOAD content associated for the given dataResourceId? - List orderRoleAndProductContentInfoList = delegator.findByAnd("OrderRoleAndProductContentInfo", + List orderRoleAndProductContentInfoList = delegator.findByAnd("OrderRoleAndProductContentInfo", UtilMisc.toMap("partyId", userLogin.get("partyId"), "dataResourceId", dataResourceId, "productContentTypeId", "DIGITAL_DOWNLOAD", "statusId", "ITEM_COMPLETED")); - + if (orderRoleAndProductContentInfoList.size() == 0) { request.setAttribute("_ERROR_MESSAGE_", "No record of purchase for digital download found (dataResourceId=[" + dataResourceId + "])."); return "error"; } - + GenericValue orderRoleAndProductContentInfo = (GenericValue) orderRoleAndProductContentInfoList.get(0); - + // TODO: check validity based on ProductContent fields: useCountLimit, useTime/useTimeUomId - + if (orderRoleAndProductContentInfo.getString("mimeTypeId") != null) { response.setContentType(orderRoleAndProductContentInfo.getString("mimeTypeId")); } @@ -86,7 +86,7 @@ request.setAttribute("_ERROR_MESSAGE_", errMsg); return "error"; } - + return "success"; } } 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=757091&r1=757090&r2=757091&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 Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -81,14 +81,14 @@ map.put("filterAuthProblems", "filterAuthProblems"); map.put("filterPartiallyReceivedPOs", "filterPartiallyReceivedPOs"); map.put("filterPOsOpenPastTheirETA", "filterPOsOpenPastTheirETA"); - map.put("filterPOsWithRejectedItems", "filterPOsWithRejectedItems"); + map.put("filterPOsWithRejectedItems", "filterPOsWithRejectedItems"); parameterToFilterId = map; } //============= Initialization and Request methods ===================// /** - * Initializes the order list state with default values. Do not use directly, + * Initializes the order list state with default values. Do not use directly, * instead use getInstance(). */ protected OrderListState() { @@ -96,7 +96,7 @@ viewIndex = 0; orderStatusState = FastMap.newInstance(); orderTypeState = FastMap.newInstance(); - orderFilterState = FastMap.newInstance(); + orderFilterState = FastMap.newInstance(); // defaults (TODO: configuration) orderStatusState.put("viewcreated", "Y"); @@ -126,7 +126,7 @@ /** * Given a request, decides what state to change. If a parameter changeStatusAndTypeState - * is present with value "Y", the status and type state will be updated. Otherwise, if the + * is present with value "Y", the status and type state will be updated. Otherwise, if the * viewIndex and viewSize parameters are present, the pagination changes. */ public void update(HttpServletRequest request) { @@ -187,11 +187,11 @@ public Map getOrderStatusState() { return orderStatusState; }; public Map getOrderTypeState() { return orderTypeState; } public Map getorderFilterState() { return orderFilterState; } - + public boolean hasStatus(String param) { return ("Y".equals(orderStatusState.get(param))); } public boolean hasType(String param) { return ("Y".equals(orderTypeState.get(param))); } public boolean hasFilter(String param) { return ("Y".equals(orderFilterState.get(param))); } - + public boolean hasAllStatus() { for (Iterator iter = orderStatusState.values().iterator(); iter.hasNext(); ) { if (!"Y".equals(iter.next())) return false; @@ -228,7 +228,7 @@ if (!hasType(type)) continue; typeConditions.add( EntityCondition.makeCondition("orderTypeId", EntityOperator.EQUALS, parameterToOrderTypeId.get(type)) ); } - + EntityCondition statusConditionsList = EntityCondition.makeCondition(statusConditions, EntityOperator.OR); EntityCondition typeConditionsList = EntityCondition.makeCondition(typeConditions, EntityOperator.OR); if ((typeConditions.size() > 0) && (statusConditions.size() > 0)) { 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=757091&r1=757090&r2=757091&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 Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -70,8 +70,8 @@ public static final int taxCalcScale = UtilNumber.getBigDecimalScale("salestax.calc.decimals"); public static final int taxFinalScale = UtilNumber.getBigDecimalScale("salestax.final.decimals"); public static final int taxRounding = UtilNumber.getBigDecimalRoundingMode("salestax.rounding"); - public static final BigDecimal ZERO = (BigDecimal.ZERO).setScale(scale, rounding); - public static final BigDecimal percentage = (new BigDecimal("0.01")).setScale(scale, rounding); + public static final BigDecimal ZERO = (BigDecimal.ZERO).setScale(scale, rounding); + public static final BigDecimal percentage = (new BigDecimal("0.01")).setScale(scale, rounding); protected GenericValue orderHeader = null; protected List orderItemAndShipGrp = null; @@ -153,7 +153,7 @@ /** * Returns the ProductStore of this Order or null in case of Exception - */ + */ public GenericValue getProductStore() { String productStoreId = orderHeader.getString("productStoreId"); try { @@ -165,7 +165,7 @@ return null; } } - + public String getOrderTypeId() { return orderHeader.getString("orderTypeId"); } @@ -177,7 +177,7 @@ public String getOrderName() { return orderHeader.getString("orderName"); } - + public List getAdjustments() { if (adjustments == null) { try { @@ -203,7 +203,7 @@ } /** - * Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse. + * Returns a Map of paymentMethodId -> amount charged (BigDecimal) based on PaymentGatewayResponse. * @return */ public Map getReceivedPaymentTotalsByPaymentMethod() { @@ -246,7 +246,7 @@ } /** - * Returns a Map of paymentMethodId -> amount refunded + * Returns a Map of paymentMethodId -> amount refunded * @return */ public Map getReturnedTotalsByPaymentMethod() { @@ -391,7 +391,7 @@ } return false; } - + public boolean hasPhysicalProductItems() throws GenericEntityException { Iterator orderItemIter = this.getOrderItems().iterator(); while (orderItemIter.hasNext()) { @@ -1047,7 +1047,7 @@ } return shippableSizes; } - + /** * Get the total payment preference amount by payment type. Specify null to get amount * for all preference types. TODO: filter by status as well? @@ -1079,7 +1079,7 @@ /** * Get the total payment received amount by payment type. Specify null to get amount * over all types. This method works by going through all the PaymentAndApplications - * for all order Invoices that have status PMNT_RECEIVED. + * for all order Invoices that have status PMNT_RECEIVED. */ public BigDecimal getOrderPaymentReceivedTotalByType(String paymentMethodTypeId) { BigDecimal total = ZERO; @@ -1402,7 +1402,7 @@ Timestamp estimatedDeliveryDate = (Timestamp) item.get("estimatedDeliveryDate"); if (estimatedDeliveryDate != null && UtilDateTime.nowTimestamp().after(estimatedDeliveryDate)) { return true; - } + } } return false; }*/ @@ -1423,16 +1423,16 @@ } public boolean getRejectedOrderItems() { - List items = getOrderItems(); + List items = getOrderItems(); Iterator i = items.iterator(); while (i.hasNext()) { GenericValue item = (GenericValue) i.next(); - List receipts = null; + List receipts = null; try { receipts = item.getRelated("ShipmentReceipt"); } catch (GenericEntityException e) { Debug.logWarning(e, module); - } + } if (UtilValidate.isNotEmpty(receipts)) { Iterator recIter = receipts.iterator(); while (recIter.hasNext()) { @@ -1441,46 +1441,46 @@ if (rejected != null && rejected.compareTo(BigDecimal.ZERO) > 0) { return true; } - } + } } } return false; } - public boolean getPartiallyReceivedItems() { + public boolean getPartiallyReceivedItems() { /*List exprs = UtilMisc.toList(EntityCondition.makeCondition("statusId", EntityOperator.EQUALS, "ITEM_APPROVED")); List itemsApproved = EntityUtil.filterByAnd(getOrderItems(), exprs); Iterator i = itemsApproved.iterator(); while (i.hasNext()) { - GenericValue item = (GenericValue) i.next(); - int shippedQuantity = (int) getItemShippedQuantity(item); - BigDecimal orderedQuantity = (BigDecimal) item.get("quantity"); + GenericValue item = (GenericValue) i.next(); + int shippedQuantity = (int) getItemShippedQuantity(item); + BigDecimal orderedQuantity = (BigDecimal) item.get("quantity"); if (shippedQuantity != orderedQuantity.intValue() && shippedQuantity > 0) { return true; - } + } } return false; }*/ - List items = getOrderItems(); + List items = getOrderItems(); Iterator i = items.iterator(); while (i.hasNext()) { GenericValue item = (GenericValue) i.next(); - List receipts = null; + List receipts = null; try { receipts = item.getRelated("ShipmentReceipt"); } catch (GenericEntityException e) { Debug.logWarning(e, module); - } + } if (UtilValidate.isNotEmpty(receipts)) { Iterator recIter = receipts.iterator(); while (recIter.hasNext()) { GenericValue rec = (GenericValue) recIter.next(); BigDecimal acceptedQuantity = rec.getBigDecimal("quantityAccepted"); - BigDecimal orderedQuantity = (BigDecimal) item.get("quantity"); + BigDecimal orderedQuantity = (BigDecimal) item.get("quantity"); if (acceptedQuantity.intValue() != orderedQuantity.intValue() && acceptedQuantity.intValue() > 0) { - return true; + return true; } - } + } } } return false; @@ -1771,7 +1771,7 @@ return returnedQuantity.setScale(scale, rounding); } - /** + /** * Get the returned total by return type (credit, refund, etc.). Specify returnTypeId = null to get sum over all * return types. Specify includeAll = true to sum up over all return statuses except cancelled. Specify includeAll * = false to sum up over ACCEPTED,RECEIVED And COMPLETED returns. @@ -1785,7 +1785,7 @@ // get only the RETURN_RECEIVED and RETURN_COMPLETED statusIds if (!includeAll) { - returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_ACCEPTED"))); + returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_ACCEPTED"))); returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_RECEIVED"))); returnedItems.addAll(EntityUtil.filterByAnd(returnedItemsBase, UtilMisc.toMap("statusId", "RETURN_COMPLETED"))); } else { @@ -1833,10 +1833,10 @@ return getOrderReturnedTotalByTypeBd(null, false); } - /** + /** * Gets the total returned over all return types. Specify true to include all return statuses * except cancelled. Specify false to include only COMPLETED and RECEIVED returns. - */ + */ public BigDecimal getOrderReturnedTotal(boolean includeAll) { return getOrderReturnedTotalByTypeBd(null, includeAll); } @@ -1998,7 +1998,7 @@ EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, orderItem.getString("orderItemSeqId")), EntityCondition.makeCondition("statusId", EntityOperator.NOT_EQUAL, "PICKLIST_CANCELLED")), EntityOperator.AND); - + List picked = null; try { picked = orderHeader.getDelegator().findList("PicklistAndBinAndItem", pickedConditions, null, null, null, false); @@ -2306,11 +2306,11 @@ List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null)); contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, "")); - + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); - + List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1)); return EntityUtil.orderBy(EntityUtil.filterByOr(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime")); @@ -2376,7 +2376,7 @@ if (orderAdjustment.get("amount") != null) { // round amount to best precision (taxCalcScale) because db value of 0.825 is pulled as 0.8249999... - BigDecimal amount = orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding); + BigDecimal amount = orderAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding); adjustment = adjustment.add(amount); } else if (orderAdjustment.get("sourcePercentage") != null) { @@ -2384,7 +2384,7 @@ BigDecimal percent = orderAdjustment.getBigDecimal("sourcePercentage").setScale(taxCalcScale,taxRounding); BigDecimal amount = orderSubTotal.multiply(percent).multiply(percentage).setScale(taxCalcScale, taxRounding); adjustment = adjustment.add(amount); - } + } return adjustment.setScale(scale, rounding); } @@ -2474,20 +2474,20 @@ // add tax and shipping to subtotal return getOrderItemSubTotal(orderItem, adjustments).add(getOrderItemAdjustmentsTotal(orderItem, adjustments, false, true, true)); } - + public static BigDecimal calcOrderPromoAdjustmentsBd(List allOrderAdjustments) { BigDecimal promoAdjTotal = ZERO; - + List promoAdjustments = EntityUtil.filterByAnd(allOrderAdjustments, UtilMisc.toMap("orderAdjustmentTypeId", "PROMOTION_ADJUSTMENT")); - + if (!promoAdjustments.isEmpty()) { - + Iterator promoAdjIter = promoAdjustments.iterator(); while (promoAdjIter.hasNext()) { GenericValue promoAdjustment = (GenericValue) promoAdjIter.next(); - + if (promoAdjustment != null) { - BigDecimal amount = promoAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding); + BigDecimal amount = promoAdjustment.getBigDecimal("amount").setScale(taxCalcScale, taxRounding); promoAdjTotal = promoAdjTotal.add(amount); } } @@ -2502,7 +2502,7 @@ } return length; } - + public static BigDecimal getWorkEffortRentalQuantity(GenericValue workEffort) { BigDecimal persons = BigDecimal.ONE; if (workEffort.get("reservPersons") != null) @@ -2567,7 +2567,7 @@ List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, null)); contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); contraints2.add(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.EQUALS, "")); - + List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByAnd(orderStatuses, contraints1)); return EntityUtil.orderBy(EntityUtil.filterByOr(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime")); @@ -2818,11 +2818,11 @@ List contraints1 = UtilMisc.toList(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, null)); contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, DataModelConstants.SEQ_ID_NA)); contraints1.add(EntityCondition.makeCondition("orderItemSeqId", EntityOperator.EQUALS, "")); - + List contraints2 = UtilMisc.toList(EntityCondition.makeCondition("orderPaymentPreferenceId", EntityOperator.NOT_EQUAL, null)); List newOrderStatuses = FastList.newInstance(); newOrderStatuses.addAll(EntityUtil.filterByOr(orderStatuses, contraints1)); - + return EntityUtil.orderBy(EntityUtil.filterByAnd(newOrderStatuses, contraints2), UtilMisc.toList("-statusDatetime")); } } 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=757091&r1=757090&r2=757091&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 Sat Mar 21 23:44:41 2009 @@ -6,9 +6,9 @@ * to you under the Apache License, Version 2.0 (the * "License"); you may not use this file except in compliance * with the License. You may obtain a copy of the License at - * + * * http://www.apache.org/licenses/LICENSE-2.0 - * + * * Unless required by applicable law or agreed to in writing, * software distributed under the License is distributed on an * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY @@ -402,7 +402,7 @@ EntityConditionList whereConditions = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("orderId", EntityOperator.EQUALS, orderHeader.getString("orderId")), EntityCondition.makeCondition("orderItemStatusId", EntityOperator.IN, UtilMisc.toList("ITEM_APPROVED", "ITEM_COMPLETED")) - ), EntityOperator.AND); + ), EntityOperator.AND); /* EntityConditionList havingConditions = EntityCondition.makeCondition(UtilMisc.toList( EntityCondition.makeCondition("quantityIssued", EntityOperator.GREATER_THAN, new Double(0)) @@ -427,7 +427,7 @@ Debug.logError(e, module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorUnableToGetOrderItemInformation", locale)); } - // items not issued/shipped are considered as returnable only if they are + // items not issued/shipped are considered as returnable only if they are // not physical items BigDecimal quantityIssued = orderItemQuantityIssued.getBigDecimal("quantityIssued"); if (UtilValidate.isEmpty(quantityIssued) || quantityIssued.compareTo(BigDecimal.ZERO) == 0) { @@ -440,7 +440,7 @@ Debug.logError(e, "Problems looking up returnable product type information", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorUnableToGetTheItemReturnableProduct", locale)); } - + } Map serviceResult = null; try { @@ -481,7 +481,7 @@ returnInfo.put("itemTypeKey", itemTypeKey); returnable.put(item, returnInfo); - + // Order item adjustments List itemAdjustments = null; try { @@ -559,7 +559,7 @@ if ("RETURN_COMPLETED".equals(itemStatus) || "RETURN_CANCELLED".equals(itemStatus)) { completedItems.add(item); } else { - // Non-physical items don't need an inventory receive and so are + // Non-physical items don't need an inventory receive and so are // considered completed after the return is accepted if ("RETURN_ACCEPTED".equals(returnHeader.getString("statusId"))) { try { @@ -580,7 +580,7 @@ if (completedItems.size() == returnItems.size()) { // The return is just moved to its next status by calling the // updateReturnHeader service; this will trigger all the appropriate ecas - // including this service again, so that the return is moved + // including this service again, so that the return is moved // to the final status if (currentStatus != null && "RETURN_ACCEPTED".equals(currentStatus)) { try { @@ -629,25 +629,25 @@ Debug.logError(e, "Problems looking up return information", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderErrorGettingReturnHeaderItemInformation", locale)); } - + BigDecimal adjustments = getReturnAdjustmentTotal(delegator, UtilMisc.toMap("returnId", returnId, "returnTypeId", "RTN_CREDIT")); if (returnHeader != null && ((returnItems != null && returnItems.size() > 0) || adjustments.compareTo(ZERO) > 0)) { String billingAccountId = returnHeader.getString("billingAccountId"); String fromPartyId = returnHeader.getString("fromPartyId"); String toPartyId = returnHeader.getString("toPartyId"); - + // make sure total refunds on a return don't exceed amount of returned orders Map serviceResult = null; try { serviceResult = dispatcher.runSync("checkPaymentAmountForRefund", UtilMisc.toMap("returnId", returnId)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the checkPaymentAmountForRefund service", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithCheckPaymentAmountForRefund", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithCheckPaymentAmountForRefund", locale)); } if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); - } + } if (billingAccountId == null) { // create new BillingAccount w/ 0 balance Map results = createBillingAccountFromReturn(returnHeader, returnItems, dctx, context); @@ -701,7 +701,7 @@ return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemCreatingPaymentRecord", locale)); } - // create a return item response + // create a return item response Map itemResponse = UtilMisc.toMap("paymentId", paymentId); itemResponse.put("billingAccountId", billingAccountId); itemResponse.put("responseAmount", creditTotal); @@ -764,7 +764,7 @@ // create the payment applications for the return invoice try { - serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", + serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", UtilMisc.<String, Object>toMap("returnItemResponseId", itemResponseId, "userLogin", userLogin)); if (ServiceUtil.isError(serviceResults)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemCreatingPaymentApplicationRecord", locale), null, null, serviceResults); @@ -779,14 +779,14 @@ } /** - * Helper method to generate a BillingAccount (store credit) from a return + * Helper method to generate a BillingAccount (store credit) from a return * header. This method takes care of all business logic relating to * the initialization of a Billing Account from the Return data. * - * The BillingAccount.thruDate will be set to (now + + * The BillingAccount.thruDate will be set to (now + * ProductStore.storeCreditValidDays + end of day). The product stores * are obtained via the return orders, and the minimum storeCreditValidDays - * will be used. The default is to set thruDate to null, which implies no + * will be used. The default is to set thruDate to null, which implies no * expiration. * * Note that we set BillingAccount.accountLimit to 0.0 for store credits. @@ -880,14 +880,14 @@ serviceResult = dispatcher.runSync("checkPaymentAmountForRefund", UtilMisc.toMap("returnId", returnId)); } catch (GenericServiceException e) { Debug.logError(e, "Problem running the checkPaymentAmountForRefund service", module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithCheckPaymentAmountForRefund", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithCheckPaymentAmountForRefund", locale)); } if (ServiceUtil.isError(serviceResult)) { return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult)); - } + } groupReturnItemsByOrder(returnItems, itemsByOrder, totalByOrder, delegator, returnId, "RTN_REFUND"); - + // process each one by order Set itemSet = itemsByOrder.entrySet(); Iterator itemByOrderIt = itemSet.iterator(); @@ -916,7 +916,7 @@ GenericValue refundPaymentMethod = null; GenericValue productStore = orderReadHelper.getProductStore(); if (UtilValidate.isEmpty(productStore) || UtilValidate.isEmpty(productStore.get("payToPartyId"))) { - Debug.logError("No payToPartyId found for orderId " + orderId, module); + Debug.logError("No payToPartyId found for orderId " + orderId, module); } else { GenericValue orgAcctgPref = null; Map acctgPreferencesResult = null; @@ -924,15 +924,15 @@ acctgPreferencesResult = dispatcher.runSync("getPartyAccountingPreferences", UtilMisc.toMap("organizationPartyId", productStore.get("payToPartyId"), "userLogin", userLogin)); } catch (GenericServiceException e) { Debug.logError(e, "Error retrieving PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), module); - return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithGetPartyAcctgPreferences", locale)); + return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemsWithGetPartyAcctgPreferences", locale)); } orgAcctgPref = (GenericValue) acctgPreferencesResult.get("partyAccountingPreference"); - + if (UtilValidate.isNotEmpty(orgAcctgPref)) { try { refundPaymentMethod = orgAcctgPref.getRelatedOne("PaymentMethod"); } catch ( GenericEntityException e ) { - Debug.logError("Error retrieving related refundPaymentMethod from PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), module); + Debug.logError("Error retrieving related refundPaymentMethod from PartyAcctgPreference for partyId " + productStore.get("payToPartyId"), module); } } } @@ -1064,7 +1064,7 @@ input.put("paymentMethodId", orderPaymentPreference.get("paymentMethodId")); input.put("paymentMethodTypeId", orderPaymentPreference.get("paymentMethodTypeId")); input.put("paymentPreferenceId", orderPaymentPreference.get("orderPaymentPreferenceId")); - + serviceResult = dispatcher.runSync("createPayment", input); if (ServiceUtil.isError(serviceResult) || ServiceUtil.isFailure(serviceResult)) { @@ -1105,7 +1105,7 @@ while (itemsIter.hasNext()) { GenericValue item = (GenericValue) itemsIter.next(); item.set("returnItemResponseId", responseId); - item.set("statusId", returnItemStatusId); + item.set("statusId", returnItemStatusId); // Create the status history String returnStatusId = delegator.getNextSeqId("ReturnStatus"); @@ -1129,7 +1129,7 @@ // Create the payment applications for the return invoice try { - serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", + serviceResults = dispatcher.runSync("createPaymentApplicationsFromReturnItemResponse", UtilMisc.<String, Object>toMap("returnItemResponseId", responseId, "userLogin", userLogin)); if (ServiceUtil.isError(serviceResults)) { return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemUpdatingReturnItemReturnItemResponseId", locale), null, null, serviceResults); @@ -1142,7 +1142,7 @@ // Update the amount necessary to refund amountLeftToRefund = amountLeftToRefund.subtract(amountToRefund); } - } + } } } } @@ -1181,7 +1181,7 @@ response.set("transCodeEnumId", "PGT_REFUND"); response.set("amount", refundAmount); response.set("transactionDate", UtilDateTime.nowTimestamp()); - response.set("currencyUomId", orh.getCurrency()); + response.set("currencyUomId", orh.getCurrency()); try { delegator.create(response); } catch (GenericEntityException e) { @@ -1197,7 +1197,7 @@ paymentCtx.put("partyIdFrom", payFromPartyId); paymentCtx.put("statusId", "PMNT_CONFIRMED"); paymentCtx.put("paymentPreferenceId", paymentPref.get("orderPaymentPreferenceId")); - paymentCtx.put("currencyUomId", orh.getCurrency()); + paymentCtx.put("currencyUomId", orh.getCurrency()); paymentCtx.put("amount", refundAmount); paymentCtx.put("userLogin", userLogin); paymentCtx.put("comments", "Refund"); @@ -1206,7 +1206,7 @@ try { Map paymentCreationResult = dispatcher.runSync("createPayment", paymentCtx); if (ServiceUtil.isError(paymentCreationResult)) { - return paymentCreationResult; + return paymentCreationResult; } else { paymentId = (String) paymentCreationResult.get("paymentId"); } @@ -1219,7 +1219,7 @@ } // if the original order was paid with a billing account, then go find the billing account from the order and associate this refund with that billing account - // thus returning value to the billing account + // thus returning value to the billing account if ("EXT_BILLACT".equals(paymentPref.getString("paymentMethodTypeId"))) { GenericValue billingAccount = orh.getBillingAccount(); if (UtilValidate.isNotEmpty(billingAccount.getString("billingAccountId"))) { @@ -1227,19 +1227,19 @@ Map paymentApplResult = dispatcher.runSync("createPaymentApplication", UtilMisc.<String, Object>toMap("paymentId", paymentId, "billingAccountId", billingAccount.getString("billingAccountId"), "amountApplied", refundAmount, "userLogin", userLogin)); if (ServiceUtil.isError(paymentApplResult)) { - return paymentApplResult; + return paymentApplResult; } } catch (GenericServiceException e) { return ServiceUtil.returnError("Problem creating PaymentApplication: " + e.getMessage()); } } } - + Map result = ServiceUtil.returnSuccess(); result.put("paymentId", paymentId); return result; } - + public static Map createPaymentApplicationsFromReturnItemResponse(DispatchContext dctx, Map context) { LocalDispatcher dispatcher = dctx.getDispatcher(); GenericDelegator delegator = dctx.getDelegator(); @@ -1376,20 +1376,20 @@ // create the replacement order Map orderMap = UtilMisc.toMap("userLogin", userLogin); - + String placingPartyId = null; GenericValue placingParty = null; if ("CUSTOMER_RETURN".equals(returnHeaderTypeId)) { placingParty = orh.getPlacingParty(); if (placingParty != null) { placingPartyId = placingParty.getString("partyId"); - } + } orderMap.put("orderTypeId", "SALES_ORDER"); } else { placingParty = orh.getSupplierAgent(); if (placingParty != null) { placingPartyId = placingParty.getString("partyId"); - } + } orderMap.put("orderTypeId", "PURCHASE_ORDER"); } orderMap.put("partyId", placingPartyId); @@ -1499,7 +1499,7 @@ } } } - + GenericValue newItem = delegator.makeValue("OrderItem", UtilMisc.toMap("orderItemSeqId", UtilFormatOut.formatPaddedNumber(itemCount++, 5))); if (UtilValidate.isEmpty(refurbItem)) { newItem.set("productId", orderItem.get("productId")); @@ -1521,7 +1521,7 @@ orderItems.add(newItem); // Set the order item ship group information - // TODO: only the first ship group associated to the item + // TODO: only the first ship group associated to the item // of the original order is considered and cloned, // anIs there a better way to handle this?d the returned units are assigned to it. // @@ -1591,7 +1591,7 @@ priceContext.put("productStoreId", orderHeader.get("productStoreId")); // TODO: prodCatalogId, agreementId priceContext.put("productPricePurposeId", "PURCHASE"); - priceContext.put("checkIncludeVat", "Y"); + priceContext.put("checkIncludeVat", "Y"); Map priceResult = null; try { priceResult = dispatcher.runSync("calculateProductPrice", priceContext); @@ -1740,7 +1740,7 @@ // since there is no payments required; order is ready for processing/shipment if (createdOrderId != null) { OrderChangeHelper.approveOrder(dispatcher, userLogin, createdOrderId); - + // create a ReturnItemResponse and attach to each ReturnItem Map itemResponse = FastMap.newInstance(); itemResponse.put("replacementOrderId", createdOrderId); @@ -1758,7 +1758,7 @@ Debug.logError(e, "Problem creating ReturnItemResponse record", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error,"OrderProblemCreatingReturnItemResponseRecord", locale)); } - + Iterator updateReturnItemIter = returnItemList.iterator(); while (updateReturnItemIter.hasNext()) { GenericValue returnItem = (GenericValue) updateReturnItemIter.next(); @@ -1857,7 +1857,7 @@ } /** - * Takes a List of returnItems and returns a Map of orderId -> items and a Map of orderId -> orderTotal + * Takes a List of returnItems and returns a Map of orderId -> items and a Map of orderId -> orderTotal * @param returnItems * @param itemsByOrder * @param totalByOrder @@ -1907,12 +1907,12 @@ } } } - + // 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)) { Iterator orderIterator = totalByOrder.keySet().iterator(); while (orderIterator.hasNext()) { - String orderId = (String) orderIterator.next(); + String orderId = (String) orderIterator.next(); // find returnAdjustment for returnHeader Map condition = UtilMisc.toMap("returnId", returnId, "returnItemSeqId", org.ofbiz.common.DataModelConstants.SEQ_ID_NA, @@ -1923,7 +1923,7 @@ } } - + public static Map getReturnAmountByOrder(DispatchContext dctx, Map context) { GenericDelegator delegator = dctx.getDelegator(); String returnId = (String) context.get("returnId"); @@ -1932,7 +1932,7 @@ Map returnAmountByOrder = new HashMap(); try { returnItems = delegator.findByAnd("ReturnItem", UtilMisc.toMap("returnId", returnId)); - + } catch (GenericEntityException e) { Debug.logError(e, "Problems looking up return information", module); return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "OrderErrorGettingReturnHeaderItemInformation", locale)); @@ -2016,18 +2016,18 @@ String orderAdjustmentId = (String) context.get("orderAdjustmentId"); String returnAdjustmentTypeId = (String) context.get("returnAdjustmentTypeId"); String returnId = (String) context.get("returnId"); - String returnItemSeqId = (String) context.get("returnItemSeqId"); + String returnItemSeqId = (String) context.get("returnItemSeqId"); String description = (String) context.get("description"); - + GenericValue returnItemTypeMap = null; GenericValue orderAdjustment = null; GenericValue returnAdjustmentType = null; GenericValue orderItem = null; GenericValue returnItem = null; GenericValue returnHeader = null; - + BigDecimal amount; - + // if orderAdjustment is not empty, then copy most return adjustment information from orderAdjustment's if (orderAdjustmentId != null) { try { @@ -2069,7 +2069,7 @@ context.putAll(orderAdjustment.getAllFields()); } - // if orderAdjustmentTypeId is empty, ie not found from orderAdjustmentId, then try to get returnAdjustmentTypeId from returnItemTypeMap, + // if orderAdjustmentTypeId is empty, ie not found from orderAdjustmentId, then try to get returnAdjustmentTypeId from returnItemTypeMap, // if still empty, use default RET_MAN_ADJ if (returnAdjustmentTypeId == null) { String mappingTypeId = returnItemTypeMap != null ? returnItemTypeMap.get("returnItemTypeId").toString() : null; @@ -2084,7 +2084,7 @@ return ServiceUtil.returnError("orderAdjustment [" + orderAdjustmentId + "] not found"); } BigDecimal returnTotal = returnItem.getBigDecimal("returnPrice").multiply(returnItem.getBigDecimal("returnQuantity")); - BigDecimal orderTotal = orderItem.getBigDecimal("quantity").multiply(orderItem.getBigDecimal("unitPrice")); + BigDecimal orderTotal = orderItem.getBigDecimal("quantity").multiply(orderItem.getBigDecimal("unitPrice")); amount = getAdjustmentAmount("RET_SALES_TAX_ADJ".equals(returnAdjustmentTypeId), returnTotal, orderTotal, orderAdjustment.getBigDecimal("amount")); } else { amount = (BigDecimal) context.get("amount"); @@ -2190,7 +2190,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + // used as a dispatch service, invoke different service based on the parameters passed in public static Map updateReturnItemOrAdjustment(DispatchContext dctx, Map context) { Debug.logInfo("updateReturnItemOrAdjustment's context:" + context, module); @@ -2207,7 +2207,7 @@ return ServiceUtil.returnError(e.getMessage()); } } - + /** * These return adjustment types need to be recalculated when the return item is updated * @param returnAdjustmentTypeId @@ -2248,12 +2248,12 @@ } /** - * Get rid of unnecessary parameters based on the given service name + * Get rid of unnecessary parameters based on the given service name * @param dctx Service DispatchContext - * @param serviceName + * @param serviceName * @param context context before clean up * @return filtered context - * @throws GenericServiceException + * @throws GenericServiceException */ public static Map filterServiceContext(DispatchContext dctx, String serviceName, Map context) throws GenericServiceException { ModelService modelService = dctx.getModelService(serviceName); @@ -2271,14 +2271,14 @@ Object value = context.get(paramName); if (value != null) { serviceContext.put(paramName, value); - } + } } return serviceContext; } /** * Calculate new returnAdjustment amount and set scale and rounding mode based on returnAdjustmentType: RET_SALES_TAX_ADJ use sales.tax._ and others use order._ - * @param isSalesTax if returnAdjustmentType is SaleTax + * @param isSalesTax if returnAdjustmentType is SaleTax * @param returnTotal * @param originalTotal * @param amount |
Free forum by Nabble | Edit this page |