Commit f186d2c3 by Tuomas Riihimäki

Add logging for user creating bill with more places than in RESERVE_UNPAID_SLOT_…

…PERCENT event property
1 parent 60ba90b9
......@@ -58,6 +58,7 @@ 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.LanEventPropertyKey;
import fi.codecrew.moya.model.PlaceSlot;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductFlag;
......@@ -305,6 +306,12 @@ public class BillBean implements BillBeanLocal {
}
int count = bl.getQuantity().intValue();
Date now = new Date();
long reserveLimit = eventbean.getPropertyLong(LanEventPropertyKey.RESERVE_UNPAID_SLOT_PERCENT);
if (count * 100 / prod.getPlaces().size() > reserveLimit) {
long limitCount = prod.getPlaces().size() * reserveLimit / 100;
logbean.sendMessage(MoyaEventType.BILL_INFO, bill.getUser(), "User created bill ", bill.getId(), " for product '", prod.getName(), "' for '", count, "' products, which is bigger than reservation limit. '", limitCount, "', (", reserveLimit, "%)");
}
for (int i = 0; i < count; ++i) {
PlaceSlot ps = new PlaceSlot();
ps.setBill(bill);
......
......@@ -15,6 +15,7 @@ public enum MoyaEventType {
USER_PERMISSION_VIOLATION(MoyaEventSource.USER),
LOGIN_SUCCESSFULL(MoyaEventSource.USER),
PLACE_ACTION(MoyaEventSource.PLACEMAP),
BILL_INFO(MoyaEventSource.SHOP),
;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!