You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ofbiz.apache.org by jl...@apache.org on 2017/12/08 05:26:28 UTC
svn commit: r1817456 - in /ofbiz/ofbiz-framework/trunk/applications:
accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/
accounting/src/main/java/org/apache/ofbiz/accounting/invoice/
accounting/src/main/java/org/apache/ofbiz/accounting/led...
Author: jleroux
Date: Fri Dec 8 05:26:28 2017
New Revision: 1817456
URL: http://svn.apache.org/viewvc?rev=1817456&view=rev
Log:
Implemented: Accounting: Handle service response effectively
(OFBIZ-10021)
This uses return ServiceUtil.returnError() in case of ServiceUtil.isError()
jleroux: I applied the fix to GiftCertificateServices by hand
Thanks: Suraj Khurana
Modified:
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java
ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java
ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountPaymentServices.java Fri Dec 8 05:26:28 2017
@@ -75,7 +75,10 @@ public class FinAccountPaymentServices {
Map<String, Object> input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId",
authTrans.get("referenceNum"));
try {
- dispatcher.runSync("expireFinAccountAuth", input);
+ Map<String, Object> result = dispatcher.runSync("expireFinAccountAuth", input);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
@@ -245,7 +248,7 @@ public class FinAccountPaymentServices {
"amount", amount, "thruDate", thruDate, "userLogin", userLogin));
if (ServiceUtil.isError(tmpResult)) {
- return tmpResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
}
refNum = (String) tmpResult.get("finAccountAuthId");
processResult = Boolean.TRUE;
@@ -300,17 +303,16 @@ public class FinAccountPaymentServices {
Map<String, Object> input = UtilMisc.toMap("userLogin", userLogin, "finAccountAuthId", authTransaction.get("referenceNum"));
Map<String, Object> serviceResults = dispatcher.runSync("expireFinAccountAuth", input);
+ // if there's an error, don't release
+ if (ServiceUtil.isError(serviceResults)) {
+ return ServiceUtil.returnError(err + ServiceUtil.getErrorMessage(serviceResults));
+ }
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("releaseRefNum", authTransaction.getString("referenceNum"));
result.put("releaseAmount", authTransaction.getBigDecimal("amount"));
result.put("releaseResult", Boolean.TRUE);
- // if there's an error, don't release
- if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(err + ServiceUtil.getErrorMessage(serviceResults));
- }
-
return result;
} catch (GenericServiceException e) {
Debug.logError(e, e.getMessage(), module);
@@ -397,13 +399,13 @@ public class FinAccountPaymentServices {
Map<String, Object> releaseResult;
try {
releaseResult = dispatcher.runSync("expireFinAccountAuth", UtilMisc.<String, Object>toMap("userLogin", userLogin, "finAccountAuthId", finAccountAuthId));
+ if (ServiceUtil.isError(releaseResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(releaseResult));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
}
- if (ServiceUtil.isError(releaseResult)) {
- return releaseResult;
- }
// build the withdraw context
Map<String, Object> withdrawCtx = new HashMap<String, Object>();
@@ -426,7 +428,7 @@ public class FinAccountPaymentServices {
return ServiceUtil.returnError(e.getMessage());
}
if (ServiceUtil.isError(withdrawResp)) {
- return withdrawResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(withdrawResp));
}
// create the capture response
@@ -499,7 +501,7 @@ public class FinAccountPaymentServices {
return ServiceUtil.returnError(e.getMessage());
}
if (ServiceUtil.isError(depositResp)) {
- return depositResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depositResp));
}
// create the refund response
@@ -860,7 +862,7 @@ public class FinAccountPaymentServices {
return ServiceUtil.returnError(e.getMessage());
}
if (ServiceUtil.isError(replResp)) {
- return replResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(replResp));
}
String orderId = (String) replResp.get("orderId");
@@ -878,7 +880,7 @@ public class FinAccountPaymentServices {
try {
Map<String, Object> depositResp = dispatcher.runSync("finAccountDeposit", depositCtx);
if (ServiceUtil.isError(depositResp)) {
- return depositResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depositResp));
}
} catch (GenericServiceException e) {
Debug.logError(e, module);
@@ -890,7 +892,7 @@ public class FinAccountPaymentServices {
try {
Map<String, Object> ufaResp = dispatcher.runSync("updateFinAccount", UtilMisc.<String, Object>toMap("finAccountId", finAccountId, "statusId", "FNACT_ACTIVE", "userLogin", userLogin));
if (ServiceUtil.isError(ufaResp)) {
- return ufaResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(ufaResp));
}
} catch (GenericServiceException e) {
Debug.logError(e, module);
@@ -990,6 +992,9 @@ public class FinAccountPaymentServices {
Map<String, Object> payResult;
try {
payResult = dispatcher.runSync("createPayment", paymentCtx);
+ if (ServiceUtil.isError(payResult)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(payResult));
+ }
} catch (GenericServiceException e) {
throw new GeneralException(e);
}
@@ -1015,6 +1020,9 @@ public class FinAccountPaymentServices {
Map<String, Object> transResult;
try {
transResult = dispatcher.runSync("createFinAccountTrans", transCtx);
+ if (ServiceUtil.isError(transResult)) {
+ throw new GeneralException(ServiceUtil.getErrorMessage(transResult));
+ }
} catch (GenericServiceException e) {
throw new GeneralException(e);
}
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountProductServices.java Fri Dec 8 05:26:28 2017
@@ -217,7 +217,7 @@ public class FinAccountProductServices {
}
if (ServiceUtil.isError(createResp)) {
Debug.logFatal(ServiceUtil.getErrorMessage(createResp), module);
- return createResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createResp));
}
finAccountId = (String) createResp.get("finAccountId");
@@ -238,7 +238,7 @@ public class FinAccountProductServices {
}
if (ServiceUtil.isError(roleResp)) {
Debug.logFatal(ServiceUtil.getErrorMessage(roleResp), module);
- return roleResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(roleResp));
}
// create the initial deposit
@@ -262,7 +262,7 @@ public class FinAccountProductServices {
}
if (ServiceUtil.isError(depositResp)) {
Debug.logFatal(ServiceUtil.getErrorMessage(depositResp), module);
- return depositResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(depositResp));
}
Map<String, Object> result = ServiceUtil.returnSuccess();
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/finaccount/FinAccountServices.java Fri Dec 8 05:26:28 2017
@@ -118,7 +118,7 @@ public class FinAccountServices {
Map<String, Object> createAccountResult = dispatcher.runSync(createAccountServiceName, createAccountContext);
if (ServiceUtil.isError(createAccountResult) || ServiceUtil.isFailure(createAccountResult)) {
- return createAccountResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createAccountResult));
}
if (createAccountResult != null) {
@@ -140,7 +140,7 @@ public class FinAccountServices {
return ServiceUtil.returnError(e.getMessage());
}
if (ServiceUtil.isError(roleResp)) {
- return roleResp;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(roleResp));
}
finAccountId = creditAccountId; // update the finAccountId for return parameter
}
@@ -163,7 +163,7 @@ public class FinAccountServices {
Map<String, Object> creditTransResult = dispatcher.runSync("createFinAccountTrans", transactionMap);
if (ServiceUtil.isError(creditTransResult) || ServiceUtil.isFailure(creditTransResult)) {
- return creditTransResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(creditTransResult));
}
} catch (GenericEntityException|GenericServiceException ge) {
return ServiceUtil.returnError(ge.getMessage());
@@ -226,9 +226,8 @@ public class FinAccountServices {
inContext.put("currencyUomId", productStore.get("defaultCurrencyUomId"));
Map<String, Object> createResult = dispatcher.runSync("createFinAccount", inContext);
-
if (ServiceUtil.isError(createResult)) {
- return createResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createResult));
}
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("finAccountId", createResult.get("finAccountId"));
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/invoice/InvoiceServices.java Fri Dec 8 05:26:28 2017
@@ -135,6 +135,9 @@ public class InvoiceServices {
}
Map<String, Object> result = dispatcher.runSync("createInvoiceForOrder", context);
+ if (ServiceUtil.isError(result )) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
result.remove("invoiceTypeId"); //remove extra parameter
return result;
}
@@ -520,7 +523,10 @@ public class InvoiceServices {
shipmentItemBillingCtx.put("shipmentId", currentValue.get("shipmentId"));
shipmentItemBillingCtx.put("shipmentItemSeqId", currentValue.get("shipmentItemSeqId"));
shipmentItemBillingCtx.put("userLogin", userLogin);
- dispatcher.runSync("createShipmentItemBilling", shipmentItemBillingCtx);
+ Map<String, Object> result = dispatcher.runSync("createShipmentItemBilling", shipmentItemBillingCtx);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
}
}
@@ -540,6 +546,11 @@ public class InvoiceServices {
BigDecimal adjAlreadyInvoicedAmount = null;
try {
Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj));
+ if (ServiceUtil.isError(checkResult)) {
+ Debug.logError("Accounting trouble calling calculateInvoicedAdjustmentTotal service", module);
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
+ }
adjAlreadyInvoicedAmount = (BigDecimal) checkResult.get("invoicedTotal");
} catch (GenericServiceException e) {
Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", module);
@@ -722,6 +733,10 @@ public class InvoiceServices {
BigDecimal adjAlreadyInvoicedAmount = null;
try {
Map<String, Object> checkResult = dispatcher.runSync("calculateInvoicedAdjustmentTotal", UtilMisc.toMap("orderAdjustment", adj));
+ if (ServiceUtil.isError(checkResult)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
+ }
adjAlreadyInvoicedAmount = ((BigDecimal) checkResult.get("invoicedTotal")).setScale(invoiceTypeDecimals, ROUNDING);
} catch (GenericServiceException e) {
Debug.logError(e, "Accounting trouble calling calculateInvoicedAdjustmentTotal service", module);
@@ -983,6 +998,9 @@ public class InvoiceServices {
"amount", amount,
"quantity", quantity,
"userLogin", userLogin));
+ if (ServiceUtil.isError(resultMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
+ }
} catch (GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
@@ -1041,6 +1059,10 @@ public class InvoiceServices {
Map<String, Object> createInvoiceResult;
try {
createInvoiceResult = dispatcher.runSync("createInvoice", createInvoiceMap);
+ if (ServiceUtil.isError(createInvoiceResult)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingInvoiceCommissionError", locale), null, null, null);
+ }
} catch (GenericServiceException e) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionError", locale), null, null, null);
@@ -1089,7 +1111,11 @@ public class InvoiceServices {
"quantity",quantity,
"amount", elemAmount,
"userLogin", userLogin));
- dispatcher.runSync("createInvoiceItemAssoc", UtilMisc.toMap("invoiceIdFrom", invoiceIdFrom,
+ if (ServiceUtil.isError(resMap)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingInvoiceCommissionErrorItem", locale), null, null, resMap);
+ }
+ resMap = dispatcher.runSync("createInvoiceItemAssoc", UtilMisc.toMap("invoiceIdFrom", invoiceIdFrom,
"invoiceItemSeqIdFrom", invoiceItemSeqIdFrom,
"invoiceIdTo", invoiceId,
"invoiceItemSeqIdTo", resMap.get("invoiceItemSeqId"),
@@ -1099,13 +1125,12 @@ public class InvoiceServices {
"quantity", quantity,
"amount", elemAmount,
"userLogin", userLogin));
+ if (ServiceUtil.isError(resMap)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resMap));
+ }
} catch (GenericServiceException e) {
return ServiceUtil.returnError(e.getMessage());
}
- if (ServiceUtil.isError(resMap)) {
- return ServiceUtil.returnError(UtilProperties.getMessage(resource,
- "AccountingInvoiceCommissionErrorItem", locale), null, null, resMap);
- }
}
// store value objects
try {
@@ -1189,6 +1214,11 @@ public class InvoiceServices {
Map<String, Object> serviceContext = UtilMisc.toMap("shipmentIds", UtilMisc.toList(shipmentId), "eventDate", context.get("eventDate"), "userLogin", context.get("userLogin"));
try {
Map<String, Object> result = dispatcher.runSync("createInvoicesFromShipments", serviceContext);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCreateInvoicesFromShipmentService",
+ UtilMisc.toMap("shipmentId", shipmentId), locale));
+ }
invoicesCreated = UtilGenerics.checkList(result.get("invoicesCreated"));
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment [" + shipmentId + "]", module);
@@ -1304,6 +1334,11 @@ public class InvoiceServices {
Map<String, Object> serviceResult;
try {
serviceResult = dispatcher.runSync("createInvoicesFromShipments", serviceContext);
+ if (ServiceUtil.isError(serviceResult)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCreateInvoicesFromShipmentService",
+ UtilMisc.toMap("shipmentId", shipmentId), locale));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling createInvoicesFromShipment service; invoice not created for shipment " + shipmentId, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1637,6 +1672,9 @@ public class InvoiceServices {
String shippingOrderAdjustmentId = null;
try {
Map<String, Object> createOrderAdjustmentResult = dispatcher.runSync("createOrderAdjustment", createOrderAdjustmentContext);
+ if (ServiceUtil.isError(createOrderAdjustmentResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createOrderAdjustmentResult));
+ }
shippingOrderAdjustmentId = (String) createOrderAdjustmentResult.get("orderAdjustmentId");
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling createOrderAdjustment service", module);
@@ -1674,6 +1712,10 @@ public class InvoiceServices {
Map<String, Object> calcTaxResult = null;
try {
calcTaxResult = dispatcher.runSync("calcTax", calcTaxContext);
+ if (ServiceUtil.isError(calcTaxResult)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCalcTaxService", locale));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling calcTaxService", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1757,6 +1799,10 @@ public class InvoiceServices {
String orderPaymentPreferenceId = null;
try {
Map<String, Object> result = dispatcher.runSync("createOrderPaymentPreference", serviceContext);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale));
+ }
orderPaymentPreferenceId = (String) result.get("orderPaymentPreferenceId");
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling createOrderPaymentPreference service", module);
@@ -1769,6 +1815,10 @@ public class InvoiceServices {
try {
// Use an overrideAmount because the maxAmount wasn't set on the OrderPaymentPreference
authResult = dispatcher.runSync("authOrderPaymentPreference", UtilMisc.toMap("orderPaymentPreferenceId", orderPaymentPreferenceId, "overrideAmount", totalNewAuthAmount, "userLogin", context.get("userLogin")));
+ if (ServiceUtil.isError(authResult)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling authOrderPaymentPreference service", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1807,6 +1857,10 @@ public class InvoiceServices {
Map<String, Object> serviceContext = UtilMisc.toMap("orderId", orderId, "billItems", toBillItems, "invoiceId", invoiceId, "eventDate", context.get("eventDate"), "userLogin", context.get("userLogin"));
try {
Map<String, Object> result = dispatcher.runSync("createInvoiceForOrder", serviceContext);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingTroubleCallingCreateInvoiceForOrderService", locale));
+ }
invoicesCreated.add((String) result.get("invoiceId"));
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble calling createInvoiceForOrder service; invoice not created for shipment", module);
@@ -1932,7 +1986,7 @@ public class InvoiceServices {
Map<String, Object> input = UtilMisc.toMap("returnId", returnId, "billItems", billItems, "userLogin", context.get("userLogin"));
Map<String, Object> serviceResults = dispatcher.runSync("createInvoiceFromReturn", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
// put the resulting invoiceId in the return list
@@ -2023,7 +2077,7 @@ public class InvoiceServices {
// call the service to create the invoice
Map<String, Object> serviceResults = dispatcher.runSync("createInvoice", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
String invoiceId = (String) serviceResults.get("invoiceId");
@@ -2089,7 +2143,7 @@ public class InvoiceServices {
input.put("userLogin", userLogin);
serviceResults = dispatcher.runSync("createInvoiceItem", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
// copy the return item information into ReturnItemBilling
@@ -2104,7 +2158,7 @@ public class InvoiceServices {
}
serviceResults = dispatcher.runSync("createReturnItemBilling", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
if (Debug.verboseOn()) {
Debug.logVerbose("Creating Invoice Item with amount " + returnPrice + " and quantity " + quantity
@@ -2177,7 +2231,7 @@ public class InvoiceServices {
// create the invoice item
serviceResults = dispatcher.runSync("createInvoiceItem", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
// increment the seqId counter
@@ -2231,7 +2285,7 @@ public class InvoiceServices {
// create the invoice item
serviceResults = dispatcher.runSync("createInvoiceItem", input);
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
// increment the seqId counter
@@ -2242,7 +2296,7 @@ public class InvoiceServices {
// Set the invoice to READY
serviceResults = dispatcher.runSync("setInvoiceStatus", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "statusId", "INVOICE_READY", "userLogin", userLogin));
if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(errorMsg, null, null, serviceResults);
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
// return the invoiceId
@@ -2338,7 +2392,12 @@ public class InvoiceServices {
Map<String, Object> svcCtx = UtilMisc.toMap("statusId", "INVOICE_PAID", "invoiceId", invoiceId,
"paidDate", paidDate, "userLogin", userLogin);
try {
- dispatcher.runSync("setInvoiceStatus", svcCtx);
+ Map<String, Object> serviceResults = dispatcher.runSync("setInvoiceStatus", svcCtx);
+ if (ServiceUtil.isError(serviceResults)) {
+ return ServiceUtil.returnError(UtilProperties.getMessage(resource,
+ "AccountingProblemChangingInvoiceStatusTo",
+ UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Problem changing invoice status to INVOICE_PAID" + svcCtx, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -2400,7 +2459,10 @@ public class InvoiceServices {
createOrderAdjustmentBillingContext.put("userLogin", userLogin);
try {
- dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext);
+ Map<String, Object> result = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext);
+ if (ServiceUtil.isError(result)) {
+ return adjAmount;
+ }
} catch (GenericServiceException e) {
return adjAmount; }
@@ -2452,7 +2514,10 @@ public class InvoiceServices {
createOrderAdjustmentBillingContext.put("userLogin", userLogin);
try {
- dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext);
+ Map<String, Object> result = dispatcher.runSync("createOrderAdjustmentBilling", createOrderAdjustmentBillingContext);
+ if (ServiceUtil.isError(result)) {
+ return adjAmount;
+ }
} catch (GenericServiceException e) {
return adjAmount;
}
@@ -3402,11 +3467,14 @@ public class InvoiceServices {
if (UtilValidate.isEmpty(paymentApplications)) return ServiceUtil.returnSuccess();
// TODO: this is inefficient -- instead use HashSet to construct a distinct Set of invoiceIds, then iterate over it and call checkInvoicePaymentAppls
+ Map<String, Object> serviceResult = null;
for (GenericValue paymentApplication : paymentApplications) {
String invoiceId = paymentApplication.getString("invoiceId");
if (invoiceId != null) {
- Map<String, Object> serviceResult = dispatcher.runSync("checkInvoicePaymentApplications", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "userLogin", userLogin));
- if (ServiceUtil.isError(serviceResult)) return serviceResult;
+ serviceResult = dispatcher.runSync("checkInvoicePaymentApplications", UtilMisc.<String, Object>toMap("invoiceId", invoiceId, "userLogin", userLogin));
+ if (ServiceUtil.isError(serviceResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResult));
+ }
}
}
return ServiceUtil.returnSuccess();
@@ -3506,6 +3574,9 @@ public class InvoiceServices {
Map<String, Object> invoiceResult = null;
try {
invoiceResult = dispatcher.runSync("createInvoice", invoice);
+ if (ServiceUtil.isError(invoiceResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(invoiceResult));
+ }
} catch (GenericServiceException e) {
csvReader.close();
Debug.logError(e, module);
@@ -3561,7 +3632,10 @@ public class InvoiceServices {
errMsgs.addAll(newErrMsgs);
} else {
try {
- dispatcher.runSync("createInvoiceItem", invoiceItem);
+ Map<String, Object> result = dispatcher.runSync("createInvoiceItem", invoiceItem);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
} catch (GenericServiceException e) {
csvReader.close();
Debug.logError(e, module);
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/ledger/GeneralLedgerServices.java Fri Dec 8 05:26:28 2017
@@ -56,6 +56,9 @@ public class GeneralLedgerServices {
}
try {
result = dispatcher.runSync("createGlAcctCatMemFromCostCenters", createGlAcctCatMemFromCostCentersMap);
+ if (ServiceUtil.isError(result )) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result ));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(e.getMessage());
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/GiftCertificateServices.java Fri Dec 8 05:26:28 2017
@@ -110,6 +110,10 @@ public class GiftCertificateServices {
acctCtx.put("finAccountCode", pinNumber);
acctCtx.put("userLogin", userLogin);
acctResult = dispatcher.runSync("createFinAccount", acctCtx);
+ if (ServiceUtil.isError(acctResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(acctResult));
+ }
+
} else {
Map<String, Object> createAccountCtx = new HashMap<String, Object>();
createAccountCtx.put("ownerPartyId", partyId);
@@ -119,6 +123,9 @@ public class GiftCertificateServices {
createAccountCtx.put("finAccountName", accountName + "for party ["+partyId+"]");
createAccountCtx.put("userLogin", userLogin);
acctResult = dispatcher.runSync("createFinAccountForStore", createAccountCtx);
+ if (ServiceUtil.isError(acctResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(acctResult));
+ }
if (acctResult.get("finAccountId") != null) {
finAccountId = cardNumber = (String) acctResult.get("finAccountId");
}
@@ -127,11 +134,6 @@ public class GiftCertificateServices {
}
}
- if (ServiceUtil.isError(acctResult)) {
- String error = ServiceUtil.getErrorMessage(acctResult);
- return ServiceUtil.returnError(error);
- }
-
// create the initial (deposit) transaction
// do something tricky here: run as the "system" user
// that can actually create a financial account transaction
@@ -431,14 +433,14 @@ public class GiftCertificateServices {
Map<String, Object> redeemResult = null;
redeemResult = dispatcher.runSync("redeemGiftCertificate", redeemCtx);
if (ServiceUtil.isError(redeemResult)) {
- return redeemResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(redeemResult));
}
// now release the authorization should this use the gift card release service?
Map<String, Object> releaseResult = dispatcher.runSync("expireFinAccountAuth",
UtilMisc.<String, Object>toMap("userLogin", userLogin, "finAccountAuthId", finAccountAuthId));
if (ServiceUtil.isError(releaseResult)) {
- return releaseResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(releaseResult));
}
String authRefNum = authTransaction.getString("referenceNum");
@@ -546,7 +548,7 @@ public class GiftCertificateServices {
"amount", amount, "currencyUomId", currency,
"thruDate", thruDate, "userLogin", userLogin));
if (ServiceUtil.isError(tmpResult)) {
- return tmpResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
} else {
refNum = (String) tmpResult.get("finAccountAuthId");
processResult = Boolean.TRUE;
@@ -606,17 +608,15 @@ public class GiftCertificateServices {
Map<String, Object> input = UtilMisc.<String, Object>toMap("userLogin", userLogin,
"finAccountAuthId", authTransaction.get("referenceNum"));
Map<String, Object> serviceResults = dispatcher.runSync("expireFinAccountAuth", input);
+ if (ServiceUtil.isError(serviceResults)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
+ }
Map<String, Object> result = ServiceUtil.returnSuccess();
result.put("releaseRefNum", authTransaction.getString("referenceNum"));
result.put("releaseAmount", authTransaction.getBigDecimal("amount"));
result.put("releaseResult", Boolean.TRUE);
- // if there's an error, don't release
- if (ServiceUtil.isError(serviceResults)) {
- return ServiceUtil.returnError(err + ServiceUtil.getErrorMessage(serviceResults));
- }
-
return result;
} catch (GenericServiceException e) {
Debug.logError(e, e.getMessage(), module);
@@ -928,7 +928,10 @@ public class GiftCertificateServices {
// SC 20060405: Changed to runSync because runAsync kept getting an error:
// Problem serializing service attributes (Cannot serialize object of class java.util.PropertyResourceBundle)
try {
- dispatcher.runAsync("sendMailFromScreen", emailCtx);
+ Map<String, Object> serviceResults = dispatcher.runSync("sendMailFromScreen", emailCtx);
+ if (ServiceUtil.isError(serviceResults)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Problem sending mail", module);
// this is fatal; we will rollback and try again later
@@ -1219,6 +1222,9 @@ public class GiftCertificateServices {
try {
returnableInfo = dispatcher.runSync("getReturnableQuantity", UtilMisc.toMap("orderItem", orderItem,
"userLogin", userLogin));
+ if (ServiceUtil.isError(returnableInfo)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(returnableInfo));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resourceOrderError,
Modified: ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/accounting/src/main/java/org/apache/ofbiz/accounting/payment/PaymentGatewayServices.java Fri Dec 8 05:26:28 2017
@@ -388,6 +388,9 @@ public class PaymentGatewayServices {
Map<String, Object> results = null;
try {
results = dispatcher.runSync("authOrderPaymentPreference", authContext);
+ if (ServiceUtil.isError(results)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(results));
+ }
} catch (GenericServiceException se) {
Debug.logError(se, "Error in calling authOrderPaymentPreference from authOrderPayments", module);
hadError += 1;
@@ -546,6 +549,9 @@ public class PaymentGatewayServices {
// if we are not trying other expire dates OR if we are and the date is after today, then run the service
if (!tryOtherExpDates || UtilValidate.isDateAfterToday(creditCard.getString("expireDate"))) {
processorResult = dispatcher.runSync(serviceName, processContext, TX_TIME, true);
+ if (ServiceUtil.isError(processorResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(processorResult));
+ }
}
// try other expire dates if the expireDate is not after today, or if we called the auth service and resultBadExpire = true
@@ -562,24 +568,33 @@ public class PaymentGatewayServices {
creditCard.set("expireDate", month + "/" + year);
// don't need to set back in the processContext, it's already there: processContext.put("creditCard", creditCard);
processorResult = dispatcher.runSync(serviceName, processContext, TX_TIME, true);
+ if (ServiceUtil.isError(processorResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(processorResult));
+ }
// note that these additional tries will only be done if the service return is not an error, in that case we let it pass through to the normal error handling
- if (!ServiceUtil.isError(processorResult) && Boolean.TRUE.equals(processorResult.get("resultBadExpire"))) {
+ if (ServiceUtil.isSuccess(processorResult) && Boolean.TRUE.equals(processorResult.get("resultBadExpire"))) {
// okay, try one more year...
year = StringUtil.addToNumberString(year, 1);
creditCard.set("expireDate", month + "/" + year);
processorResult = dispatcher.runSync(serviceName, processContext, TX_TIME, true);
+ if (ServiceUtil.isError(processorResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(processorResult));
+ }
}
- if (!ServiceUtil.isError(processorResult) && Boolean.TRUE.equals(processorResult.get("resultBadExpire"))) {
+ if (ServiceUtil.isSuccess(processorResult) && Boolean.TRUE.equals(processorResult.get("resultBadExpire"))) {
// okay, try one more year... and this is the last try
year = StringUtil.addToNumberString(year, 1);
creditCard.set("expireDate", month + "/" + year);
processorResult = dispatcher.runSync(serviceName, processContext, TX_TIME, true);
+ if (ServiceUtil.isError(processorResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(processorResult));
+ }
}
// at this point if we have a successful result, let's save the new creditCard expireDate
- if (!ServiceUtil.isError(processorResult) && Boolean.TRUE.equals(processorResult.get("authResult"))) {
+ if (ServiceUtil.isSuccess(processorResult) && Boolean.TRUE.equals(processorResult.get("authResult"))) {
// TODO: this is bad; we should be expiring the old card and creating a new one instead of editing it
creditCard.store();
}
@@ -965,7 +980,7 @@ public class PaymentGatewayServices {
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale));
}
// get the release result code
- if (releaseResult != null && !ServiceUtil.isError(releaseResult)) {
+ if (releaseResult != null && ServiceUtil.isSuccess(releaseResult)) {
Map<String, Object> releaseResRes;
try {
ModelService model = dctx.getModelService("processReleaseResult");
@@ -1147,7 +1162,11 @@ public class PaymentGatewayServices {
serviceContext.put("billingAccountId", billingAccountId);
}
try {
- return dispatcher.runSync("captureOrderPayments", serviceContext);
+ Map<String, Object> result = dispatcher.runSync("captureOrderPayments", serviceContext);
+ if (ServiceUtil.isError(result)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(result));
+ }
+ return result;
} catch (GenericServiceException e) {
Debug.logError(e, "Trouble running captureOrderPayments service", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1247,7 +1266,7 @@ public class PaymentGatewayServices {
"orderId", orderId,
"userLogin", userLogin));
if (ServiceUtil.isError(captureResult)) {
- return captureResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(captureResult));
}
} catch (GenericServiceException ex) {
return ServiceUtil.returnError(ex.getMessage());
@@ -1352,7 +1371,7 @@ public class PaymentGatewayServices {
}
Map<String, Object> captureResult = capturePayment(dctx, userLogin, orh, paymentPref, amountThisCapture, locale);
- if (captureResult != null && !ServiceUtil.isError(captureResult)) {
+ if (captureResult != null && ServiceUtil.isSuccess(captureResult)) {
// credit card processors return captureAmount, but gift certificate processors return processAmount
BigDecimal amountCaptured = (BigDecimal) captureResult.get("captureAmount");
if (amountCaptured == null) {
@@ -1511,14 +1530,14 @@ public class PaymentGatewayServices {
paymentParams.put("userLogin", userLogin);
Map<String, Object> tmpResult = dispatcher.runSync("createPayment", paymentParams);
if (ServiceUtil.isError(tmpResult)) {
- return tmpResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
}
String paymentId = (String) tmpResult.get("paymentId");
tmpResult = dispatcher.runSync("createPaymentApplication", UtilMisc.<String, Object>toMap("paymentId", paymentId, "invoiceId", invoiceId, "billingAccountId", billingAccountId,
"amountApplied", captureAmount, "userLogin", userLogin));
if (ServiceUtil.isError(tmpResult)) {
- return tmpResult;
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(tmpResult));
}
if (paymentId == null) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -1760,6 +1779,9 @@ public class PaymentGatewayServices {
// NOTE HOW TO FIX: don't call in separate transaction from here; individual services can have require-new-transaction
//set to true if they want to behave that way (had: [, TX_TIME, true])
captureResult = dispatcher.runSync(serviceName, captureContext);
+ if (ServiceUtil.isError(captureResult)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(captureResult));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Could not capture payment ... serviceName: " + serviceName + " ... context: " + captureContext, module);
return null;
@@ -2394,6 +2416,9 @@ public class PaymentGatewayServices {
serviceContext.put("refundAmount", amount);
serviceContext.put("userLogin", userLogin);
refundResponse = dispatcher.runSync("refundPayment", serviceContext, TX_TIME, true);
+ if (ServiceUtil.isError(refundResponse)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(refundResponse));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, "Problem refunding payment through processor", module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -2499,6 +2524,9 @@ public class PaymentGatewayServices {
refundResCtx.put("refundAmount", refundResponse.get("refundAmount"));
}
refundResRes = dispatcher.runSync(model.name, refundResCtx);
+ if (ServiceUtil.isError(refundResRes)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(refundResRes));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -2597,7 +2625,7 @@ public class PaymentGatewayServices {
String paymentId = null;
try {
Map<String, Object> payRes = dispatcher.runSync("createPayment", paymentCtx);
- if (ModelService.RESPOND_ERROR.equals(payRes.get(ModelService.RESPONSE_MESSAGE))) {
+ if (ServiceUtil.isError(payRes)) {
return ServiceUtil.returnError((String) payRes.get(ModelService.ERROR_MESSAGE));
} else {
paymentId = (String) payRes.get("paymentId");
@@ -3239,6 +3267,9 @@ public class PaymentGatewayServices {
Map<String, Object> response = null;
try {
response = dispatcher.runSync(paymentService, requestContext, TX_TIME, true);
+ if (ServiceUtil.isError(response)) {
+ return ServiceUtil.returnError(ServiceUtil.getErrorMessage(response));
+ }
} catch (GenericServiceException e) {
Debug.logError(e, module);
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
@@ -3247,7 +3278,7 @@ public class PaymentGatewayServices {
locale));
}
// get the response result code
- if (response != null && !ServiceUtil.isError(response)) {
+ if (response != null && ServiceUtil.isSuccess(response)) {
Map<String, Object> responseRes;
try {
ModelService model = dctx.getModelService("processCreditResult");
Modified: ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/manufacturing/src/main/java/org/apache/ofbiz/manufacturing/jobshopmgt/ProductionRunServices.java Fri Dec 8 05:26:28 2017
@@ -1653,7 +1653,7 @@ public class ProductionRunServices {
Map<String, Object> createLotCtx = ctx.makeValidContext("createLot", ModelService.IN_PARAM, context);
createLotCtx.put("creationDate", UtilDateTime.nowTimestamp());
Map<String, Object> serviceResults = dispatcher.runSync("createLot", createLotCtx);
- if (!ServiceUtil.isSuccess(serviceResults)) {
+ if (ServiceUtil.isError(serviceResults)) {
Debug.logError(ServiceUtil.getErrorMessage(serviceResults), module);
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
}
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/order/OrderServices.java Fri Dec 8 05:26:28 2017
@@ -2687,7 +2687,7 @@ public class OrderServices {
}
// check for errors
- if (sendResp != null && !ServiceUtil.isError(sendResp)) {
+ if (sendResp != null && ServiceUtil.isSuccess(sendResp)) {
sendResp.put("emailType", emailType);
}
if (UtilValidate.isNotEmpty(orderId)) {
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/quote/QuoteServices.java Fri Dec 8 05:26:28 2017
@@ -135,7 +135,7 @@ public class QuoteServices {
}
// check for errors
- if (sendResp != null && !ServiceUtil.isError(sendResp)) {
+ if (sendResp != null && ServiceUtil.isSuccess(sendResp)) {
sendResp.put("emailType", emailType);
}
return sendResp;
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/ShoppingCartEvents.java Fri Dec 8 05:26:28 2017
@@ -1412,7 +1412,7 @@ public class ShoppingCartEvents {
UtilMisc.<String, Object>toMap("quoteId", quoteId,
"applyQuoteAdjustments", "true",
"userLogin", userLogin));
- if (!ServiceUtil.isSuccess(outMap)) {
+ if (ServiceUtil.isError(outMap)) {
request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(outMap));
return "error";
}
@@ -1451,7 +1451,7 @@ public class ShoppingCartEvents {
UtilMisc.<String, Object>toMap("orderId", orderId, "createAsNewOrder", createAsNewOrder,
"skipProductChecks", Boolean.TRUE, // the products have already been checked in the order, no need to check their validity again
"userLogin", userLogin));
- if (!ServiceUtil.isSuccess(outMap)) {
+ if (ServiceUtil.isError(outMap)) {
request.setAttribute("_ERROR_MESSAGE_", ServiceUtil.getErrorMessage(outMap));
return "error";
}
Modified: ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/order/src/main/java/org/apache/ofbiz/order/shoppingcart/shipping/ShippingEstimateWrapper.java Fri Dec 8 05:26:28 2017
@@ -115,7 +115,7 @@ public class ShippingEstimateWrapper {
shippingMethodTypeId, carrierPartyId, carrierRoleTypeId, shippingCmId, productStoreId,
supplierPartyId, shippableItemInfo, shippableWeight, shippableQuantity, shippableTotal, partyId, productStoreShipMethId, totalAllowance);
- if (!ServiceUtil.isError(estimateMap)) {
+ if (ServiceUtil.isSuccess(estimateMap)) {
BigDecimal shippingTotal = (BigDecimal) estimateMap.get("shippingTotal");
shippingEstimates.put(shipMethod, shippingTotal);
}
Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/FindFacilityPhysicalInventory.groovy Fri Dec 8 05:26:28 2017
@@ -53,7 +53,7 @@ if (conditions.size() > 2) {
// for each product, call the inventory counting service
productIds.each { productId ->
result = runService('getInventoryAvailableByFacility', [facilityId : facilityId, productId : productId])
- if (!ServiceUtil.isError(result)) {
+ if (ServiceUtil.isSuccess(result)) {
atpMap.put(productId, result.availableToPromiseTotal)
qohMap.put(productId, result.quantityOnHandTotal)
}
Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/inventory/ReceiveInventory.groovy Fri Dec 8 05:26:28 2017
@@ -42,7 +42,7 @@ if (facility) {
owner = facility.getRelatedOne("OwnerParty", false)
if (owner) {
result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")])
- if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
+ if (ServiceUtil.isSuccess(result) && result.partyAccountingPreference) {
ownerAcctgPref = result.partyAccountingPreference
}
}
@@ -228,7 +228,7 @@ if (ownerAcctgPref) {
if (productId) {
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
- if (!ServiceUtil.isError(result)) {
+ if (ServiceUtil.isSuccess(result)) {
standardCosts.put(productId, result.productCost)
}
}
@@ -239,7 +239,7 @@ if (ownerAcctgPref) {
if (productId) {
result = runService('getProductCost', [productId : productId, currencyUomId : ownerAcctgPref.baseCurrencyUomId,
costComponentTypePrefix : 'EST_STD', userLogin : request.getAttribute("userLogin")])
- if (!ServiceUtil.isError(result)) {
+ if (ServiceUtil.isSuccess(result)) {
standardCosts.put(productId, result.productCost)
}
}
Modified: ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/groovyScripts/facility/shipment/ReceiveInventoryAgainstPurchaseOrder.groovy Fri Dec 8 05:26:28 2017
@@ -90,7 +90,7 @@ if (facility) {
owner = facility.getRelatedOne("OwnerParty", false)
if (owner) {
result = runService('getPartyAccountingPreferences', [organizationPartyId : owner.partyId, userLogin : request.getAttribute("userLogin")])
- if (!ServiceUtil.isError(result) && result.partyAccountingPreference) {
+ if (ServiceUtil.isSuccess(result) && result.partyAccountingPreference) {
ownerAcctgPref = result.partyAccountingPreference
}
}
@@ -158,7 +158,7 @@ orderItems.each { orderItemAndShipGroupA
if (baseCurrencyUomId && orderHeader.currencyUom) {
if (product) {
result = runService('convertUom', [uomId : orderHeader.currencyUom, uomIdTo : baseCurrencyUomId, originalValue : orderItem.unitPrice])
- if (!ServiceUtil.isError(result)) {
+ if (ServiceUtil.isSuccess(result)) {
orderItem.unitPrice = result.convertedValue
}
}
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/inventory/InventoryServices.java Fri Dec 8 05:26:28 2017
@@ -813,13 +813,13 @@ public class InventoryServices {
}
// add the results for this facility to the ATP/QOH counter for all facilities
- if (!ServiceUtil.isError(invResult)) {
+ if (ServiceUtil.isSuccess(invResult)) {
BigDecimal fatp = (BigDecimal) invResult.get("availableToPromiseTotal");
BigDecimal fqoh = (BigDecimal) invResult.get("quantityOnHandTotal");
if (fatp != null) atp = atp.add(fatp);
if (fqoh != null) qoh = qoh.add(fqoh);
}
- if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG") && !ServiceUtil.isError(mktgPkgInvResult)) {
+ if (EntityTypeUtil.hasParentType(delegator, "ProductType", "productTypeId", product.getString("productTypeId"), "parentTypeId", "MARKETING_PKG") && ServiceUtil.isSuccess(mktgPkgInvResult)) {
BigDecimal fatp = (BigDecimal) mktgPkgInvResult.get("availableToPromiseTotal");
BigDecimal fqoh = (BigDecimal) mktgPkgInvResult.get("quantityOnHandTotal");
if (fatp != null) mktgPkgAtp = mktgPkgAtp.add(fatp);
Modified: ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java
URL: http://svn.apache.org/viewvc/ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java?rev=1817456&r1=1817455&r2=1817456&view=diff
==============================================================================
--- ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java (original)
+++ ofbiz/ofbiz-framework/trunk/applications/product/src/main/java/org/apache/ofbiz/product/price/PriceServices.java Fri Dec 8 05:26:28 2017
@@ -358,7 +358,7 @@ public class PriceServices {
}
try {
Map<String, Object> outMap = dispatcher.runSync(customMethod.getString("customMethodName"), inMap);
- if (!ServiceUtil.isError(outMap)) {
+ if (ServiceUtil.isSuccess(outMap)) {
BigDecimal calculatedDefaultPrice = (BigDecimal)outMap.get("price");
orderItemPriceInfos = UtilGenerics.checkList(outMap.get("orderItemPriceInfos"));
if (UtilValidate.isNotEmpty(calculatedDefaultPrice)) {