Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
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 5e39268b
authored
Feb 24, 2014
by
Tuukka Kivilahti
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
configurable bill expire time
1 parent
1d4beab5
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
48 additions
and
7 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/EventBean.java
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/EventBeanLocal.java
code/MoyaDatabase/src/fi/codecrew/moya/model/Bill.java
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEventPropertyKey.java
code/MoyaWeb/WebContent/eventorg/editEvent.xhtml
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/EventBean.java
View file @
5e39268
...
@@ -187,6 +187,22 @@ public class EventBean implements EventBeanLocal {
...
@@ -187,6 +187,22 @@ public class EventBean implements EventBeanLocal {
public
LanEventProperty
getProperty
(
LanEventPropertyKey
property
)
{
public
LanEventProperty
getProperty
(
LanEventPropertyKey
property
)
{
return
eventPropertyFacade
.
find
(
getCurrentEvent
(),
property
);
return
eventPropertyFacade
.
find
(
getCurrentEvent
(),
property
);
}
}
@Override
public
long
getPropertyLong
(
LanEventPropertyKey
property
)
{
LanEventProperty
retProp
=
eventPropertyFacade
.
find
(
getCurrentEvent
(),
property
);
long
ret
=
0
;
if
(
retProp
==
null
)
{
ret
=
Long
.
parseLong
(
property
.
getDefaultvalue
());
}
else
{
ret
=
retProp
.
getLongValue
();
}
return
ret
;
}
@Override
@Override
public
String
getPropertyString
(
LanEventPropertyKey
property
)
public
String
getPropertyString
(
LanEventPropertyKey
property
)
...
...
code/MoyaBeansClient/ejbModule/fi/codecrew/moya/beans/EventBeanLocal.java
View file @
5e39268
...
@@ -35,5 +35,7 @@ public interface EventBeanLocal {
...
@@ -35,5 +35,7 @@ public interface EventBeanLocal {
List
<
LanEventPrivateProperty
>
getPrivateProperties
();
List
<
LanEventPrivateProperty
>
getPrivateProperties
();
LanEventPrivateProperty
saveOrCreatePrivateProperty
(
LanEventPrivateProperty
privateProperty
);
LanEventPrivateProperty
saveOrCreatePrivateProperty
(
LanEventPrivateProperty
privateProperty
);
long
getPropertyLong
(
LanEventPropertyKey
property
);
}
}
code/MoyaDatabase/src/fi/codecrew/moya/model/Bill.java
View file @
5e39268
...
@@ -195,24 +195,35 @@ public class Bill extends GenericEntity {
...
@@ -195,24 +195,35 @@ public class Bill extends GenericEntity {
return
total
;
return
total
;
}
}
public
Bill
(
LanEvent
event
,
EventUser
user
)
{
public
Bill
(
LanEvent
event
,
EventUser
user
,
Calendar
expires
)
{
this
(
event
);
this
(
event
,
expires
);
this
.
setUser
(
user
);
this
.
setUser
(
user
);
this
.
setAddr1
(
user
.
getUser
().
getFirstnames
()
+
" "
+
user
.
getUser
().
getLastname
());
this
.
setAddr1
(
user
.
getUser
().
getFirstnames
()
+
" "
+
user
.
getUser
().
getLastname
());
this
.
setAddr2
(
user
.
getUser
().
getAddress
());
this
.
setAddr2
(
user
.
getUser
().
getAddress
());
this
.
setAddr3
(
user
.
getUser
().
getZip
()
+
" "
+
user
.
getUser
().
getTown
());
this
.
setAddr3
(
user
.
getUser
().
getZip
()
+
" "
+
user
.
getUser
().
getTown
());
}
}
public
Bill
(
LanEvent
event
)
{
public
Bill
(
LanEvent
event
,
Calendar
expires
)
{
this
();
this
();
this
.
expires
=
expires
;
this
.
event
=
event
;
this
.
event
=
event
;
}
}
public
Bill
(
LanEvent
event
,
EventUser
user
,
long
expireTimeHours
)
{
this
(
event
,
user
,
Calendar
.
getInstance
());
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
}
public
Bill
(
LanEvent
event
,
long
expireTimeHours
)
{
this
(
event
,
Calendar
.
getInstance
());
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
(
expireTimeHours
*
60
*
60
*
1000
)));
}
public
Bill
()
{
public
Bill
()
{
super
();
super
();
this
.
expires
=
Calendar
.
getInstance
();
this
.
expires
=
Calendar
.
getInstance
();
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
1814400000
l
));
// 3
vk
this
.
expires
.
setTimeInMillis
((
System
.
currentTimeMillis
()
+
1209600000
));
// 2
vk
}
}
public
Calendar
getDueDate
()
{
public
Calendar
getDueDate
()
{
...
...
code/MoyaDatabase/src/fi/codecrew/moya/model/LanEventPropertyKey.java
View file @
5e39268
...
@@ -17,6 +17,7 @@ public enum LanEventPropertyKey {
...
@@ -17,6 +17,7 @@ public enum LanEventPropertyKey {
CHECK_BILL_STATS_PERMISSION
(
Type
.
BOOL
,
null
),
CHECK_BILL_STATS_PERMISSION
(
Type
.
BOOL
,
null
),
GATHER_OTHER_BILL_INFO
(
Type
.
BOOL
,
null
),
GATHER_OTHER_BILL_INFO
(
Type
.
BOOL
,
null
),
ALLOW_BILLING
(
Type
.
BOOL
,
null
),
ALLOW_BILLING
(
Type
.
BOOL
,
null
),
BILL_EXPIRE_HOURS
(
Type
.
LONG
,
"168"
),
TEMPLATE_PROPERTY1
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY1
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY2
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY2
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY3
(
Type
.
TEXT
,
null
),
TEMPLATE_PROPERTY3
(
Type
.
TEXT
,
null
),
...
@@ -26,7 +27,7 @@ public enum LanEventPropertyKey {
...
@@ -26,7 +27,7 @@ public enum LanEventPropertyKey {
;
;
private
enum
Type
{
private
enum
Type
{
TEXT
,
DATE
,
DATA
,
BOOL
TEXT
,
DATE
,
DATA
,
BOOL
,
LONG
};
};
private
final
String
defaultvalue
;
private
final
String
defaultvalue
;
...
@@ -47,6 +48,10 @@ public enum LanEventPropertyKey {
...
@@ -47,6 +48,10 @@ public enum LanEventPropertyKey {
public
boolean
isBoolean
()
{
public
boolean
isBoolean
()
{
return
Type
.
BOOL
.
equals
(
type
);
return
Type
.
BOOL
.
equals
(
type
);
}
}
public
boolean
isLong
()
{
return
Type
.
LONG
.
equals
(
type
);
}
private
LanEventPropertyKey
(
Type
t
,
String
def
)
private
LanEventPropertyKey
(
Type
t
,
String
def
)
{
{
...
...
code/MoyaWeb/WebContent/eventorg/editEvent.xhtml
View file @
5e39268
...
@@ -130,6 +130,12 @@
...
@@ -130,6 +130,12 @@
<h:outputLabel
rendered=
"#{eventPropertyView.property.key.boolean}"
for=
"booleanval"
value=
"#{i18n['lanEventProperty.booleanValue']}"
/>
<h:outputLabel
rendered=
"#{eventPropertyView.property.key.boolean}"
for=
"booleanval"
value=
"#{i18n['lanEventProperty.booleanValue']}"
/>
<h:selectBooleanCheckbox
rendered=
"#{eventPropertyView.property.key.boolean}"
id=
"booleanval"
value=
"#{eventPropertyView.property.booleanValue}"
/>
<h:selectBooleanCheckbox
rendered=
"#{eventPropertyView.property.key.boolean}"
id=
"booleanval"
value=
"#{eventPropertyView.property.booleanValue}"
/>
<h:message
rendered=
"#{eventPropertyView.property.key.boolean}"
for=
"booleanval"
/>
<h:message
rendered=
"#{eventPropertyView.property.key.boolean}"
for=
"booleanval"
/>
<h:outputLabel
rendered=
"#{eventPropertyView.property.key.long}"
for=
"longval"
value=
"#{i18n['lanEventProperty.longValue']}"
/>
<h:inputText
rendered=
"#{eventPropertyView.property.key.long}"
id=
"longval"
value=
"#{eventPropertyView.property.longValue}"
>
<f:convertNumber
type=
"number"
/>
</h:inputText>
<h:message
rendered=
"#{eventPropertyView.property.key.long}"
for=
"longval"
/>
</h:panelGrid>
</h:panelGrid>
<h:commandButton
action=
"#{eventPropertyView.saveProperty}"
value=
"#{i18n['lanEventProperty.save']}"
/>
<h:commandButton
action=
"#{eventPropertyView.saveProperty}"
value=
"#{i18n['lanEventProperty.save']}"
/>
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/FoodWaveFoodView.java
View file @
5e39268
...
@@ -20,6 +20,7 @@ import fi.codecrew.moya.beans.ProductBeanLocal;
...
@@ -20,6 +20,7 @@ import fi.codecrew.moya.beans.ProductBeanLocal;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.enums.apps.ShopPermission
;
import
fi.codecrew.moya.model.Bill
;
import
fi.codecrew.moya.model.Bill
;
import
fi.codecrew.moya.model.FoodWave
;
import
fi.codecrew.moya.model.FoodWave
;
import
fi.codecrew.moya.model.LanEventPropertyKey
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.model.Product
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.GenericCDIView
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
import
fi.codecrew.moya.web.cdiview.user.UserView
;
...
@@ -133,7 +134,7 @@ public class FoodWaveFoodView extends GenericCDIView {
...
@@ -133,7 +134,7 @@ public class FoodWaveFoodView extends GenericCDIView {
* @return
* @return
*/
*/
public
Bill
createBillFromShoppingcart
()
{
public
Bill
createBillFromShoppingcart
()
{
Bill
bill
=
new
Bill
(
eventBean
.
getCurrentEvent
(),
userview
.
getSelectedUser
());
Bill
bill
=
new
Bill
(
eventBean
.
getCurrentEvent
(),
userview
.
getSelectedUser
()
,
eventBean
.
getPropertyLong
(
LanEventPropertyKey
.
BILL_EXPIRE_HOURS
)
);
bill
.
setOurReference
(
eventBean
.
getCurrentEvent
().
getName
());
bill
.
setOurReference
(
eventBean
.
getCurrentEvent
().
getName
());
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
for
(
ProductShopItem
shopitem
:
shoppingcart
)
{
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/ProductShopView.java
View file @
5e39268
...
@@ -296,7 +296,7 @@ public class ProductShopView extends GenericCDIView {
...
@@ -296,7 +296,7 @@ public class ProductShopView extends GenericCDIView {
return
null
;
return
null
;
}
}
Bill
bill
=
new
Bill
(
eventbean
.
getCurrentEvent
(),
user
);
Bill
bill
=
new
Bill
(
eventbean
.
getCurrentEvent
(),
user
,
eventbean
.
getPropertyLong
(
LanEventPropertyKey
.
BILL_EXPIRE_HOURS
)
);
bill
.
setNotes
(
otherInfo
);
bill
.
setNotes
(
otherInfo
);
bill
.
setOurReference
(
eventbean
.
getCurrentEvent
().
getName
());
bill
.
setOurReference
(
eventbean
.
getCurrentEvent
().
getName
());
...
...
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