Commit 4bde9b5e by Tuukka Kivilahti

Merge branch 'automark-zero-bill-paid' into 'master'

Add possibility to reserve places to a free event

See merge request !376
2 parents 524058c2 de41a5c1
...@@ -33,6 +33,7 @@ import javax.ejb.EJBAccessException; ...@@ -33,6 +33,7 @@ import javax.ejb.EJBAccessException;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import fi.codecrew.moya.model.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -46,14 +47,6 @@ import fi.codecrew.moya.facade.BillFacade; ...@@ -46,14 +47,6 @@ import fi.codecrew.moya.facade.BillFacade;
import fi.codecrew.moya.facade.BillLineFacade; import fi.codecrew.moya.facade.BillLineFacade;
import fi.codecrew.moya.facade.EventUserFacade; import fi.codecrew.moya.facade.EventUserFacade;
import fi.codecrew.moya.facade.PlaceSlotFacade; import fi.codecrew.moya.facade.PlaceSlotFacade;
import fi.codecrew.moya.model.Bill;
import fi.codecrew.moya.model.BillLine;
import fi.codecrew.moya.model.Discount;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.FoodWave;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.PlaceSlot;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.utilities.SearchResult; import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.moyamessage.MoyaEventType; import fi.codecrew.moya.utilities.moyamessage.MoyaEventType;
...@@ -278,6 +271,14 @@ public class BillBean implements BillBeanLocal { ...@@ -278,6 +271,14 @@ public class BillBean implements BillBeanLocal {
billFacade.create(bill); billFacade.create(bill);
generateBillNumber(bill); generateBillNumber(bill);
createPlaceslots(bill); createPlaceslots(bill);
// If we allow bills with zero price
// we will mark them immediately as paid.
if (bill.getTotalPrice().compareTo(BigDecimal.ZERO) == 0
&& eventbean.getPropertyBoolean(LanEventPropertyKey.ALLOW_FREE_BILLS)) {
bill = billpbean.markPaid(bill, Calendar.getInstance(), false);
}
return bill; return bill;
} }
......
...@@ -60,7 +60,8 @@ public enum LanEventPropertyKey { ...@@ -60,7 +60,8 @@ public enum LanEventPropertyKey {
/** /**
* ISO 4217 code of currency. * ISO 4217 code of currency.
*/ */
EVENT_CURRENCY_CODE(Type.TEXT, "EUR"); EVENT_CURRENCY_CODE(Type.TEXT, "EUR"),
ALLOW_FREE_BILLS(Type.BOOL),
; ;
public enum Type { public enum Type {
......
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
*/ */
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
import java.util.ArrayList;
import java.util.Calendar; import java.util.Calendar;
import java.util.List; import java.util.List;
...@@ -78,12 +79,12 @@ public class BillEditView extends GenericCDIView { ...@@ -78,12 +79,12 @@ public class BillEditView extends GenericCDIView {
public boolean isCheckoutFiAvailable() public boolean isCheckoutFiAvailable()
{ {
return checkoutbean.isPaymentEnabled(); return bill != null && !bill.isPaid() && checkoutbean.isPaymentEnabled();
} }
public boolean isVerkkomaksuFiAvailable() public boolean isVerkkomaksuFiAvailable()
{ {
return vmbean.isSvmEnabled(); return bill != null && !bill.isPaid() && vmbean.isSvmEnabled();
} }
public List<CheckoutBank> getCheckoutFiToken() public List<CheckoutBank> getCheckoutFiToken()
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!