Commit 23914891 by Tuomas Riihimäki

Lisäkenttiä tuotteen ostoon by request of Insomnia

1 parent 077fdf82
......@@ -159,14 +159,16 @@ public class UserBean implements UserBeanLocal {
// currentEventuser, currentEventuserRoles);
// return currentEventuserRoles;
// }
LanEvent event = eventBean.getCurrentEvent();
Set<Role> checkedRoles = new HashSet<Role>();
addRecursive(checkedRoles, event.getDefaultRole());
if (u != null)
{
addRecursive(checkedRoles, rolefacade.findForUser(u));
if (permbean.isLoggedIn()) {
LanEvent event = eventBean.getCurrentEvent();
// add roles from events default role.
addRecursive(checkedRoles, event.getDefaultRole());
......
eclipse.preferences.version=1
org.eclipse.jpt.core.discoverAnnotatedClasses=true
org.eclipse.jpt.core.platform=eclipselink2_3
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true
org.eclipse.jpt.jpa.core.metamodelSourceFolderName=src
......@@ -2,16 +2,18 @@ package fi.codecrew.moya.model;
public enum LanEventPropertyKey {
EVENT_LOGO(Type.DATA, null),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Stream demoparty"),
INVITEMAIL_CONTENT(Type.TEXT, "You have been invited to Stream demoparty by {1}.\n\nYou can register to stream demparty intranet at: {0}\n\nAfter registering to the intranet you can buy a ticket to Stream demoparty reduced price and invite your friends to join the party with you. More information can be found in the intranet. Remember also to visit our website at http://www.streamparty.org and join us at #streamparty in IRCNet. If you have any questions about this mail, registering to intranet, or anything else regarding Stream demoparty, please send us email to info@streamparty.org\n\n-- \nStream organizing\ninfo@streamparty.org"),
PORTAL_EMAIL_ADDRESS(Type.TEXT, "intra@streamparty.org"),
PORTAL_EMAIL_NAME(Type.TEXT, "Streamparty intranet"),
ADMIN_MAIL(Type.TEXT, "intra@streamparty.org"),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Moya Online Youth Accumulator"),
INVITEMAIL_CONTENT(Type.TEXT, "You have been invited to an event by {1}.\n\nYou can register to intranet at: {0}\n\nAfter registering to the intranet you can buy a ticket to Stream demoparty reduced price and invite your friends to join the party with you. More information can be found in the intranet. Remember also to visit our website at http://www.streamparty.org and join us at #streamparty in IRCNet. If you have any questions about this mail, registering to intranet, or anything else regarding Stream demoparty, please send us email to info@streamparty.org\n\n-- \nStream organizing\ninfo@streamparty.org"),
PORTAL_EMAIL_ADDRESS(Type.TEXT, "moya@codecrew.fi"),
PORTAL_EMAIL_NAME(Type.TEXT, "Moya Online Youth Accumulator"),
ADMIN_MAIL(Type.TEXT, "moya@codecrew.fi"),
EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null),
PLACECODE_FROM_USER(Type.BOOL, null),
PLACECODE_PRINT_ONLY_OWN(Type.BOOL, null),
;
CHECK_BILL_STATS_PERMISSION(Type.BOOL, null),
GATHER_OTHER_BILL_INFO(Type.BOOL, null), ;
private enum Type {
TEXT, DATE, DATA, BOOL
};
......@@ -39,7 +41,7 @@ public enum LanEventPropertyKey {
{
this.type = t;
defaultvalue = def;
}
}
public String getDefaultvalue() {
return defaultvalue;
......
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:h="http://java.sun.com/jsf/html" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:f="http://java.sun.com/jsf/core"
>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:h="http://java.sun.com/jsf/html" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:f="http://java.sun.com/jsf/core" xmlns:p="http://primefaces.org/ui">
<h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata>
<f:viewParam name="userid" value="#{userView.userid}" />
......@@ -18,9 +16,15 @@
</ui:define>
<ui:define name="content">
<h:form id="billshopform">
<products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}"
commitValue="#{i18n['productshop.commit']}"
/>
<products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" commitValue="#{i18n['productshop.commit']}" />
<h:panelGrid columns="3" rendered="#{productShopView.checkAllowStats}">
<h:outputText for="allowStats" value="#{i18n['bill.allowStatistics']}" />
<h:selectBooleanCheckbox id="allowStats" value="#{productShopView.allowStatistics}" />
<h:message for="allowStats" />
</h:panelGrid>
<p:inputTextarea rendered="#{productShopView.gatherrBillInfo}" value="#{productShopView.otherInfo}" label="#{i18n['otherInfo']}"/>
</h:form>
</ui:define>
</ui:composition>
......
......@@ -62,7 +62,6 @@ public class ProductShopView extends GenericCDIView {
private boolean payInstant = true;
private BigDecimal cash = BigDecimal.ZERO;
private transient ListDataModel<ProductShopItem> shoppingcart;
@Inject
......@@ -70,15 +69,17 @@ public class ProductShopView extends GenericCDIView {
@Inject
private ReaderView readerView;
@Inject
private UserView userView;
@Inject
private BillEditView billEditView;
private boolean hasLimits = false;
private boolean blip = false;
private ListDataModel<ProductShopItem> boughtItems;
private boolean allowStatistics = true;
private String otherInfo;
public void initBillView() {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS)
......@@ -93,6 +94,38 @@ public class ProductShopView extends GenericCDIView {
}
private Boolean checkAllowStats;
public boolean isCheckAllowStats()
{
if (checkAllowStats == null)
{
LanEventProperty re = eventbean.getProperty(LanEventPropertyKey.CHECK_BILL_STATS_PERMISSION);
if (re != null) {
checkAllowStats = re.isBooleanValue();
} else {
checkAllowStats = false;
}
}
return checkAllowStats;
}
private Boolean gatherBillInfo;
public boolean isGatherBillInfo()
{
if (gatherBillInfo == null)
{
LanEventProperty re = eventbean.getProperty(LanEventPropertyKey.GATHER_OTHER_BILL_INFO);
if (re != null) {
gatherBillInfo = re.isBooleanValue();
} else {
gatherBillInfo = false;
}
}
return gatherBillInfo;
}
public void initShopView() {
if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) {
......@@ -148,7 +181,7 @@ public class ProductShopView extends GenericCDIView {
Map<Integer, BigDecimal> prodCounts = new HashMap<Integer, BigDecimal>();
for (ProductShopItem sc : shoppingcart) {
prodCounts.put(sc.getProduct().getId(), sc.getCount());
prodCounts.put(sc.getProduct().getId(), sc.getCount());
}
HashMap<Integer, BigDecimal> limits = productBean.getProductLimit(
......@@ -362,36 +395,35 @@ public class ProductShopView extends GenericCDIView {
this.hasLimits = hasLimits;
}
public String readBarcode() {
PrintedCard card = readerView.getPrintedCard();
if(readerView.getBarcode() == null || readerView.getBarcode().trim() == "") {
if (readerView.getBarcode() == null || readerView.getBarcode().trim() == "") {
return null;
}
if(card != null) {
if(card.getUser() != null) {
if (card != null) {
if (card.getUser() != null) {
userView.setUser(card.getUser());
this.user = card.getUser();
initShopView();
return null;
}
}
Product product = productBean.findByBarcode(readerView.getBarcode());
this.blip = false;
// find product index, set index and add one
// I don't know why this does not work if you just loop over and change the product count
// I don't know why this does not work if you just loop over and change
// the product count
int n = 0;
for (ProductShopItem a : shoppingcart) {
if (a.getProduct().equals(product))
if (a.getProduct().equals(product))
{
//a.setCount(a.getCount().add(BigDecimal.ONE));
//updateCartLimits(null);
// a.setCount(a.getCount().add(BigDecimal.ONE));
// updateCartLimits(null);
shoppingcart.setRowIndex(n);
this.addOne();
setBlip(true);
......@@ -419,7 +451,21 @@ public class ProductShopView extends GenericCDIView {
public void setBoughtItems(ListDataModel<ProductShopItem> boughtItems) {
this.boughtItems = boughtItems;
}
public String getOtherInfo() {
return otherInfo;
}
public void setOtherInfo(String otherInfo) {
this.otherInfo = otherInfo;
}
public boolean isAllowStatistics() {
return allowStatistics;
}
public void setAllowStatistics(boolean allowStatistics) {
this.allowStatistics = allowStatistics;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!