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 { ...@@ -159,14 +159,16 @@ public class UserBean implements UserBeanLocal {
// currentEventuser, currentEventuserRoles); // currentEventuser, currentEventuserRoles);
// return currentEventuserRoles; // return currentEventuserRoles;
// } // }
LanEvent event = eventBean.getCurrentEvent();
Set<Role> checkedRoles = new HashSet<Role>(); Set<Role> checkedRoles = new HashSet<Role>();
addRecursive(checkedRoles, event.getDefaultRole());
if (u != null) if (u != null)
{ {
addRecursive(checkedRoles, rolefacade.findForUser(u)); addRecursive(checkedRoles, rolefacade.findForUser(u));
if (permbean.isLoggedIn()) { if (permbean.isLoggedIn()) {
LanEvent event = eventBean.getCurrentEvent();
// add roles from events default role. // add roles from events default role.
addRecursive(checkedRoles, event.getDefaultRole()); addRecursive(checkedRoles, event.getDefaultRole());
......
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jpt.core.discoverAnnotatedClasses=true org.eclipse.jpt.core.discoverAnnotatedClasses=true
org.eclipse.jpt.core.platform=eclipselink2_3 org.eclipse.jpt.core.platform=eclipselink2_3
org.eclipse.jpt.jpa.core.discoverAnnotatedClasses=true
org.eclipse.jpt.jpa.core.metamodelSourceFolderName=src org.eclipse.jpt.jpa.core.metamodelSourceFolderName=src
...@@ -2,16 +2,18 @@ package fi.codecrew.moya.model; ...@@ -2,16 +2,18 @@ package fi.codecrew.moya.model;
public enum LanEventPropertyKey { public enum LanEventPropertyKey {
EVENT_LOGO(Type.DATA, null), EVENT_LOGO(Type.DATA, null),
INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Stream demoparty"), INVITEMAIL_SUBJECT(Type.TEXT, "Invitation to Moya Online Youth Accumulator"),
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"), 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, "intra@streamparty.org"), PORTAL_EMAIL_ADDRESS(Type.TEXT, "moya@codecrew.fi"),
PORTAL_EMAIL_NAME(Type.TEXT, "Streamparty intranet"), PORTAL_EMAIL_NAME(Type.TEXT, "Moya Online Youth Accumulator"),
ADMIN_MAIL(Type.TEXT, "intra@streamparty.org"), ADMIN_MAIL(Type.TEXT, "moya@codecrew.fi"),
EVENT_LAYOUT(Type.TEXT, "template1"), EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null), SHOP_DEFAULT_CASH(Type.BOOL, null),
PLACECODE_FROM_USER(Type.BOOL, null), PLACECODE_FROM_USER(Type.BOOL, null),
PLACECODE_PRINT_ONLY_OWN(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 { private enum Type {
TEXT, DATE, DATA, BOOL TEXT, DATE, DATA, BOOL
}; };
......
<!DOCTYPE html <!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> "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" <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: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">
xmlns:products="http://java.sun.com/jsf/composite/cditools/products" xmlns:f="http://java.sun.com/jsf/core"
>
<h:body> <h:body>
...@@ -18,9 +16,15 @@ ...@@ -18,9 +16,15 @@
</ui:define> </ui:define>
<ui:define name="content"> <ui:define name="content">
<h:form id="billshopform"> <h:form id="billshopform">
<products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" <products:shop commitaction="#{productShopView.commitBillCart()}" items="#{productShopView.shoppingcart}" commitValue="#{i18n['productshop.commit']}" />
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> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -63,7 +63,6 @@ public class ProductShopView extends GenericCDIView { ...@@ -63,7 +63,6 @@ public class ProductShopView extends GenericCDIView {
private BigDecimal cash = BigDecimal.ZERO; private BigDecimal cash = BigDecimal.ZERO;
private transient ListDataModel<ProductShopItem> shoppingcart; private transient ListDataModel<ProductShopItem> shoppingcart;
@Inject @Inject
private BillListView billListView; private BillListView billListView;
...@@ -79,6 +78,8 @@ public class ProductShopView extends GenericCDIView { ...@@ -79,6 +78,8 @@ public class ProductShopView extends GenericCDIView {
private boolean hasLimits = false; private boolean hasLimits = false;
private boolean blip = false; private boolean blip = false;
private ListDataModel<ProductShopItem> boughtItems; private ListDataModel<ProductShopItem> boughtItems;
private boolean allowStatistics = true;
private String otherInfo;
public void initBillView() { public void initBillView() {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS) if (requirePermissions(ShopPermission.LIST_USERPRODUCTS)
...@@ -93,6 +94,38 @@ public class ProductShopView extends GenericCDIView { ...@@ -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() { public void initShopView() {
if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) { if (requirePermissions(ShopPermission.SHOP_TO_OTHERS) && shoppingcart == null) {
...@@ -362,18 +395,16 @@ public class ProductShopView extends GenericCDIView { ...@@ -362,18 +395,16 @@ public class ProductShopView extends GenericCDIView {
this.hasLimits = hasLimits; this.hasLimits = hasLimits;
} }
public String readBarcode() { public String readBarcode() {
PrintedCard card = readerView.getPrintedCard(); PrintedCard card = readerView.getPrintedCard();
if(readerView.getBarcode() == null || readerView.getBarcode().trim() == "") { if (readerView.getBarcode() == null || readerView.getBarcode().trim() == "") {
return null; return null;
} }
if(card != null) { if (card != null) {
if(card.getUser() != null) { if (card.getUser() != null) {
userView.setUser(card.getUser()); userView.setUser(card.getUser());
this.user = card.getUser(); this.user = card.getUser();
initShopView(); initShopView();
...@@ -385,13 +416,14 @@ public class ProductShopView extends GenericCDIView { ...@@ -385,13 +416,14 @@ public class ProductShopView extends GenericCDIView {
this.blip = false; this.blip = false;
// find product index, set index and add one // 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; int n = 0;
for (ProductShopItem a : shoppingcart) { for (ProductShopItem a : shoppingcart) {
if (a.getProduct().equals(product)) if (a.getProduct().equals(product))
{ {
//a.setCount(a.getCount().add(BigDecimal.ONE)); // a.setCount(a.getCount().add(BigDecimal.ONE));
//updateCartLimits(null); // updateCartLimits(null);
shoppingcart.setRowIndex(n); shoppingcart.setRowIndex(n);
this.addOne(); this.addOne();
setBlip(true); setBlip(true);
...@@ -420,6 +452,20 @@ public class ProductShopView extends GenericCDIView { ...@@ -420,6 +452,20 @@ public class ProductShopView extends GenericCDIView {
this.boughtItems = 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!