applications/accounting/src/org/ofbiz/accounting/invoice/InvoiceServices.java
InvoiceServices
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class InvoiceServices {
private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
// set some BigDecimal properties
Method calcHeaderAdj
has 13 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static BigDecimal calcHeaderAdj(Delegator delegator, GenericValue adj, String invoiceTypeId, String invoiceId, String invoiceItemSeqId,
BigDecimal divisor, BigDecimal multiplier, BigDecimal baseAmount, int decimals, RoundingMode rounding, GenericValue userLogin, LocalDispatcher dispatcher, Locale locale) {
Avoid deeply nested control flow statements. Open
Open
if (ServiceUtil.isError(calcTaxResult)) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalcTaxService", locale));
}
Avoid deeply nested control flow statements. Open
Open
if (cardOrderPaymentPref != null) {
paymentMethodId = cardOrderPaymentPref.getString("paymentMethodId");
}
Avoid deeply nested control flow statements. Open
Open
if (shippingApplies) {
invoiceShipProRateAmount = invoiceShipProRateAmount.add(thisAdjAmount).setScale(invoiceTypeDecimals, ROUNDING);
}
Avoid deeply nested control flow statements. Open
Open
if (paymentMethodId != null) {
// Release all outstanding (not settled or cancelled) authorizations, while keeping a running
// total of their amounts so that the total plus the additional shipping charges can be authorized again
// all at once.
Avoid deeply nested control flow statements. Open
Open
if (ServiceUtil.isError(createOrderAdjustmentResult)) {
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createOrderAdjustmentResult));
}
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isEmpty(addtlChargeDescription)) {
addtlChargeDescription = UtilProperties.getMessage(resource, "AccountingAdditionalShippingChargeForShipment", UtilMisc.toMap("shipmentId", shipmentId), locale);
}
Avoid deeply nested control flow statements. Open
Open
if (orderAdjustments != null) {
for (GenericValue orderAdjustment : orderAdjustments) {
totalAdditionalShippingCharges = totalAdditionalShippingCharges.add(orderAdjustment.getBigDecimal("amount").setScale(DECIMALS, ROUNDING));
orderAdjustment.set("orderAdjustmentId", delegator.getNextSeqId("OrderAdjustment"));
orderAdjustment.set("orderId", orderId);
Avoid deeply nested control flow statements. Open
Open
if (UtilValidate.isNotEmpty(productPromo.getString("overrideOrgPartyId"))) {
createInvoiceItemAdjContext.put("overrideOrgPartyId", productPromo.getString("overrideOrgPartyId"));
}
Avoid deeply nested control flow statements. Open
Open
if (isNonPhysicalItemToReturn) {
if (UtilValidate.isEmpty(billItems)) {
billItems = new ArrayList<>();
}
Avoid deeply nested control flow statements. Open
Open
for (Map<String, Object> commissionMap : itemCommissions) {
commissionMap.put("invoice", invoice);
commissionMap.put("appliedFraction", appliedFraction);
if (!billFromVendorInvoiceRoles.contains(commissionMap.get("partyIdFrom")) || !salesRepPartyIds.contains(commissionMap.get("partyIdTo"))) {
continue;
Avoid deeply nested control flow statements. Open
Open
if ("SALES_TAX".equals(adj.getString("orderAdjustmentTypeId"))) {
amount = amount.setScale(TAX_DECIMALS, TAX_ROUNDING);
} else {
amount = amount.setScale(invoiceTypeDecimals, ROUNDING);
}
Avoid deeply nested control flow statements. Open
Open
if ("ShipmentReceipt".equals(issue.getEntityName())) {
issue.set("quantityAccepted", billAvail);
} else {
issue.set("quantity", billAvail);
}
Avoid deeply nested control flow statements. Open
Open
if (shipment.get("additionalShippingCharge") == null) {
continue;
}
Method createInvoiceTerms
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static void createInvoiceTerms(Delegator delegator, LocalDispatcher dispatcher, String invoiceId, List<GenericValue> terms, GenericValue userLogin, Locale locale) {
Avoid deeply nested control flow statements. Open
Open
for (GenericValue oib : billed) {
BigDecimal qty = oib.getBigDecimal("quantity");
if (qty != null) {
billedQuantity = billedQuantity.add(qty).setScale(DECIMALS, ROUNDING);
}
Avoid deeply nested control flow statements. Open
Open
if (!returnItemBillings.isEmpty()) {
GenericValue invoice = EntityUtil.getFirst(returnItemBillings).getRelatedOne("Invoice", false);
if ("INVOICE_CANCELLED".equals(invoice.getString("statusId"))) {
isNonPhysicalItemToReturn = true;
}
Method getInvoiceItemType
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
private static String getInvoiceItemType(Delegator delegator, String key1, String key2, String invoiceTypeId, String defaultValue) {
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createPayApplResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemGettingOrderPaymentPreferences", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return adjAmount;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceFromOrder", locale), null, null, setInvoiceStatusResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateInvoicesFromShipmentsService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingAuthOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceFromOrder", locale), null, null, createInvoiceRoleResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resultMap));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemLookingUpOrderItemBilling",
UtilMisc.toMap("billFields", billFields), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errMsg);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceRoleFromOrder", locale), null, null, createInvoiceRoleResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingOrderItemBillingFromOrder", locale), null, null, createOrderItemBillingResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingIllegalValuesPassedToCreateInvoiceService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingEntityDataProblemCreatingInvoiceFromOrderItems",
UtilMisc.toMap("reason", e.toString()), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemStoringOrderAdjustments",
UtilMisc.toMap("orderAdjustments", orderAdjustments), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
Avoid too many return
statements within this method. Open
Open
return storePaymentApplication(delegator, paymentApplication,locale);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingOrderAdjustmentBillingFromOrder", locale), null, null, createOrderAdjustmentBillingContext);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingServiceOtherProblemCreatingInvoiceFromOrderItems",
UtilMisc.toMap("reason", e.toString()), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateInvoicesFromShipmentService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalcTaxService", locale));
Avoid too many return
statements within this method. Open
Open
return response;
Avoid too many return
statements within this method. Open
Open
return adjAmount;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource,
"AccountingNoKnownInvoiceItemTypeReturnAdjustmentType",
UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemChangingInvoiceStatusTo",
UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionErrorItem", locale), null, null, resMap);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return storePaymentApplication(delegator, paymentApplication,locale);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createBillToContactMechResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceContactMechFromOrder", locale), null, null, createPayToContactMechResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemAdjResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionEntityDataProblem",
UtilMisc.toMap("reason", e.toString()), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemLookingUpOrderItemBilling",
UtilMisc.toMap("billFields", billFields), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateInvoiceForOrderService", locale));
Avoid too many return
statements within this method. Open
Open
return adjAmount; }
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemGettingShipmentItemBilling", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateInvoiceForOrderService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMsg + e.getMessage());
Avoid too many return
statements within this method. Open
Open
return adjAmount;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingErrorCreatingInvoiceItemFromOrder", locale), null, null, createInvoiceItemResult);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(createOrderAdjustmentResult));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingReleaseOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(serviceResults));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemChangingInvoiceStatusTo",
UtilMisc.toMap("newStatus", "INVOICE_PAID"), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return storePaymentApplication(delegator, paymentApplication,locale);
Avoid too many return
statements within this method. Open
Open
return response;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return resp;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(ServiceUtil.getErrorMessage(resMap));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateOrderPaymentPreferenceService", locale));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalculateInvoicedAdjustmentTotalService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionError", locale), null, null, null);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCreateOrderAdjustmentService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMsg + e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess(successMessage);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingInvoiceCommissionError", locale), null, null, null);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingProblemGettingOrderItemOrderItemBilling",
UtilMisc.toMap("lookup", lookup), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(UtilProperties.getMessage(resource,
"AccountingTroubleCallingCalcTaxService", locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMsg + UtilProperties.getMessage(resource,
"AccountingNoKnownInvoiceItemTypeReturnAdjustmentType",
UtilMisc.toMap("returnAdjustmentTypeId", adjustment.getString("returnAdjustmentTypeId")), locale));
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errorMessageList);
Avoid too many return
statements within this method. Open
Open
return adjAmount;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return results;
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(errMsgs);
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnError(e.getMessage());