Commit 46a7c340 by Liv Haapala

added counting limits for computer place products

1 parent bd08c8c3
...@@ -221,6 +221,13 @@ public class ProductBean implements ProductBeanLocal { ...@@ -221,6 +221,13 @@ public class ProductBean implements ProductBeanLocal {
int freeCount = selectableCount.intValue() - unusedSlotcount; int freeCount = selectableCount.intValue() - unusedSlotcount;
BigDecimal lim = getPrivateProductLimit(prod, user, userroles);
if(prod != null && lim != null && lim.intValue() < freeCount){
//logger.info("product: {}, lim: {}", prod.getName(), lim.toString());
freeCount = lim.intValue();
}
// logger.info("Prodlimit selectable {}, unused {}, free {}, prod {}", selectableCount, unusedSlots, freeCount, prod); // logger.info("Prodlimit selectable {}, unused {}, free {}, prod {}", selectableCount, unusedSlots, freeCount, prod);
ret.put(prod.getId(), BigDecimal.valueOf(freeCount)); ret.put(prod.getId(), BigDecimal.valueOf(freeCount));
......
...@@ -90,7 +90,6 @@ public class ProductShopItemHelper extends GenericCDIView { ...@@ -90,7 +90,6 @@ public class ProductShopItemHelper extends GenericCDIView {
if (limitValue != null) { if (limitValue != null) {
productsLeft = limitValue.subtract(item.getCount()); productsLeft = limitValue.subtract(item.getCount());
logger.debug("limitValue: {}", limitValue.toString());
if (productsLeft.compareTo(BigDecimal.ZERO) < 0) { if (productsLeft.compareTo(BigDecimal.ZERO) < 0) {
this.setProductShopItemCount(item, limitValue); this.setProductShopItemCount(item, limitValue);
...@@ -103,8 +102,6 @@ public class ProductShopItemHelper extends GenericCDIView { ...@@ -103,8 +102,6 @@ public class ProductShopItemHelper extends GenericCDIView {
} }
} }
logger.debug("productsLeft: {}", productsLeft.toString());
item.setLimit(productsLeft); item.setLimit(productsLeft);
return false; return false;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!