Commit 82ed9dd3 by Tuukka Kivilahti

Merge branch 'buyfix' into 'master'

Autoproduct can not be bought as the only product

System would allow users to buy delivery costs as the only product.
We don't want this.

See merge request !304
2 parents 705f45f5 4060b94d
......@@ -44,6 +44,7 @@ import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductFlag;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView;
......@@ -398,7 +399,9 @@ public class ProductShopView extends GenericCDIView {
private boolean productsInCart() {
Iterator<ProductShopItem> nullcheckIter = shoppingcart.iterator();
while (nullcheckIter.hasNext()) {
if (nullcheckIter.next().getCount().compareTo(BigDecimal.ZERO) > 0) {
ProductShopItem prod = nullcheckIter.next();
// Autoproduct is not counted as a real product.
if (!prod.getProduct().getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT) && prod.getCount().compareTo(BigDecimal.ZERO) > 0) {
return true;
}
}
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!