Commit ab9d6a3c by Riku Silvola

Merge branch 'master' of codecrew.fi:bortal

2 parents ae5d3663 454f7c0e
......@@ -209,11 +209,9 @@ public class BillBean implements BillBeanLocal {
Product creditproduct = productBean.findCreditProduct();
EventUser user = bill.getUser();
AccountEvent ac = productBean.createAccountEvent(creditproduct,
bill.totalPrice(), user);
AccountEvent ac = productBean.createAccountEvent(creditproduct, bill.totalPrice(), user);
logger.info("Created creditentry. {}, userproducts {}", ac, user
.getAccountEvents().size());
logger.info("Created creditentry. {}, userproducts {}", ac, user.getAccountEvents().size());
ac.setDelivered(when);
ac.setEventTime(when);
......@@ -224,27 +222,20 @@ public class BillBean implements BillBeanLocal {
bill.setPaidDate(when.getTime());
// bill = billFacade.merge(bill);
boolean checked = false;
for (BillLine bl : bill.getBillLines()) {
Product prod = bl.getLineProduct();
if (prod != null
&& prod.getProductFlags().contains(
ProductFlag.PREPAID_INSTANT_CREATE)) {
logger.debug("Creating Bill prepaidInstant product {}, {}",
prod.getName(), bl.getQuantity());
if (prod.getProductFlags().contains(
ProductFlag.RESERVE_PLACE_WHEN_BOUGHT)
|| prod.getProductFlags().contains(
ProductFlag.CREATE_NEW_PLACE_WHEN_BOUGHT)) {
placebean.lockPlaceProduct(bill.getUser(), prod,
bl.getQuantity());
if (prod != null && prod.getProductFlags().contains(ProductFlag.PREPAID_INSTANT_CREATE)) {
logger.debug("Creating Bill prepaidInstant product {}, {}", prod.getName(), bl.getQuantity());
if (prod.getProductFlags().contains(ProductFlag.RESERVE_PLACE_WHEN_BOUGHT)
|| prod.getProductFlags().contains(ProductFlag.CREATE_NEW_PLACE_WHEN_BOUGHT)) {
placebean.lockPlaceProduct(bill.getUser(), prod, bl.getQuantity());
}
AccountEvent ac2 = productPBean.createAccountEvent(prod,
bl.getQuantity(), user, bill.getSentDate(), bl.getFoodwave());
logger.info("Created ac from product. {}, userproducts {}",
ac2, user.getAccountEvents().size());
AccountEvent ac2 = productPBean.createAccountEvent(prod, bl.getQuantity(), user, bill.getSentDate(), bl.getFoodwave());
logger.info("Created ac from product. {}, userproducts {}", ac2, user.getAccountEvents().size());
ac2.setSeller(permbean.getCurrentUser());
......@@ -253,9 +244,7 @@ public class BillBean implements BillBeanLocal {
}
MailMessage msg = new MailMessage();
msg.setSubject(I18n.get("bill.billMarkedPaidMail.subject"));
msg.setMessage(I18n.get("bill.billMarkedPaidMail.message", (bill
.getBillNumber() == null) ? "----" : bill.getBillNumber()
.toString()));
msg.setMessage(I18n.get("bill.billMarkedPaidMail.message", (bill.getBillNumber() == null) ? "----" : bill.getBillNumber().toString()));
msg.setTo(bill.getUser().getUser());
utilbean.sendMail(msg);
eventUserFacade.flush();
......@@ -265,13 +254,9 @@ public class BillBean implements BillBeanLocal {
@Override
@RolesAllowed({ BillPermission.S_CREATE_BILL, BillPermission.S_WRITE_ALL })
public void createBill(Bill bill) {
if (!permbean.isCurrentUser(bill.getUser())
&& !permbean.hasPermission(BillPermission.WRITE_ALL)) {
loggingBean.logMessage(SecurityLogType.permissionDenied,
permbean.getCurrentUser(),
"Not enought rights to create bill for user ");
throw new EJBAccessException(
"Could not create bill for another user");
if (!permbean.isCurrentUser(bill.getUser()) && !permbean.hasPermission(BillPermission.WRITE_ALL)) {
loggingBean.logMessage(SecurityLogType.permissionDenied, permbean.getCurrentUser(), "Not enought rights to create bill for user ");
throw new EJBAccessException("Could not create bill for another user");
}
billFacade.create(bill);
generateBillNumber(bill);
......@@ -285,13 +270,9 @@ public class BillBean implements BillBeanLocal {
@Override
@RolesAllowed({ BillPermission.S_VIEW_OWN, BillPermission.S_READ_ALL })
public List<Bill> find(EventUser user) {
if (!permbean.isCurrentUser(user)
&& !permbean.hasPermission(BillPermission.READ_ALL)) {
loggingBean.logMessage(SecurityLogType.permissionDenied,
permbean.getCurrentUser(),
"Not enought rights to get bill list for user ");
throw new EJBAccessException(
"Could not list bills for another user");
if (!permbean.isCurrentUser(user) && !permbean.hasPermission(BillPermission.READ_ALL)) {
loggingBean.logMessage(SecurityLogType.permissionDenied, permbean.getCurrentUser(), "Not enought rights to get bill list for user ");
throw new EJBAccessException("Could not list bills for another user");
}
return billFacade.find(user);
}
......
......@@ -107,6 +107,9 @@ public class CardPrintBean implements CardPrintBeanLocal {
.read(new ByteArrayInputStream(user.getCurrentImage()
.getImageData()));
if(faceBufferedImage.getWidth() > 1024 || faceBufferedImage.getHeight() > 1024) {
throw new Exception("Image dimensions too large, please take/upload smaller!");
}
int originalWidth = faceBufferedImage.getWidth();
int originalHeight = faceBufferedImage.getHeight();
......
......@@ -78,15 +78,14 @@ public class ProductPBean {
unitPrice = unitPrice.multiply(d.getPercentage());
}
AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity,
Calendar.getInstance());
AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity, Calendar.getInstance());
ret.setDelivered(Calendar.getInstance());
ret.setSeller(permbean.getCurrentUser());
if (foodwave != null) {
ret.setFoodWave(foodwave);
if(foodwave.getAccountEvents() == null) {
if (foodwave.getAccountEvents() == null) {
foodwave.setAccountEvents(new ArrayList<AccountEvent>());
}
foodwave.getAccountEvents().add(ret);
......
......@@ -41,14 +41,14 @@
<h:commandButton action="#{foodWaveView.saveTemplate()}"
value="#{i18n['foodwavetemplate.save']}" />
</h:panelGrid>
<h:selectOneMenu value="#{foodWaveView.currentProduct}"
<!-- <h:selectOneMenu value="#{foodWaveView.currentProduct}"
converter="#{productConverter}">
<f:selectItems value="#{foodWaveView.products}" var="product"
itemLabel="#{product.name}"></f:selectItems>
</h:selectOneMenu>
<p:commandButton value="#{i18n['foodwavetemplate.addproduct']}"
actionListener="#{foodWaveView.addProductToTemplate}"
update="productTable" />
update="productTable" /> -->
<h:panelGrid columns="4">
......
......@@ -7,6 +7,7 @@ import javax.faces.bean.RequestScoped;
import javax.inject.Named;
import fi.insomnia.bortal.beans.ActionLogBeanLocal;
import fi.insomnia.bortal.enums.apps.ContentPermission;
import fi.insomnia.bortal.model.ActionLogMessage;
import fi.insomnia.bortal.web.cdiview.GenericCDIView;
......@@ -29,6 +30,9 @@ public class ActionLogMessageView extends GenericCDIView {
}
public List<ActionLogMessage> getMessages() {
return actionLogBean.getAllActionLogEvents();
if (super.hasPermission(ContentPermission.MANAGE_ACTIONLOG)) {
return actionLogBean.getAllActionLogEvents();
}
return null;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!