Commit 198da055 by Tuomas Riihimäki

Bugfixes...

1 parent 4c45791b
......@@ -372,7 +372,8 @@ public class BillBean implements BillBeanLocal {
BigDecimal discountPrice = product.getPrice();
for (Discount disc : discountBean.getActiveDiscountsByProduct(product, count, bill.getSentDate(), bill.getUser())) {
BillLine line = new BillLine(bill, product, disc,discountPrice, count);
discountPrice = discountPrice.subtract(line.getUnitPrice());
// unitPrice is negative, so add. Do not subtract
discountPrice = discountPrice.add(line.getUnitPrice());
bill.getBillLines().add(line);
}
......
......@@ -79,7 +79,7 @@
<p:commandButton
rendered="#{ajaxMapView.canUserBuy()}"
value="#{i18n['mapPlacechange.commitMove']}"
actionListener="#{mapPlacechangeView.commitMove()}" />
action="#{mapPlacechangeView.commitMove()}" />
</h:form>
......
......@@ -107,6 +107,9 @@ public class MapPlacechangeView extends GenericCDIView {
}
}
placebean.movePlaces(change);
slots = null;
initView();
}
public void toggleDstPlace() {
......
......@@ -45,18 +45,22 @@ public class ProductShopItemHelper extends GenericCDIView {
public void updateProductShopItemCount(ProductShopItem item) {
if (item.getProduct().getMinBuyCount() > 0 && item.getCount().compareTo(BigDecimal.ZERO) > 0
&& item.getCount().compareTo(BigDecimal.valueOf(item.getProduct().getMinBuyCount())) < 0) {
item.setCount(BigDecimal.valueOf(item.getProduct().getMinBuyCount()));
}
// Discounts or overridden price, you cannot get both
if (item.isOverrideUnitPrice()) {
item.setInternalPrice(item.getOverriddenUnitPrice().multiply(item.getCount()));
} else {
item.setInternalPrice(item.getProduct().getPrice().abs().multiply(item.getCount()));
item.setInternalDiscounts(discountBean.getActiveDiscountsByProduct(item.getProduct(), item.getCount(), new Date(), item.getUser()));
item.setInternalDiscounts(discountBean.getActiveDiscountsByProduct(item.getProduct(), item.getCount(),
new Date(), item.getUser()));
item.setInternalDiscountValues(new HashMap<Integer, BigDecimal>());
for (Discount d : item.getDiscounts())
{
for (Discount d : item.getDiscounts()) {
BigDecimal newprice = item.getPrice().multiply(d.getPercentage());
item.getInternalDiscountValues().put(d.getId(), item.getPrice().subtract(newprice));
item.setInternalPrice(newprice);
......@@ -67,14 +71,10 @@ public class ProductShopItemHelper extends GenericCDIView {
public void setProductShopItemCount(ProductShopItem item, BigDecimal count) {
if (count == null || count.compareTo(BigDecimal.ZERO) < 0)
{
if (count == null || count.compareTo(BigDecimal.ZERO) < 0) {
count = BigDecimal.ZERO;
} else if(item.getProduct().getMinBuyCount() > 0 && count.compareTo(BigDecimal.ZERO) > 0 && count.compareTo(BigDecimal.valueOf(item.getProduct().getMinBuyCount())) < 0) {
count = BigDecimal.valueOf(item.getProduct().getMinBuyCount());
}
item.setCount(count);
updateProductShopItemCount(item);
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!