Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Riina Antikainen
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 97d4f159
authored
Jun 09, 2015
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change Bill.sentDate from Calendar to Date
1 parent
83c14b71
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
17 changed files
with
77 additions
and
118 deletions
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/DiscountBeanLocal.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/ProductBeanLocal.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/CheckoutFiBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/DiscountBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ProductPBean.java
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
code/moya-beans/src/test/java/fi/codecrew/moya/beans/CheckoutFiBeanTest.java
code/moya-database/src/main/java/fi/codecrew/moya/model/Bill.java
code/moya-database/src/main/java/fi/codecrew/moya/model/Discount.java
code/moya-web/WebContent/bill/edit.xhtml
code/moya-web/WebContent/foodmanager/listOrders.xhtml
code/moya-web/WebContent/resources/cditools/bills/showBill.xhtml
code/moya-web/WebContent/resources/cditools/products/manageDiscount.xhtml
code/moya-web/src/main/java/fi/codecrew/moya/rest/placemap/v1/PlacemapRestViewV1.java
code/moya-web/src/main/java/fi/codecrew/moya/web/helper/ProductShopItemHelper.java
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/DiscountBeanLocal.java
View file @
97d4f15
...
...
@@ -20,6 +20,7 @@ package fi.codecrew.moya.beans;
import
java.math.BigDecimal
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
javax.ejb.Local
;
...
...
@@ -33,6 +34,6 @@ public interface DiscountBeanLocal {
Discount
save
(
Discount
discount
);
public
List
<
Discount
>
getActiveDiscountsByProduct
(
Product
product
,
BigDecimal
quantity
,
Calendar
time
,
EventUser
user
);
public
List
<
Discount
>
getActiveDiscountsByProduct
(
Product
product
,
BigDecimal
quantity
,
Date
time
,
EventUser
user
);
}
code/moya-beans-client/ejbModule/fi/codecrew/moya/beans/ProductBeanLocal.java
View file @
97d4f15
...
...
@@ -20,6 +20,7 @@ package fi.codecrew.moya.beans;
import
java.math.BigDecimal
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
...
...
@@ -53,7 +54,7 @@ public interface ProductBeanLocal {
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
);
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
overriddenUnitPrice
,
BigDecimal
quantity
,
EventUser
user
);
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
overriddenUnitPrice
,
BigDecimal
quantity
,
EventUser
user
);
// List<Discount> getActiveDiscounts(Product product, BigDecimal quantity);
...
...
@@ -67,7 +68,7 @@ public interface ProductBeanLocal {
Discount
save
(
Discount
discount
);
BigDecimal
calculateTotal
(
Product
product
,
BigDecimal
quantity
,
Calendar
date
,
EventUser
user
);
BigDecimal
calculateTotal
(
Product
product
,
BigDecimal
quantity
,
Date
date
,
EventUser
user
);
HashMap
<
Integer
,
BigDecimal
>
getProductLimit
(
Map
<
Integer
,
BigDecimal
>
prodCounts
,
EventUser
user
);
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/CheckoutFiBean.java
View file @
97d4f15
...
...
@@ -264,7 +264,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
final
StringBuilder
stamp
=
new
StringBuilder
();
stamp
.
append
(
bill
.
getId
());
stamp
.
append
(
STAMP_SPLITCHAR
);
stamp
.
append
(
bill
.
getSentDate
().
getTime
InMillis
()
/
1000
);
stamp
.
append
(
bill
.
getSentDate
().
getTime
()
/
1000
);
return
stamp
.
toString
();
}
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/DiscountBean.java
View file @
97d4f15
...
...
@@ -21,6 +21,7 @@ package fi.codecrew.moya.beans;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
javax.ejb.EJB
;
...
...
@@ -42,7 +43,7 @@ public class DiscountBean implements DiscountBeanLocal {
@EJB
private
DiscountFacade
discountfacade
;
@EJB
private
UserBean
userBean
;
...
...
@@ -58,47 +59,30 @@ public class DiscountBean implements DiscountBeanLocal {
}
@Override
public
List
<
Discount
>
getActiveDiscountsByProduct
(
Product
product
,
BigDecimal
quantity
,
Calendar
time
,
EventUser
user
)
{
ArrayList
<
Discount
>
ret
=
new
ArrayList
<
Discount
>();
for
(
Discount
d
:
product
.
getDiscounts
())
{
if
(
d
.
isActive
()
&&
(
d
.
getValidTo
()
==
null
||
d
.
getValidTo
().
after
(
time
))
&&
(
d
.
getValidFrom
()
==
null
||
d
.
getValidFrom
().
before
(
time
))
&&
(
d
.
getAmountMax
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
quantity
.
compareTo
(
d
.
getAmountMax
())
<=
0
)
&&
(
d
.
getAmountMin
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
quantity
.
compareTo
(
d
.
getAmountMin
())
>=
0
))
{
public
List
<
Discount
>
getActiveDiscountsByProduct
(
Product
product
,
BigDecimal
quantity
,
Date
time
,
EventUser
user
)
{
// plaah, there is role, must do stuff
if
(
d
.
getRole
()
!=
null
)
{
for
(
Role
role
:
userBean
.
localFindUsersRoles
(
user
))
{
if
(
d
.
getRole
().
equals
(
role
))
{
ret
.
add
(
d
);
}
}
}
else
{
ret
.
add
(
d
);
}
}
}
return
ret
;
}
ArrayList
<
Discount
>
ret
=
new
ArrayList
<
Discount
>();
for
(
Discount
d
:
product
.
getDiscounts
())
{
if
(
d
.
isActive
()
&&
(
d
.
getValidTo
()
==
null
||
d
.
getValidTo
().
after
(
time
))
&&
(
d
.
getValidFrom
()
==
null
||
d
.
getValidFrom
().
before
(
time
))
&&
(
d
.
getAmountMax
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
quantity
.
compareTo
(
d
.
getAmountMax
())
<=
0
)
&&
(
d
.
getAmountMin
().
compareTo
(
BigDecimal
.
ZERO
)
==
0
||
quantity
.
compareTo
(
d
.
getAmountMin
())
>=
0
))
{
// @Override
// public Discount create(String discountdesc) {
// LanEvent ev = eventbean.getCurrentEvent();
// Discount ret = new Discount(ev);
// ret.setShortdesc(discountdesc);
// ev.getDiscounts().add(ret);
// discountfacade.flush();
//
// // discountfacade.create(ret);
// // eventfacade.evict(eventbean.getCurrentEvent());
//
// return ret;
//
// }
// plaah, there is role, must do stuff
if
(
d
.
getRole
()
!=
null
)
{
for
(
Role
role
:
userBean
.
localFindUsersRoles
(
user
))
{
if
(
d
.
getRole
().
equals
(
role
))
{
ret
.
add
(
d
);
}
}
}
else
{
ret
.
add
(
d
);
}
}
}
return
ret
;
}
}
code/moya-beans/ejbModule/fi/codecrew/moya/beans/PlaceBean.java
View file @
97d4f15
...
...
@@ -176,7 +176,7 @@ public class PlaceBean implements PlaceBeanLocal {
BigDecimal
total
=
Bill
.
BILL_SCALED_ZERO_PRICE
;
Calendar
now
=
Calendar
.
getInstanc
e
();
Date
now
=
new
Dat
e
();
for
(
Entry
<
Product
,
Integer
>
entry
:
mockmap
.
entrySet
())
{
logger
.
debug
(
"Adding to price {} of {}"
,
entry
.
getValue
(),
entry
.
getKey
().
getName
());
if
(
entry
.
getKey
()
!=
null
)
{
...
...
@@ -350,7 +350,7 @@ public class PlaceBean implements PlaceBeanLocal {
}
for
(
Entry
<
Product
,
Integer
>
line
:
getPlaceProductcount
(
places
).
entrySet
())
{
productPBean
.
createAccountEvent
(
line
.
getKey
(),
new
BigDecimal
(
line
.
getValue
()),
user
,
Calendar
.
getInstanc
e
());
productPBean
.
createAccountEvent
(
line
.
getKey
(),
new
BigDecimal
(
line
.
getValue
()),
user
,
new
Dat
e
());
}
}
PlaceGroup
pg
=
new
PlaceGroup
(
event
,
Calendar
.
getInstance
(),
Calendar
.
getInstance
(),
true
);
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ProductBean.java
View file @
97d4f15
...
...
@@ -22,6 +22,7 @@ import java.math.BigDecimal;
import
java.math.RoundingMode
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
java.util.HashSet
;
import
java.util.Iterator
;
...
...
@@ -417,7 +418,7 @@ public class ProductBean implements ProductBeanLocal {
}
@Override
public
BigDecimal
calculateTotal
(
Product
product
,
BigDecimal
quantity
,
Calendar
date
,
EventUser
user
)
{
public
BigDecimal
calculateTotal
(
Product
product
,
BigDecimal
quantity
,
Date
date
,
EventUser
user
)
{
if
(
product
==
null
||
quantity
==
null
)
{
throw
new
RuntimeException
(
"Some parameter is null!"
);
}
...
...
@@ -478,7 +479,7 @@ public class ProductBean implements ProductBeanLocal {
@Override
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
)
{
user
=
eventUserFacade
.
reload
(
user
);
AccountEvent
ret
=
productPBean
.
createAccountEvent
(
product
,
quantity
,
user
,
Calendar
.
getInstanc
e
());
AccountEvent
ret
=
productPBean
.
createAccountEvent
(
product
,
quantity
,
user
,
new
Dat
e
());
cardTemplateBean
.
checkPrintedCard
(
user
);
return
ret
;
}
...
...
@@ -487,7 +488,7 @@ public class ProductBean implements ProductBeanLocal {
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
overriddenUnitPrice
,
BigDecimal
quantity
,
EventUser
user
)
{
user
=
eventUserFacade
.
reload
(
user
);
AccountEvent
ret
=
productPBean
.
createAccountEvent
(
product
,
overriddenUnitPrice
,
quantity
,
user
,
Calendar
.
getInstanc
e
(),
null
);
AccountEvent
ret
=
productPBean
.
createAccountEvent
(
product
,
overriddenUnitPrice
,
quantity
,
user
,
new
Dat
e
(),
null
);
cardTemplateBean
.
checkPrintedCard
(
user
);
return
ret
;
}
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ProductPBean.java
View file @
97d4f15
...
...
@@ -21,6 +21,7 @@ package fi.codecrew.moya.beans;
import
java.math.BigDecimal
;
import
java.util.ArrayList
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.List
;
import
javax.ejb.*
;
...
...
@@ -73,7 +74,7 @@ public class ProductPBean {
// TODO Auto-generated constructor stub
}
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
,
Calendar
date
)
{
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
quantity
,
EventUser
user
,
Date
date
)
{
return
this
.
createAccountEvent
(
product
,
null
,
quantity
,
user
,
date
,
null
);
}
...
...
@@ -94,7 +95,7 @@ public class ProductPBean {
* AccountEvent creation time
* @return The created AccountEvent entity
*/
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
overriddenUnitPrice
,
BigDecimal
quantity
,
EventUser
user
,
Calendar
date
,
FoodWave
foodwave
)
{
public
AccountEvent
createAccountEvent
(
Product
product
,
BigDecimal
overriddenUnitPrice
,
BigDecimal
quantity
,
EventUser
user
,
Date
date
,
FoodWave
foodwave
)
{
if
(!
accounteventfacade
.
isAttached
(
product
))
{
product
=
productFacade
.
reload
(
product
);
...
...
code/moya-beans/ejbModule/fi/codecrew/moya/beans/ReaderBean.java
View file @
97d4f15
...
...
@@ -80,10 +80,9 @@ public class ReaderBean implements ReaderBeanLocal {
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
ReaderBean
.
class
);
@Override
public
ReaderEvent
checkCode
(
String
code
)
{
return
checkCode
(
ReaderType
.
BARCODE
.
toString
()
+
":handheld_reader_via_browser"
,
code
);
return
checkCode
(
ReaderType
.
BARCODE
.
toString
()
+
":handheld_reader_via_browser"
,
code
);
}
@Override
...
...
@@ -101,7 +100,7 @@ public class ReaderBean implements ReaderBeanLocal {
if
(
reader
==
null
||
code
==
null
||
code
.
isEmpty
())
{
return
null
;
}
logger
.
info
(
"got code from reader {}"
,
code
);
code
=
code
.
replace
(
"\"\b"
,
""
);
...
...
@@ -109,8 +108,8 @@ public class ReaderBean implements ReaderBeanLocal {
/**
* Some of rfid-readers adds zeros to start, some to end
*
* Also, under 16 char -rdid (the smaller one) should be 16 character
long,
*
with zeros on beginning.
* Also, under 16 char -rdid (the smaller one) should be 16 character
*
long, with zeros on beginning.
*/
if
(
ReaderType
.
RFID
.
equals
(
reader
.
getType
()))
{
...
...
@@ -126,7 +125,6 @@ public class ReaderBean implements ReaderBeanLocal {
code
=
sb
.
toString
();
}
ReaderEvent
event
=
new
ReaderEvent
(
new
Date
(),
reader
,
code
);
// first, check if dublicate, there is 30s timeout for dublicates,
...
...
@@ -189,7 +187,7 @@ public class ReaderBean implements ReaderBeanLocal {
if
(
reader
.
isAutoproduct
())
{
EventUser
eu
=
userbean
.
getEventUser
(
card
.
getUser
().
getUser
(),
false
);
if
(
eu
!=
null
)
{
AccountEvent
createAc
=
productPBean
.
createAccountEvent
(
reader
.
getAutomaticProduct
(),
reader
.
getAutomaticProductCount
(),
eu
,
Calendar
.
getInstanc
e
());
AccountEvent
createAc
=
productPBean
.
createAccountEvent
(
reader
.
getAutomaticProduct
(),
reader
.
getAutomaticProductCount
(),
eu
,
new
Dat
e
());
readerfacade
.
flush
();
logger
.
info
(
"Creating new accountevent from autoproduct {}"
,
createAc
);
event
.
setNotes
(
"Created automatic account event from reader. "
+
createAc
);
...
...
@@ -204,16 +202,13 @@ public class ReaderBean implements ReaderBeanLocal {
@Override
public
ReaderEvent
assocCodeToCard
(
ReaderEvent
readerEvent
,
PrintedCard
card
)
{
// you can select between this and flushCache.
card
=
cardfacade
.
reload
(
card
);
CardCode
code
=
new
CardCode
(
card
,
readerEvent
.
getReader
().
getType
(),
readerEvent
.
getValue
(),
eventbean
.
getCurrentEvent
());
cardCodeFacade
.
create
(
code
);
card
.
getCardCodes
().
add
(
code
);
...
...
code/moya-beans/src/test/java/fi/codecrew/moya/beans/CheckoutFiBeanTest.java
View file @
97d4f15
...
...
@@ -77,7 +77,7 @@ public class CheckoutFiBeanTest {
bill
.
setAddr2
(
"Hervannantie 1"
);
bill
.
setAddr3
(
"33600 Tampere"
);
bill
.
setAddr4
(
"FINLAND"
);
bill
.
setSentDate
Time
(
d
);
bill
.
setSentDate
(
d
);
Product
prod
=
new
Product
();
prod
.
setName
(
"Hurr"
);
prod
.
setPrice
(
BigDecimal
.
valueOf
(
111.11
).
setScale
(
4
,
RoundingMode
.
HALF_UP
));
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/Bill.java
View file @
97d4f15
...
...
@@ -120,7 +120,7 @@ public class Bill extends GenericEntity {
@Column
(
nullable
=
false
,
name
=
"sent_time"
)
@Temporal
(
TemporalType
.
TIMESTAMP
)
private
Calendar
sentDate
=
Calendar
.
getInstanc
e
();
private
Date
sentDate
=
new
Dat
e
();
@Column
(
name
=
"payment_time"
,
nullable
=
false
)
private
Integer
paymentTime
=
0
;
...
...
@@ -265,12 +265,12 @@ public class Bill extends GenericEntity {
this
.
expires
=
new
Date
(
System
.
currentTimeMillis
()
+
14
*
24
*
60
*
60
*
1000
);
// 2vk
}
public
Calendar
getDueDate
()
{
public
Date
getDueDate
()
{
Calendar
dueDate
=
Calendar
.
getInstance
();
dueDate
.
setTime
(
this
.
getSentDate
()
.
getTime
()
);
dueDate
.
setTime
(
this
.
getSentDate
());
dueDate
.
add
(
Calendar
.
DATE
,
this
.
getPaymentTime
());
return
dueDate
;
return
dueDate
.
getTime
()
;
}
public
String
getNotes
()
{
...
...
@@ -420,35 +420,11 @@ public class Bill extends GenericEntity {
this
.
paidDate
=
paidDate
;
}
public
Date
getSentDateTime
()
{
Date
ret
=
null
;
if
(
sentDate
!=
null
)
{
ret
=
sentDate
.
getTime
();
}
return
ret
;
}
public
void
setSentDateTime
(
Date
date
)
{
if
(
date
==
null
)
{
sentDate
=
null
;
}
else
{
if
(
sentDate
==
null
)
{
sentDate
=
Calendar
.
getInstance
();
}
sentDate
.
setTime
(
date
);
}
}
public
Calendar
getSentDate
()
{
public
Date
getSentDate
()
{
return
sentDate
;
}
public
void
setSentDate
(
Calendar
sentDate
)
{
public
void
setSentDate
(
Date
sentDate
)
{
this
.
sentDate
=
sentDate
;
}
...
...
code/moya-database/src/main/java/fi/codecrew/moya/model/Discount.java
View file @
97d4f15
This diff is collapsed.
Click to expand it.
code/moya-web/WebContent/bill/edit.xhtml
View file @
97d4f15
<!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:p=
"http://primefaces.org/ui"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:users=
"http://java.sun.com/jsf/composite/tools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:p=
"http://primefaces.org/ui"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:f=
"http://java.sun.com/jsf/core"
xmlns:users=
"http://java.sun.com/jsf/composite/tools/user"
xmlns:c=
"http://java.sun.com/jsp/jstl/core"
>
<h:body>
<ui:composition
template=
"#{sessionHandler.template}"
>
<f:metadata>
...
...
@@ -15,15 +16,15 @@
<h:form
id=
"billform"
>
<p:panelGrid
columns=
"2"
>
<h:outputLabel
for=
"billid"
value=
"#{i18n['bill.id']}:"
/>
<h:inputText
id=
"billid"
value=
"#{billEditView.bill.id}"
/>
<h:outputLabel
for=
"paidDate"
value=
"#{i18n['bill.paidDate']}:"
/>
<h:inputText
id=
"paidDate"
value=
"#{billEditView.bill.paidDate}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:inputText>
<h:outputLabel
for=
"billnr"
value=
"#{i18n['bill.billNumber']}:"
/>
<h:inputText
id=
"billnr"
value=
"#{billEditView.bill.billNumber}"
/>
...
...
@@ -43,9 +44,11 @@
<h:inputText
id=
"addr5"
value=
"#{billEditView.bill.addr5}"
/>
<h:outputLabel
for=
"sentDate"
value=
"#{i18n['bill.sentDate']}:"
/>
<h:inputText
id=
"sentDate"
value=
"#{billEditView.bill.sentDateTime}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:inputText>
<p:calendar
id=
"sentDate"
value=
"#{billEditView.bill.sentDate}"
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<h:outputLabel
for=
"expires"
value=
"#{i18n['bill.expires']}:"
/>
<p:calendar
id=
"expires"
value=
"#{billEditView.bill.expires}"
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
<h:outputLabel
for=
"paymenttime"
value=
"#{i18n['bill.paymentTime']}:"
/>
<h:inputText
id=
"paymenttime"
value=
"#{billEditView.bill.paymentTime}"
/>
...
...
code/moya-web/WebContent/foodmanager/listOrders.xhtml
View file @
97d4f15
...
...
@@ -78,11 +78,11 @@
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['foodWave.billLines']}"
/>
</f:facet>
<p:column
sortBy=
"#{bill.sentDate
.getTime()
}"
>
<p:column
sortBy=
"#{bill.sentDate}"
>
<f:facet
name=
"header"
>
<h:outputLabel
value=
"#{i18n['billLine.time']}"
/>
</f:facet>
<h:outputText
value=
"#{bill.sentDate
.getTime()
}"
>
<h:outputText
value=
"#{bill.sentDate}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
</p:column>
...
...
code/moya-web/WebContent/resources/cditools/bills/showBill.xhtml
View file @
97d4f15
...
...
@@ -29,7 +29,7 @@
</h:outputText>
<h:outputLabel
for=
"sentDate"
value=
"#{i18n['bill.sentDate']}:"
/>
<h:outputText
id=
"sentDate"
value=
"#{cc.attrs.bill.sentDate
Time
}"
>
<h:outputText
id=
"sentDate"
value=
"#{cc.attrs.bill.sentDate}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
...
...
@@ -40,7 +40,7 @@
<h:outputText
rendered=
"{!cc.attrs.bill.expired and sessionHandler.isEventBoolProperty('ALLOW_BILLING')}"
id=
"noticetime"
value=
"#{cc.attrs.bill.noticetime}"
/>
<h:outputLabel
rendered=
"#{cc.attrs.bill != null}"
for=
"expires"
value=
"#{i18n['bill.expires']}:"
/>
<h:outputText
rendered=
"#{cc.attrs.bill != null}"
id=
"expires"
value=
"#{cc.attrs.bill.expires
.time
}"
>
<h:outputText
rendered=
"#{cc.attrs.bill != null}"
id=
"expires"
value=
"#{cc.attrs.bill.expires}"
>
<f:convertDateTime
pattern=
"#{sessionHandler.datetimeFormat}"
timeZone=
"#{sessionHandler.timezone}"
/>
</h:outputText>
...
...
code/moya-web/WebContent/resources/cditools/products/manageDiscount.xhtml
View file @
97d4f15
...
...
@@ -50,11 +50,11 @@
<h:message
for=
"maxnum"
/>
<h:outputLabel
for=
"validFrom"
value=
"#{i18n['discount.validFrom']}:"
/>
<p:calendar
id=
"validFrom"
value=
"#{productView.discount.validFrom
Time
}"
style=
"simple"
pattern=
"#{sessionHandler.datetimeFormat}"
/>
<p:calendar
id=
"validFrom"
value=
"#{productView.discount.validFrom}"
style=
"simple"
pattern=
"#{sessionHandler.datetimeFormat}"
/>
<h:message
for=
"validFrom"
/>
<h:outputLabel
for=
"validTo"
value=
"#{i18n['discount.validTo']}:"
/>
<p:calendar
id=
"validTo"
value=
"#{productView.discount.validTo
Time
}"
style=
"simple"
pattern=
"#{sessionHandler.datetimeFormat}"
/>
<p:calendar
id=
"validTo"
value=
"#{productView.discount.validTo}"
style=
"simple"
pattern=
"#{sessionHandler.datetimeFormat}"
/>
<h:message
for=
"validTo"
/>
<h:outputLabel
for=
"active"
value=
"#{i18n['discount.active']}"
/>
...
...
code/moya-web/src/main/java/fi/codecrew/moya/rest/placemap/v1/PlacemapRestViewV1.java
View file @
97d4f15
...
...
@@ -17,25 +17,21 @@ import javax.ws.rs.core.MediaType;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response.ResponseBuilder
;
import
fi.codecrew.moya.enums.apps.MapPermission
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.codecrew.moya.beans.PermissionBeanLocal
;
import
fi.codecrew.moya.beans.PlaceBeanLocal
;
import
fi.codecrew.moya.beans.map.QueueBeanLocal
;
import
fi.codecrew.moya.beans.UserBeanLocal
;
import
fi.codecrew.moya.beans.map.QueueBeanLocal
;
import
fi.codecrew.moya.enums.apps.UserPermission
;
import
fi.codecrew.moya.model.EventMap
;
import
fi.codecrew.moya.model.EventUser
;
import
fi.codecrew.moya.model.Place
;
import
fi.codecrew.moya.model.User
;
import
fi.codecrew.moya.rest.PojoUtils
;
import
fi.codecrew.moya.rest.pojo.placemap.v1.IntegerRoot
;
import
fi.codecrew.moya.rest.pojo.placemap.v1.PlacemapMapRootPojo
;
import
fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacePojo
;
import
fi.codecrew.moya.rest.pojo.placemap.v1.SimplePlacelistRoot
;
import
fi.codecrew.moya.web.annotations.SelectedUser
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
@RequestScoped
...
...
@@ -102,17 +98,17 @@ public class PlacemapRestViewV1 {
{
EventMap
map
=
placebean
.
findMap
(
mapId
);
if
(!
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
))
{
if
(!
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
))
{
return
Response
.
status
(
Response
.
Status
.
FORBIDDEN
).
entity
(
"Try to login first!"
).
build
();
}
EventUser
user
=
userbean
.
findByUserId
(
userId
,
false
);
EventUser
user
=
userbean
.
findByUserId
(
userId
,
false
);
if
(
user
==
null
)
{
return
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
).
entity
(
"No User found for id: "
+
userId
).
build
();
return
Response
.
status
(
Response
.
Status
.
BAD_REQUEST
).
entity
(
"No User found for id: "
+
userId
).
build
();
}
return
Response
.
ok
(
PojoUtils
.
parseSimplePlaces
(
map
.
getPlaces
(),
user
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
),
true
)).
build
();
return
Response
.
ok
(
PojoUtils
.
parseSimplePlaces
(
map
.
getPlaces
(),
user
,
permbean
.
hasPermission
(
UserPermission
.
VIEW_ALL
),
true
)).
build
();
}
@GET
...
...
code/moya-web/src/main/java/fi/codecrew/moya/web/helper/ProductShopItemHelper.java
View file @
97d4f15
...
...
@@ -20,6 +20,7 @@ package fi.codecrew.moya.web.helper;
import
java.math.BigDecimal
;
import
java.util.Calendar
;
import
java.util.Date
;
import
java.util.HashMap
;
import
javax.ejb.EJB
;
...
...
@@ -51,7 +52,7 @@ public class ProductShopItemHelper extends GenericCDIView {
}
else
{
item
.
setInternalPrice
(
item
.
getProduct
().
getPrice
().
abs
().
multiply
(
item
.
getCount
()));
item
.
setInternalDiscounts
(
discountBean
.
getActiveDiscountsByProduct
(
item
.
getProduct
(),
item
.
getCount
(),
Calendar
.
getInstanc
e
(),
item
.
getUser
()));
item
.
setInternalDiscounts
(
discountBean
.
getActiveDiscountsByProduct
(
item
.
getProduct
(),
item
.
getCount
(),
new
Dat
e
(),
item
.
getUser
()));
item
.
setInternalDiscountValues
(
new
HashMap
<
Integer
,
BigDecimal
>());
...
...
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