applications/order/src/org/ofbiz/order/shoppingcart/ShoppingCartHelper.java
Method addToCart
has 21 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
String productCategoryId, String itemType, String itemDescription,
BigDecimal price, BigDecimal amount, BigDecimal quantity,
java.sql.Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons, String accommodationMapId,String accommodationSpotId,
java.sql.Timestamp shipBeforeDate, java.sql.Timestamp shipAfterDate,
Method addToCart
has 19 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> addToCart(String catalogId, String shoppingListId, String shoppingListItemSeqId, String productId,
String productCategoryId, String itemType, String itemDescription,
BigDecimal price, BigDecimal amount, BigDecimal quantity,
java.sql.Timestamp reservStart, BigDecimal reservLength, BigDecimal reservPersons,
java.sql.Timestamp shipBeforeDate, java.sql.Timestamp shipAfterDate,
ShoppingCartHelper
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
public class ShoppingCartHelper {
public static final String resource = "OrderUiLabels";
private static final Debug.OfbizLogger module = Debug.getOfbizLogger(java.lang.invoke.MethodHandles.lookup().lookupClass());
public static final String resource_error = "OrderErrorUiLabels";
Avoid deeply nested control flow statements. Open
Open
if(originalProduct != null){
BigDecimal piecesIncluded = new BigDecimal(originalProduct.getLong("piecesIncluded"));
quantity = quantity.multiply(piecesIncluded);
}
Avoid deeply nested control flow statements. Open
Open
if (requirementAlreadyInCart) {
if (Debug.warningOn()) {
Debug.logWarning(UtilProperties.getMessage(resource_error, "OrderTheRequirementIsAlreadyInTheCartNotAdding", UtilMisc.toMap("requirementId",requirementId), Debug.getLogLocale()), module); // SCIPIO: log locale
}
continue;
Avoid deeply nested control flow statements. Open
Open
if (security.hasEntityPermission("ORDERMGR", "_CREATE", userLogin)) {
if (item != null) {
item.setBasePrice(quantity); // this is quantity because the parsed number variable is the same as quantity
item.setDisplayPrice(quantity); // or the amount shown the cart items page won't be right
item.setIsModifiedPrice(true); // flag as a modified price
Avoid deeply nested control flow statements. Open
Open
if (remainder.compareTo(BigDecimal.ZERO) != 0) {
return ServiceUtil.returnError(UtilProperties.getMessage(resource_error, "cart.addToCart.quantityInDecimalNotAllowed", this.cart.getLocale()));
}
Avoid deeply nested control flow statements. Open
Open
if (quantString.length() > 2) { // the length of the prefix
String featureTypeId = this.getRemoveFeatureTypeId(parameterName);
if (featureTypeId != null) {
item.removeAdditionalProductFeatureAndAppl(featureTypeId);
}
Avoid deeply nested control flow statements. Open
Open
if (supplierProduct == null) {
if ("_NA_".equals(cart.getPartyId())) {
// no supplier does not require the supplier product
item.setQuantity(quantity, dispatcher, this.cart);
item.setName(item.getProduct().getString("internalName"));
Method modifyCart
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> modifyCart(Security security, GenericValue userLogin, Map<String, ? extends Object> context, boolean removeSelected, String[] selectedItems, Locale locale) {
Avoid deeply nested control flow statements. Open
Open
if (Debug.verboseOn()) {
Debug.logVerbose("Bulk Adding to cart requirement [" + quantity + "] of [" + productId + "]", module);
}
Avoid deeply nested control flow statements. Open
Open
if (security.hasEntityPermission("ORDERMGR", "_CREATE", userLogin)) {
if (item != null) {
item.setName(itemDescription);
}
}
Avoid deeply nested control flow statements. Open
Open
while (items.hasNext() && !requirementAlreadyInCart) {
ShoppingCartItem sci = items.next();
if (sci.getRequirementId() != null && sci.getRequirementId().equals(requirementId)) {
requirementAlreadyInCart = true;
continue;
Method addToCartFromOrder
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
Open
public Map<String, Object> addToCartFromOrder(String catalogId, String orderId, String[] itemIds, boolean addAll, String itemGroupNumber) {
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_error, "OrderErrorOnCartUpdate", this.cart.getLocale())); // SCIPIO
Avoid too many return
statements within this method. Open
Open
return ServiceUtil.returnSuccess();
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_error, "OrderErrorOnCartUpdate", this.cart.getLocale())); // SCIPIO
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 result;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return result;
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_error, "cart.quantity_not_positive_number", this.cart.getLocale()));
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return result;
Avoid too many return
statements within this method. Open
Open
return result;