Commit 2dd9952d by Antti Tonkyra

Merge branch 'devel' of codecrew.fi:bortal into devel

2 parents bedccdd5 e999a1c9
...@@ -124,7 +124,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -124,7 +124,7 @@ public class MenuBean implements MenuBeanLocal {
MenuNavigation tournaments = usermenu.addPage(null, null); MenuNavigation tournaments = usermenu.addPage(null, null);
tournaments.setKey("tournaments.menutitle"); tournaments.setKey("tournaments.menutitle");
tournaments.addPage(menuitemfacade.findOrCreate("/tournaments/index"), TournamentPermission.VIEW); tournaments.addPage(menuitemfacade.findOrCreate("/tournaments/index"), TournamentPermission.VIEW);
tournaments.addPage(menuitemfacade.findOrCreate("/tournaments/showrules"), TournamentPermission.VIEW);
/* /*
* MenuNavigation createuser = usermenu.addPage(null, null); * MenuNavigation createuser = usermenu.addPage(null, null);
* createuser.setKey("topnavi.createuser"); * createuser.setKey("topnavi.createuser");
...@@ -145,6 +145,8 @@ public class MenuBean implements MenuBeanLocal { ...@@ -145,6 +145,8 @@ public class MenuBean implements MenuBeanLocal {
adminuser.setKey("topnavi.usermgmt"); adminuser.setKey("topnavi.usermgmt");
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/list"), UserPermission.VIEW_ALL); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/list"), UserPermission.VIEW_ALL);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/create"), UserPermission.VIEW_ALL); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/create"), UserPermission.VIEW_ALL);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/sendPicture"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/place/adminGroups"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/edit"), UserPermission.VIEW_ALL).setVisible(false); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/edit"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/changePassword"), UserPermission.VIEW_ALL).setVisible(false); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/changePassword"), UserPermission.VIEW_ALL).setVisible(false);
adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/accountEvents"), UserPermission.VIEW_ALL).setVisible(false); adminuser.addPage(menuitemfacade.findOrCreate("/useradmin/accountEvents"), UserPermission.VIEW_ALL).setVisible(false);
...@@ -176,6 +178,8 @@ public class MenuBean implements MenuBeanLocal { ...@@ -176,6 +178,8 @@ public class MenuBean implements MenuBeanLocal {
adminShopProducts.setKey("subnavi.products"); adminShopProducts.setKey("subnavi.products");
adminShopProducts.addPage(menuitemfacade.findOrCreate("/product/list"), ShopPermission.LIST_ALL_PRODUCTS); adminShopProducts.addPage(menuitemfacade.findOrCreate("/product/list"), ShopPermission.LIST_ALL_PRODUCTS);
adminShopProducts.addPage(menuitemfacade.findOrCreate("/product/create"), ShopPermission.MANAGE_PRODUCTS); adminShopProducts.addPage(menuitemfacade.findOrCreate("/product/create"), ShopPermission.MANAGE_PRODUCTS);
adminShopProducts.addPage(menuitemfacade.findOrCreate("/product/edit"), ShopPermission.MANAGE_PRODUCTS).setVisible(false);
;
MenuNavigation foodnavi = adminshop.addPage(null, null); MenuNavigation foodnavi = adminshop.addPage(null, null);
foodnavi.setKey("topnavi.foodwave"); foodnavi.setKey("topnavi.foodwave");
...@@ -190,6 +194,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -190,6 +194,7 @@ public class MenuBean implements MenuBeanLocal {
adminShopReaders.setKey("subnavi.readers"); adminShopReaders.setKey("subnavi.readers");
adminShopReaders.addPage(menuitemfacade.findOrCreate("/shop/showReaderEvents"), ShopPermission.SHOP_TO_OTHERS); adminShopReaders.addPage(menuitemfacade.findOrCreate("/shop/showReaderEvents"), ShopPermission.SHOP_TO_OTHERS);
adminShopReaders.addPage(menuitemfacade.findOrCreate("/shop/listReaders"), ShopPermission.SHOP_TO_OTHERS); adminShopReaders.addPage(menuitemfacade.findOrCreate("/shop/listReaders"), ShopPermission.SHOP_TO_OTHERS);
adminShopReaders.addPage(menuitemfacade.findOrCreate("/shop/editReader"), ShopPermission.SHOP_TO_OTHERS).setVisible(false);
MenuNavigation adminShopBilling = adminshop.addPage(null, null); MenuNavigation adminShopBilling = adminshop.addPage(null, null);
adminShopBilling.setKey("subnavi.billing"); adminShopBilling.setKey("subnavi.billing");
...@@ -232,7 +237,7 @@ public class MenuBean implements MenuBeanLocal { ...@@ -232,7 +237,7 @@ public class MenuBean implements MenuBeanLocal {
gamenavi.setKey("topnavi.license"); gamenavi.setKey("topnavi.license");
gamenavi.addPage(menuitemfacade.findOrCreate("/license/manageCodes"), LicensePermission.MANAGE); gamenavi.addPage(menuitemfacade.findOrCreate("/license/manageCodes"), LicensePermission.MANAGE);
adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/list"), EventPermission.MANAGE_PROPERTIES); adminevent.addPage(menuitemfacade.findOrCreate("/eventorg/editEvent"), EventPermission.MANAGE_PROPERTIES);
navifacade.create(adminmenu); navifacade.create(adminmenu);
......
...@@ -41,7 +41,10 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> { ...@@ -41,7 +41,10 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> {
CriteriaQuery<PrintedCard> cq = cb.createQuery(PrintedCard.class); CriteriaQuery<PrintedCard> cq = cb.createQuery(PrintedCard.class);
Root<PrintedCard> root = cq.from(PrintedCard.class); Root<PrintedCard> root = cq.from(PrintedCard.class);
cq.where(cb.equal(root.get(PrintedCard_.rfidUid), uid), cq.where(
cb.or(
cb.equal(root.get(PrintedCard_.barcode), uid),
cb.equal(root.get(PrintedCard_.rfidUid), uid)),
cb.equal(root.get(PrintedCard_.event), eventbean.getCurrentEvent())); cb.equal(root.get(PrintedCard_.event), eventbean.getCurrentEvent()));
return getSingleNullableResult(getEm().createQuery(cq)); return getSingleNullableResult(getEm().createQuery(cq));
......
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<h:outputLabel value="#{i18n['acc_line.eventuser']}" /> <h:outputLabel value="#{i18n['acc_line.eventuser']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{acc_line.user.wholeName}"> <h:link outcome="/useradmin/edit" value="#{acc_line.user.wholeName}">
<f:param value="#{acc_line.user.id}" /> <f:param name="userid" value="#{acc_line.user.id}" />
</h:link> </h:link>
</p:column> </p:column>
<p:column sortBy="#{acc_line.user.nick}"> <p:column sortBy="#{acc_line.user.nick}">
...@@ -52,7 +52,7 @@ ...@@ -52,7 +52,7 @@
<h:outputLabel value="#{i18n['acc_line.nick']}" /> <h:outputLabel value="#{i18n['acc_line.nick']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{acc_line.user.nick}"> <h:link outcome="/useradmin/edit" value="#{acc_line.user.nick}">
<f:param value="#{acc_line.user.id}" /> <f:param name="userid" value="#{acc_line.user.user.id}" />
</h:link> </h:link>
</p:column> </p:column>
<p:column sortBy="#{acc_line.eventDelivered}"> <p:column sortBy="#{acc_line.eventDelivered}">
...@@ -100,7 +100,7 @@ ...@@ -100,7 +100,7 @@
<h:outputLabel value="#{i18n['billLine.eventuser']}" /> <h:outputLabel value="#{i18n['billLine.eventuser']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.wholeName}"> <h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.wholeName}">
<f:param name="userid" value="#{bill_line.bill.user.id}" /> <f:param name="userid" value="#{bill_line.bill.user.user.id}" />
</h:link> </h:link>
</p:column> </p:column>
<p:column sortBy="#{bill_line.bill.user.nick}"> <p:column sortBy="#{bill_line.bill.user.nick}">
...@@ -108,7 +108,7 @@ ...@@ -108,7 +108,7 @@
<h:outputLabel value="#{i18n['billLine.nick']}" /> <h:outputLabel value="#{i18n['billLine.nick']}" />
</f:facet> </f:facet>
<h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.nick}"> <h:link outcome="/useradmin/edit" value="#{bill_line.bill.user.nick}">
<f:param name="userid" value="#{bill_line.bill.user.id}" /> <f:param name="userid" value="#{bill_line.bill.user.user.id}" />
</h:link> </h:link>
</p:column> </p:column>
<p:column sortBy="#{bill_line.linePrice}"> <p:column sortBy="#{bill_line.linePrice}">
......
...@@ -58,16 +58,15 @@ ...@@ -58,16 +58,15 @@
<f:param name="eventid" value="#{event.id}" /> <f:param name="eventid" value="#{event.id}" />
</h:link> </h:link>
<!--
<h: link rendered="#{!empty event.printedCard} AND !empty cc.attrs.linkoutcome" outcome="/shop/shopToUser" value="#{i18n['readerevent.shopToUser']}"> <h:link rendered="#{!empty event.printedCard }" outcome="/shop/shopToUser" value="#{i18n['readerevent.shopToUser']}">
<f:param name="userid" value="#{event.printedCard.user.user.id}" /> <f:param name="userid" value="#{event.printedCard.user.user.id}" />
</h:link> </h:link>
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-botton" value="#{cc.attrs.commitValue}" />
<h:link rendered="#{empty event.printedCard}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}"> <h:link rendered="#{empty event.printedCard}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}">
<f:param name="eventid" value="#{event.id}" /> <f:param name="eventid" value="#{event.id}" />
</h:link> --> </h:link>
</h:column> </h:column>
</h:dataTable> </h:dataTable>
......
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader" xmlns:p="http://primefaces.org/ui">
xmlns:tools="http://java.sun.com/jsf/composite/tools"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p="http://primefaces.org/ui" <composite:interface>
</composite:interface>
>
<composite:implementation>
<composite:interface> <h:form id="shoppingcartform">
</composite:interface> <h:panelGrid columns="2" style="width:100%;" columnClasses="shopProductbuttons,topalign">
<composite:implementation> <h:panelGroup>
<div id="shopItems">
<h:form id="shoppingcartform"> <ui:repeat value="#{productShopView.shoppingcart}" var="cart">
<h:panelGrid columns="2" style="width:100%;" columnClasses="shopProductbuttons,topalign"> <h:commandLink styleClass="shopItem" action="#{productShopView.addOne}">
<f:ajax render="@form" />
<h:panelGroup>
<div id="shopItems"> <div>
<ui:repeat value="#{productShopView.shoppingcart}" var="cart"> #{cart.product.name}<br />
<h:commandLink styleClass="shopItem" action="#{productShopView.addOne}"> <h:outputText value="#{cart.product.price}">
<f:ajax render="@form" />
<div>
#{cart.product.name}<br />
<h:outputText value="#{cart.product.price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</div>
</h:commandLink>
</ui:repeat>
</div>
</h:panelGroup>
<h:panelGroup>
<reader:barcode selectaction="#{productShopView.readBarcode}" selectvalue="#{i18n['shop.readBarcode']}" />
<br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.count']}" />
</f:facet>
<p:inplace>
<p:inputText value="#{prods.count}" size="4">
<f:ajax event="valueChange" render="@form" />
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</p:inputText>
</p:inplace>
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.product']}" />
</f:facet>
<h:outputText value="#{prods.getProduct().name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['shop.price']}" />
</f:facet>
<h:outputText value="#{prods.getProduct().price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText> </h:outputText>
</p:column>
<p:column> </div>
<f:facet name="header"> </h:commandLink>
<h:outputText value="#{i18n['shop.actions']}" /> </ui:repeat>
</f:facet> </div>
<p:commandButton action="#{productShopView.removeBought()}" update="@form" value="Poista" />
</p:column> </h:panelGroup>
</p:dataTable>
<h:panelGroup>
<div style="font-weight: bold;">
<h:outputText value="#{i18n['shop.cartPrice']}" />
<h:outputText id="shoptotal" value="#{productShopView.cartPrice}"> <reader:barcode selectaction="#{productShopView.readBarcode}" selectvalue="#{i18n['shop.readBarcode']}" />
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText> <br />
<br /> <p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
<h:outputLabel value="#{i18n['shop.currentBalance']}" /> <p:column>
<h:outputText id="currentbalance" value="#{productShopView.accountCredits}"> <f:facet name="header">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <h:outputText value="#{i18n['shop.count']}" />
</h:outputText> </f:facet>
<br /> <p:inplace>
<h:outputLabel value="#{i18n['shop.transactionTotal']}" /> <p:inputText value="#{prods.count}" size="4">
<h:outputText id="transactiontotal" value="#{productShopView.transactionTotal}"> <f:ajax event="valueChange" render="@form" />
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</h:outputText> </p:inputText>
</div> </p:inplace>
</p:column>
<h:panelGrid columns="2" > <p:column>
<h:outputLabel value="#{i18n['shop.toAccountValue']}" /> <f:facet name="header">
<h:inputText styleClass="inputval" size="5" value="#{productShopView.cash}"> <h:outputText value="#{i18n['shop.product']}" />
<f:ajax render="@form" event="valueChange" listener="#{productShopView.cashChanged}" /> </f:facet>
</h:inputText> <h:outputText value="#{prods.getProduct().name}" />
</p:column>
<h:outputLabel value="#{i18n['shop.cashGiven']}" /> <p:column>
<input id="returnval" type="text" size="5" value="0" disabled="disabled"/> <f:facet name="header">
<h:outputLabel value="#{i18n['shop.cashBack']}" /> <h:outputText value="#{i18n['shop.price']}" />
<input id="returnval" type="text" size="5" value="0" disabled="disabled"/> </f:facet>
<h:outputText value="#{prods.getProduct().price}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
<h:outputLabel value="#{i18n['shop.afterBalance']}" />
<h:outputText value=" #{productShopView.balanceAfterTransaction}">
<f:convertNumber />
</h:outputText> </h:outputText>
</h:panelGrid> </p:column>
<h:commandButton action="#{productShopView.commitShoppingCart()}" value="#{i18n['shop.buy']}" /> <p:column>
</h:panelGroup> <f:facet name="header">
<h:outputText value="#{i18n['shop.actions']}" />
</f:facet>
<p:commandButton action="#{productShopView.removeBought()}" update="@form" value="Poista" />
</p:column>
</p:dataTable>
<div style="font-weight: bold;">
<h:outputText value="#{i18n['shop.cartPrice']}" />
<h:outputText id="shoptotal" value="#{productShopView.cartPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
<br />
<h:outputLabel value="#{i18n['shop.currentBalance']}" />
<h:outputText id="currentbalance" value="#{productShopView.accountCredits}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
<br />
<h:outputLabel value="#{i18n['shop.transactionTotal']}" />
<h:outputText id="transactiontotal" value="#{productShopView.transactionTotal}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</div>
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['shop.toAccountValue']}" />
<h:inputText styleClass="inputval" size="5" value="#{productShopView.cash}">
<f:ajax render="@form" event="valueChange" listener="#{productShopView.cashChanged}" />
</h:inputText>
</h:panelGrid>
<p:commandButton update="@form" action="#{productShopView.buyByCredit()}" value="#{i18n['shop.buyByCredit']}" />
<h:panelGrid columns="2" style="background-color: #{productShopView.balanceAfterTransaction lt 0?'lightcoral':'lightgreen'}">
<h:outputLabel value="#{i18n['shop.afterBalance']}" />
<h:outputText value="#{productShopView.balanceAfterTransaction}">
<f:convertNumber minFractionDigits="2" maxFractionDigits="2" />
</h:outputText>
</h:panelGrid> </h:panelGrid>
<h:outputScript library="primefaces" name="jquery/jquery.js" /> <p:commandButton ajax="false" action="#{productShopView.commitShoppingCart()}" value="#{i18n['shop.buy']}" />
</h:panelGroup>
</h:panelGrid>
<h:outputScript library="primefaces" name="jquery/jquery.js" />
</h:form>
<script>
var blipSnd = new Audio(
"#{request.contextPath}/resources/media/blip.mp3")
</h:form> $(function() {
<script> $("#shoppingcartform\\:barcode").focus();
var blipSnd = new Audio(
"#{request.contextPath}/resources/media/blip.mp3")
$(function() { });
$("#shoppingcartform\\:barcode").focus();
}); function blip() {
blipSnd.play();
function blip() { }
blipSnd.play();
}
function calc() { function calc() {
$("#returnval").val($("#inputval").val() - $(".inputval").text().replace(",",".")); $("#returnval").val(
} $("#inputval").val()
- $(".inputval").text().replace(",", "."));
}
function barcodeReadEvent(data) { function barcodeReadEvent(data) {
if (data.status == "success") { if (data.status == "success") {
$("[id$=shoppingcartform\\:barcode]").focus(); $("[id$=shoppingcartform\\:barcode]").focus();
} }
} }
</script> </script>
</composite:implementation> </composite:implementation>
</html> </html>
...@@ -822,29 +822,31 @@ salespoint.noSalesPoints = Amount ...@@ -822,29 +822,31 @@ salespoint.noSalesPoints = Amount
sendPicture.header = S sendPicture.header = S
shop.accountBalance = Credits shop.accountBalance = Credits
shop.actions = Actions shop.actions = Actions
shop.afterBalance = Balance after action shop.afterBalance = Balance after action
shop.barcode = Barcode shop.barcode = Barcode
shop.buy = Buy shop.buy = Buy
shop.buyCash = Buy by Cash shop.buyByCredit = Buy by credit
shop.buyCredit = Buy Credit shop.buyCash = Buy by Cash
shop.calcsubtotal = Calc Subtotal shop.buyCredit = Buy Credit
shop.cartPrice = Cart price shop.calcsubtotal = Calc Subtotal
shop.cash = Cash shop.cartPrice = Cart price
shop.cashBack = Back shop.cash = Cash
shop.cashGiven = Cash given shop.cashBack = Back
shop.cashback = Cashback shop.cashGiven = Cash given
shop.confirmCreditBuy = Are You sure ? shop.cashback = Cashback
shop.count = Q shop.confirmCreditBuy = Are You sure ?
shop.currentBalance = Current balance shop.count = Q
shop.price = price shop.currentBalance = Current balance
shop.product = Product shop.price = price
shop.readBarcode = Read shop.product = Product
shop.shop = Shop shop.readBarcode = Read
shop.totalPrice = Total shop.shop = Shop
shop.transactionTotal = Transaction total shop.shoppingcartCommitted = Products bought
shop.user = Selling to shop.totalPrice = Total
shop.transactionTotal = Transaction total
shop.user = Selling to
sidebar.bill.list = My bills sidebar.bill.list = My bills
sidebar.bill.listAll = All bills sidebar.bill.listAll = All bills
......
...@@ -805,29 +805,31 @@ salespoint.noSalesPoints = M\u00E4\u00E4r\u00E4 ...@@ -805,29 +805,31 @@ salespoint.noSalesPoints = M\u00E4\u00E4r\u00E4
sendPicture.header = L\u00E4het\u00E4 kuva sendPicture.header = L\u00E4het\u00E4 kuva
shop.accountBalance = Credits shop.accountBalance = Credits
shop.actions = Hallinta shop.actions = Hallinta
shop.afterBalance = Saldo tapahtuman j\u00E4lkeen shop.afterBalance = Saldo tapahtuman j\u00E4lkeen
shop.barcode = Viivakoodi shop.barcode = Viivakoodi
shop.buy = Osta shop.buy = Osta
shop.buyCash = K\u00E4teismaksu shop.buyByCredit = Maksa krediiteill\u00E4.
shop.buyCredit = Credit shop.buyCash = K\u00E4teismaksu
shop.calcsubtotal = Laske v\u00E4lisumma shop.buyCredit = Credit
shop.cartPrice = Korin hinta shop.calcsubtotal = Laske v\u00E4lisumma
shop.cash = K\u00E4teinen shop.cartPrice = Korin hinta
shop.cashBack = Vaihtoraha palautettu shop.cash = K\u00E4teinen
shop.cashGiven = K\u00E4teist\u00E4 saatu shop.cashBack = Vaihtoraha palautettu
shop.cashback = Takaisin shop.cashGiven = K\u00E4teist\u00E4 saatu
shop.confirmCreditBuy = Varmastikko ? shop.cashback = Takaisin
shop.count = Lkm shop.confirmCreditBuy = Varmastikko ?
shop.currentBalance = T\u00E4m\u00E4nhetkinen saldo shop.count = Lkm
shop.price = Hinta shop.currentBalance = T\u00E4m\u00E4nhetkinen saldo
shop.product = Tuote shop.price = Hinta
shop.readBarcode = Lue shop.product = Tuote
shop.toAccountValue = Tilille shop.readBarcode = Lue
shop.totalPrice = Yhteens\u00E4 shop.shoppingcartCommitted = Tuotteet ostettu
shop.transactionTotal = Tapahtuma yhteens\u00E4 shop.toAccountValue = Tilille
shop.user = Myyd\u00E4\u00E4n shop.totalPrice = Yhteens\u00E4
shop.transactionTotal = Tapahtuma yhteens\u00E4
shop.user = Myyd\u00E4\u00E4n
sidebar.bill.list = Omat laskut sidebar.bill.list = Omat laskut
sidebar.bill.listAll = Kaikki laskut sidebar.bill.listAll = Kaikki laskut
......
...@@ -132,7 +132,6 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -132,7 +132,6 @@ public class FoodWaveFoodView extends GenericCDIView {
* @return * @return
*/ */
public Bill createBillFromShoppingcart() { public Bill createBillFromShoppingcart() {
logger.warn("Committing shoppingcart for user {}, userid {}", userview.getSelectedUser().getWholeName());
Bill bill = new Bill(eventBean.getCurrentEvent(), userview.getSelectedUser()); Bill bill = new Bill(eventBean.getCurrentEvent(), userview.getSelectedUser());
bill.setOurReference(eventBean.getCurrentEvent().getName()); bill.setOurReference(eventBean.getCurrentEvent().getName());
...@@ -141,11 +140,11 @@ public class FoodWaveFoodView extends GenericCDIView { ...@@ -141,11 +140,11 @@ public class FoodWaveFoodView extends GenericCDIView {
bill.addProduct(shopitem.getProduct(), shopitem.getCount(), getFoodWave()); bill.addProduct(shopitem.getProduct(), shopitem.getCount(), getFoodWave());
} }
} }
logger.warn("Committing shoppingcart for user {}. Cart prize: {}", userview.getSelectedUser().getWholeName(), bill.getTotalPrice());
billBean.createBill(bill); billBean.createBill(bill);
// TODO: do this the right way
// TODO: do this right way
eventBean.flushCache(); eventBean.flushCache();
return bill; return bill;
......
...@@ -84,6 +84,13 @@ public class ProductShopView extends GenericCDIView { ...@@ -84,6 +84,13 @@ public class ProductShopView extends GenericCDIView {
private boolean allowStatistics = true; private boolean allowStatistics = true;
private String otherInfo; private String otherInfo;
public String buyByCredit()
{
cash = BigDecimal.ZERO;
payInstant = false;
return null;
}
public void initBillView() { public void initBillView() {
if (requirePermissions(ShopPermission.LIST_USERPRODUCTS) if (requirePermissions(ShopPermission.LIST_USERPRODUCTS)
&& shoppingcart == null) { && shoppingcart == null) {
...@@ -136,8 +143,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -136,8 +143,7 @@ public class ProductShopView extends GenericCDIView {
updateCartLimits(null); updateCartLimits(null);
LanEventProperty cashdefault = eventbean.getProperty(LanEventPropertyKey.SHOP_DEFAULT_CASH); LanEventProperty cashdefault = eventbean.getProperty(LanEventPropertyKey.SHOP_DEFAULT_CASH);
if (cashdefault == null || cashdefault.isBooleanValue()) if (cashdefault == null || cashdefault.isBooleanValue()) {
{
payInstant = true; payInstant = true;
} }
...@@ -292,7 +298,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -292,7 +298,7 @@ public class ProductShopView extends GenericCDIView {
addFaceMessage("productshop.billCreated"); addFaceMessage("productshop.billCreated");
cash = BigDecimal.ZERO; cash = BigDecimal.ZERO;
shoppingcart = null; shoppingcart = null;
billEditView.setBill(bill); boughtItems = null;
return "showCreatedBill"; return "showCreatedBill";
...@@ -314,21 +320,21 @@ public class ProductShopView extends GenericCDIView { ...@@ -314,21 +320,21 @@ public class ProductShopView extends GenericCDIView {
EventUser retuser = null; EventUser retuser = null;
for (ProductShopItem shopitem : shoppingcart) { for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) { if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
retuser = productBean.createAccountEvent(shopitem.getProduct(), retuser = productBean.createAccountEvent(shopitem.getProduct(), shopitem.getCount(), user).getUser();
shopitem.getCount(), user).getUser();
} }
} }
if (cash != null && cash.compareTo(BigDecimal.ZERO) != 0) { if (cash != null && cash.compareTo(BigDecimal.ZERO) != 0) {
Product credProd = productBean.findCreditProduct(); Product credProd = productBean.findCreditProduct();
retuser = productBean.createAccountEvent(credProd, cash, user) retuser = productBean.createAccountEvent(credProd, cash, user).getUser();
.getUser();
} }
if (retuser != null) { if (retuser != null) {
user = retuser; user = retuser;
} }
shoppingcart = null; shoppingcart = null;
boughtItems = null;
cash = BigDecimal.ZERO; cash = BigDecimal.ZERO;
super.addFaceMessage("shop.shoppingcartCommitted");
return null; return null;
} }
......
...@@ -95,7 +95,12 @@ public class LayoutView { ...@@ -95,7 +95,12 @@ public class LayoutView {
} }
public String getPagepath() { public String getPagepath() {
if (pagename == null) { if (pagename == null &&
context != null &&
context.getExternalContext() != null &&
context.getExternalContext().getRequest() != null &&
context.getExternalContext().getRequest() instanceof HttpServletRequest) {
HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest(); HttpServletRequest req = (HttpServletRequest) context.getExternalContext().getRequest();
String[] splitted = req.getServletPath().split("\\."); String[] splitted = req.getServletPath().split("\\.");
if (splitted.length > 0) { if (splitted.length > 0) {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!