Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Codecrew
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
30
Merge Requests
2
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 2dd9952d
authored
Oct 24, 2013
by
Antti Tonkyra
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'devel' of codecrew.fi:bortal into devel
2 parents
bedccdd5
e999a1c9
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
63 additions
and
47 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/PrintedCardFacade.java
code/MoyaWeb/WebContent/foodmanager/listOrders.xhtml
code/MoyaWeb/WebContent/resources/cditools/reader/readerevents.xhtml
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/MenuBean.java
View file @
2dd9952
...
...
@@ -124,7 +124,7 @@ public class MenuBean implements MenuBeanLocal {
MenuNavigation
tournaments
=
usermenu
.
addPage
(
null
,
null
);
tournaments
.
setKey
(
"tournaments.menutitle"
);
tournaments
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/index"
),
TournamentPermission
.
VIEW
);
tournaments
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/tournaments/showrules"
),
TournamentPermission
.
VIEW
);
/*
* MenuNavigation createuser = usermenu.addPage(null, null);
* createuser.setKey("topnavi.createuser");
...
...
@@ -145,6 +145,8 @@ public class MenuBean implements MenuBeanLocal {
adminuser
.
setKey
(
"topnavi.usermgmt"
);
adminuser
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/useradmin/list"
),
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/changePassword"
),
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 {
adminShopProducts
.
setKey
(
"subnavi.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/edit"
),
ShopPermission
.
MANAGE_PRODUCTS
).
setVisible
(
false
);
;
MenuNavigation
foodnavi
=
adminshop
.
addPage
(
null
,
null
);
foodnavi
.
setKey
(
"topnavi.foodwave"
);
...
...
@@ -190,6 +194,7 @@ public class MenuBean implements MenuBeanLocal {
adminShopReaders
.
setKey
(
"subnavi.readers"
);
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/editReader"
),
ShopPermission
.
SHOP_TO_OTHERS
).
setVisible
(
false
);
MenuNavigation
adminShopBilling
=
adminshop
.
addPage
(
null
,
null
);
adminShopBilling
.
setKey
(
"subnavi.billing"
);
...
...
@@ -232,7 +237,7 @@ public class MenuBean implements MenuBeanLocal {
gamenavi
.
setKey
(
"topnavi.license"
);
gamenavi
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/license/manageCodes"
),
LicensePermission
.
MANAGE
);
adminevent
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/eventorg/
lis
t"
),
EventPermission
.
MANAGE_PROPERTIES
);
adminevent
.
addPage
(
menuitemfacade
.
findOrCreate
(
"/eventorg/
editEven
t"
),
EventPermission
.
MANAGE_PROPERTIES
);
navifacade
.
create
(
adminmenu
);
...
...
code/MoyaBeans/ejbModule/fi/codecrew/moya/facade/PrintedCardFacade.java
View file @
2dd9952
...
...
@@ -41,7 +41,10 @@ public class PrintedCardFacade extends IntegerPkGenericFacade<PrintedCard> {
CriteriaQuery
<
PrintedCard
>
cq
=
cb
.
createQuery
(
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
()));
return
getSingleNullableResult
(
getEm
().
createQuery
(
cq
));
...
...
code/MoyaWeb/WebContent/foodmanager/listOrders.xhtml
View file @
2dd9952
...
...
@@ -44,7 +44,7 @@
<h:outputLabel
value=
"#{i18n['acc_line.eventuser']}"
/>
</f:facet>
<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>
</p:column>
<p:column
sortBy=
"#{acc_line.user.nick}"
>
...
...
@@ -52,7 +52,7 @@
<h:outputLabel
value=
"#{i18n['acc_line.nick']}"
/>
</f:facet>
<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>
</p:column>
<p:column
sortBy=
"#{acc_line.eventDelivered}"
>
...
...
@@ -100,7 +100,7 @@
<h:outputLabel
value=
"#{i18n['billLine.eventuser']}"
/>
</f:facet>
<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>
</p:column>
<p:column
sortBy=
"#{bill_line.bill.user.nick}"
>
...
...
@@ -108,7 +108,7 @@
<h:outputLabel
value=
"#{i18n['billLine.nick']}"
/>
</f:facet>
<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>
</p:column>
<p:column
sortBy=
"#{bill_line.linePrice}"
>
...
...
code/MoyaWeb/WebContent/resources/cditools/reader/readerevents.xhtml
View file @
2dd9952
...
...
@@ -58,16 +58,15 @@
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</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}"
/>
</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']}"
>
<f:param
name=
"eventid"
value=
"#{event.id}"
/>
</h:link>
-->
</h:link>
</h:column>
</h:dataTable>
...
...
code/MoyaWeb/WebContent/resources/cditools/shop/shoppingcart.xhtml
View file @
2dd9952
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"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"
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:reader=
"http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p=
"http://primefaces.org/ui"
<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: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:reader=
"http://java.sun.com/jsf/composite/cditools/reader"
xmlns:p=
"http://primefaces.org/ui"
>
>
<composite:interface>
</composite:interface>
<composite:interface>
</composite:interface>
<composite:implementation>
<composite:implementation>
<h:form
id=
"shoppingcartform"
>
<h:form
id=
"shoppingcartform"
>
<h:panelGrid
columns=
"2"
style=
"width:100%;"
columnClasses=
"shopProductbuttons,topalign"
>
<h:panelGroup>
...
...
@@ -97,24 +92,24 @@
</div>
<h:panelGrid
columns=
"2"
>
<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>
<h:outputLabel
value=
"#{i18n['shop.cashGiven']}"
/>
<input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
disabled=
"disabled"
/>
<h:outputLabel
value=
"#{i18n['shop.cashBack']}"
/>
<input
id=
"returnval"
type=
"text"
size=
"5"
value=
"0"
disabled=
"disabled"
/>
<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
/>
<h:outputText
value=
"
#{productShopView.balanceAfterTransaction}"
>
<f:convertNumber
minFractionDigits=
"2"
maxFractionDigits=
"2"
/>
</h:outputText>
</h:panelGrid>
<h:commandButton
action=
"#{productShopView.commitShoppingCart()}"
value=
"#{i18n['shop.buy']}"
/>
<p:commandButton
ajax=
"false"
action=
"#{productShopView.commitShoppingCart()}"
value=
"#{i18n['shop.buy']}"
/>
</h:panelGroup>
</h:panelGrid>
...
...
@@ -136,11 +131,11 @@
}
function
calc
()
{
$
(
"#returnval"
).
val
(
$
(
"#inputval"
).
val
()
-
$
(
".inputval"
).
text
().
replace
(
","
,
"."
));
$
(
"#returnval"
).
val
(
$
(
"#inputval"
).
val
()
-
$
(
".inputval"
).
text
().
replace
(
","
,
"."
));
}
function
barcodeReadEvent
(
data
)
{
if
(
data
.
status
==
"success"
)
{
$
(
"[id$=shoppingcartform\\:barcode]"
).
focus
();
...
...
@@ -149,6 +144,6 @@
</script>
</composite:implementation>
</composite:implementation>
</html>
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_en.properties
View file @
2dd9952
...
...
@@ -827,6 +827,7 @@ shop.actions = Actions
shop.afterBalance
=
Balance after action
shop.barcode
=
Barcode
shop.buy
=
Buy
shop.buyByCredit
=
Buy by credit
shop.buyCash
=
Buy by Cash
shop.buyCredit
=
Buy Credit
shop.calcsubtotal
=
Calc Subtotal
...
...
@@ -842,6 +843,7 @@ shop.price = price
shop.product
=
Product
shop.readBarcode
=
Read
shop.shop
=
Shop
shop.shoppingcartCommitted
=
Products bought
shop.totalPrice
=
Total
shop.transactionTotal
=
Transaction total
shop.user
=
Selling to
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
2dd9952
...
...
@@ -810,6 +810,7 @@ shop.actions = Hallinta
shop.afterBalance
=
Saldo tapahtuman j
\u
00E4lkeen
shop.barcode
=
Viivakoodi
shop.buy
=
Osta
shop.buyByCredit
=
Maksa krediiteill
\u
00E4.
shop.buyCash
=
K
\u
00E4teismaksu
shop.buyCredit
=
Credit
shop.calcsubtotal
=
Laske v
\u
00E4lisumma
...
...
@@ -824,6 +825,7 @@ shop.currentBalance = T\u00E4m\u00E4nhetkinen saldo
shop.price
=
Hinta
shop.product
=
Tuote
shop.readBarcode
=
Lue
shop.shoppingcartCommitted
=
Tuotteet ostettu
shop.toAccountValue
=
Tilille
shop.totalPrice
=
Yhteens
\u
00E4
shop.transactionTotal
=
Tapahtuma yhteens
\u
00E4
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
View file @
2dd9952
...
...
@@ -132,7 +132,6 @@ public class FoodWaveFoodView extends GenericCDIView {
* @return
*/
public
Bill
createBillFromShoppingcart
()
{
logger
.
warn
(
"Committing shoppingcart for user {}, userid {}"
,
userview
.
getSelectedUser
().
getWholeName
());
Bill
bill
=
new
Bill
(
eventBean
.
getCurrentEvent
(),
userview
.
getSelectedUser
());
bill
.
setOurReference
(
eventBean
.
getCurrentEvent
().
getName
());
...
...
@@ -141,11 +140,11 @@ public class FoodWaveFoodView extends GenericCDIView {
bill
.
addProduct
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
getFoodWave
());
}
}
logger
.
warn
(
"Committing shoppingcart for user {}. Cart prize: {}"
,
userview
.
getSelectedUser
().
getWholeName
(),
bill
.
getTotalPrice
());
billBean
.
createBill
(
bill
);
// TODO: do this right way
// TODO: do this the right way
eventBean
.
flushCache
();
return
bill
;
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
View file @
2dd9952
...
...
@@ -84,6 +84,13 @@ public class ProductShopView extends GenericCDIView {
private
boolean
allowStatistics
=
true
;
private
String
otherInfo
;
public
String
buyByCredit
()
{
cash
=
BigDecimal
.
ZERO
;
payInstant
=
false
;
return
null
;
}
public
void
initBillView
()
{
if
(
requirePermissions
(
ShopPermission
.
LIST_USERPRODUCTS
)
&&
shoppingcart
==
null
)
{
...
...
@@ -136,8 +143,7 @@ public class ProductShopView extends GenericCDIView {
updateCartLimits
(
null
);
LanEventProperty
cashdefault
=
eventbean
.
getProperty
(
LanEventPropertyKey
.
SHOP_DEFAULT_CASH
);
if
(
cashdefault
==
null
||
cashdefault
.
isBooleanValue
())
{
if
(
cashdefault
==
null
||
cashdefault
.
isBooleanValue
())
{
payInstant
=
true
;
}
...
...
@@ -292,7 +298,7 @@ public class ProductShopView extends GenericCDIView {
addFaceMessage
(
"productshop.billCreated"
);
cash
=
BigDecimal
.
ZERO
;
shoppingcart
=
null
;
b
illEditView
.
setBill
(
bill
)
;
b
oughtItems
=
null
;
return
"showCreatedBill"
;
...
...
@@ -314,21 +320,21 @@ public class ProductShopView extends GenericCDIView {
EventUser
retuser
=
null
;
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
if
(
shopitem
.
getCount
().
compareTo
(
BigDecimal
.
ZERO
)
>
0
)
{
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
retuser
=
productBean
.
createAccountEvent
(
shopitem
.
getProduct
(),
shopitem
.
getCount
(),
user
).
getUser
();
}
}
if
(
cash
!=
null
&&
cash
.
compareTo
(
BigDecimal
.
ZERO
)
!=
0
)
{
Product
credProd
=
productBean
.
findCreditProduct
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
)
.
getUser
();
retuser
=
productBean
.
createAccountEvent
(
credProd
,
cash
,
user
).
getUser
();
}
if
(
retuser
!=
null
)
{
user
=
retuser
;
}
shoppingcart
=
null
;
boughtItems
=
null
;
cash
=
BigDecimal
.
ZERO
;
super
.
addFaceMessage
(
"shop.shoppingcartCommitted"
);
return
null
;
}
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/helper/LayoutView.java
View file @
2dd9952
...
...
@@ -95,7 +95,12 @@ public class LayoutView {
}
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
();
String
[]
splitted
=
req
.
getServletPath
().
split
(
"\\."
);
if
(
splitted
.
length
>
0
)
{
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment