Commit 2e0e359f by Tuukka Kivilahti

asdf

1 parent a24d2da5
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<persistence version="1.0" <persistence version="1.0"
xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"> xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="BortalDb" transaction-type="JTA"> <persistence-unit name="MoyaDb" transaction-type="JTA">
<jta-data-source>jdbc/moyaDb</jta-data-source> <jta-data-source>jdbc/moyaDb</jta-data-source>
<properties> <properties>
<property name="eclipselink.ddl-generation" value="create-tables" /> <property name="eclipselink.ddl-generation" value="create-tables" />
......
...@@ -96,6 +96,10 @@ public class Bill extends GenericEntity { ...@@ -96,6 +96,10 @@ public class Bill extends GenericEntity {
private String deliveryTerms = ""; private String deliveryTerms = "";
@Column(name = "delay_intrest", nullable = false) @Column(name = "delay_intrest", nullable = false)
private Integer delayIntrest = 11; private Integer delayIntrest = 11;
@Column(name = "expires", nullable = true)
@Temporal(TemporalType.TIMESTAMP)
private Calendar expires = null;
/** /**
* Notes for the event organisators about the bill. * Notes for the event organisators about the bill.
...@@ -200,11 +204,15 @@ public class Bill extends GenericEntity { ...@@ -200,11 +204,15 @@ public class Bill extends GenericEntity {
} }
public Bill(LanEvent event) { public Bill(LanEvent event) {
this();
this.event = event; this.event = event;
} }
public Bill() { public Bill() {
super(); super();
this.expires = Calendar.getInstance();
this.expires.setTimeInMillis((System.currentTimeMillis() + 1814400000l)); // 3vk
} }
public Calendar getDueDate() { public Calendar getDueDate() {
...@@ -378,6 +386,9 @@ public class Bill extends GenericEntity { ...@@ -378,6 +386,9 @@ public class Bill extends GenericEntity {
} }
public void setPaidDate(Date paidDate) { public void setPaidDate(Date paidDate) {
if(paidDate != null)
expires = null;
this.paidDate = paidDate; this.paidDate = paidDate;
} }
...@@ -425,4 +436,31 @@ public class Bill extends GenericEntity { ...@@ -425,4 +436,31 @@ public class Bill extends GenericEntity {
} }
return ret; return ret;
} }
public Calendar getExpires() {
return expires;
}
public void setExpires(Calendar expires) {
this.expires = expires;
}
public boolean isExpired() {
if(expires == null)
return false;
return Calendar.getInstance().after(expires);
}
public void markExpired() {
if(isExpired() || isPaid())
return;
expires = Calendar.getInstance();
}
} }
<!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" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" <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: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">
xmlns:users="http://java.sun.com/jsf/composite/tools/user" xmlns:c="http://java.sun.com/jsp/jstl/core">
<h:body> <h:body>
<ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml"> <ui:composition template="/layout/#{sessionHandler.layout}/template.xhtml">
<f:metadata> <f:metadata>
...@@ -104,7 +103,15 @@ ...@@ -104,7 +103,15 @@
</h:column> </h:column>
</h:dataTable> </h:dataTable>
<p:confirmDialog id="confirmDialog" message="#{i18n['generic.sure.message}" header="#{i18n['generic.sure.header']}" severity="alert" widgetVar="confirmation">
<p:commandButton id="confirm" value="#{i18n['generic.sure.yes']}" update="messages" oncomplete="confirmation.hide()" actionListener="#{billEditView.expireBill}" />
<p:commandButton id="decline" value="#{i18n['generic.sure.no']}" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
...@@ -23,10 +23,11 @@ ...@@ -23,10 +23,11 @@
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText> </h:outputText>
</ui:fragment> </ui:fragment>
<bill:showBill bill="#{billEditView.bill}" /> <bill:showBill bill="#{billEditView.bill}" />
<ui:fragment rendered="#{!billEditView.bill.paid and billEditView.verkkomaksuFiAvailable}"> <ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired and billEditView.verkkomaksuFiAvailable}">
<div id="svm-payment"> <div id="svm-payment">
<a href="#{billEditView.verkkomaksuFiToken.url}"> </a> <a href="#{billEditView.verkkomaksuFiToken.url}"> </a>
</div> </div>
...@@ -38,7 +39,7 @@ ...@@ -38,7 +39,7 @@
}); });
</script> </script>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{!billEditView.bill.paid and billEditView.checkoutFiAvailable}"> <ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired and billEditView.checkoutFiAvailable}">
<table border="0"> <table border="0">
<tr> <tr>
......
...@@ -11,7 +11,10 @@ ...@@ -11,7 +11,10 @@
<h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" /> <h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" />
<h:form rendered="#{billListView.bills.rowCount gt 0}"> <h:form rendered="#{billListView.bills.rowCount gt 0}">
<h:dataTable styleClass="bordertable" id="billList" value="#{billListView.bills}" var="bill">
<p:dataTable styleClass="bordertable" id="billList" value="#{billListView.bills}" var="bill"
rowStyleClass="#{bill.expired ? 'expired' : null}" >
<h:column rendered="#{billListView.canWriteBill}"> <h:column rendered="#{billListView.canWriteBill}">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.payer']}" /> <h:outputText value="${i18n['bill.payer']}" />
...@@ -51,7 +54,7 @@ ...@@ -51,7 +54,7 @@
<f:convertNumber currencyCode="EUR" maxFractionDigits="2" minFractionDigits="2" type="currency" /> <f:convertNumber currencyCode="EUR" maxFractionDigits="2" minFractionDigits="2" type="currency" />
</h:outputText> </h:outputText>
</h:column> </h:column>
<h:column> <h:column rendered="#{!bill.expired}">
<a href="#{request.contextPath}/PrintBill?billid=#{bill.id}" target="_blank">#{i18n['bill.printBill']}</a> <a href="#{request.contextPath}/PrintBill?billid=#{bill.id}" target="_blank">#{i18n['bill.printBill']}</a>
</h:column> </h:column>
<h:column> <h:column>
...@@ -71,7 +74,7 @@ ...@@ -71,7 +74,7 @@
<h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" /> <h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" />
</h:column> </h:column>
</h:dataTable> </p:dataTable>
</h:form> </h:form>
......
...@@ -10,7 +10,7 @@ ...@@ -10,7 +10,7 @@
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<h:panelGrid columns="2" columnClasses="topalign,topalign"> <h:panelGrid columns="2" columnClasses="topalign,topalign" style="#{bill.expired ? 'expired' : null}">
<h:panelGrid columns="2" columnClasses="topalign,topalign"> <h:panelGrid columns="2" columnClasses="topalign,topalign">
<h:outputLabel for="billnr" value="#{i18n['bill.billNumber']}:" /> <h:outputLabel for="billnr" value="#{i18n['bill.billNumber']}:" />
<h:outputText id="billnr" value="#{cc.attrs.bill.billNumber}" /> <h:outputText id="billnr" value="#{cc.attrs.bill.billNumber}" />
...@@ -33,6 +33,10 @@ ...@@ -33,6 +33,10 @@
<h:outputLabel for="noticetime" value="#{i18n['bill.noticetime']}:" /> <h:outputLabel for="noticetime" value="#{i18n['bill.noticetime']}:" />
<h:outputText id="noticetime" value="#{cc.attrs.bill.noticetime}" /> <h:outputText id="noticetime" value="#{cc.attrs.bill.noticetime}" />
<h:outputLabel rendered="#{cc.attrs.bill not null}" for="expires" value="#{i18n['bill.expires']}:" />
<h:outputText rendered="#{cc.attrs.bill not null}" id="expires" value="#{cc.attrs.bill.expires}" />
<h:outputText rendered="#{cc.attrs.bill.expired}" id="expired" value="#{i18n['bill.isExpired']}" />
</h:panelGrid> </h:panelGrid>
<h:panelGrid columns="2" columnClasses="topalign,topalign"> <h:panelGrid columns="2" columnClasses="topalign,topalign">
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Sat Mar 30 17:56:44 EET 2013
actionlog.create.header = Create new actionmessage actionlog.create.header = Create new actionmessage
actionlog.create.message = Message actionlog.create.message = Message
...@@ -14,6 +16,8 @@ actionlog.tasklist.header = Tasklist ...@@ -14,6 +16,8 @@ actionlog.tasklist.header = Tasklist
actionlog.time = Time actionlog.time = Time
actionlog.user = User actionlog.user = User
bill.save = Save
bortalApplication.BILL = Creating, and managing bills bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos bortalApplication.COMPO = Managing compos
bortalApplication.CONTENT = Product & shop management bortalApplication.CONTENT = Product & shop management
...@@ -76,6 +80,11 @@ error.error = You have encountered an error. ...@@ -76,6 +80,11 @@ error.error = You have encountered an error.
eventorg.create = Create eventorg.create = Create
generic.sure.header = Confirmation
generic.sure.message = Are you sure?
generic.sure.no = No
generic.sure.yes = Yes
global.cancel = Cancel global.cancel = Cancel
global.copyright = Codecrew Ry global.copyright = Codecrew Ry
global.notAuthorizedExecute = You are not authorized to do that!! global.notAuthorizedExecute = You are not authorized to do that!!
...@@ -95,8 +104,6 @@ loginerror.header = Login failed ...@@ -95,8 +104,6 @@ loginerror.header = Login failed
loginerror.message = Username of password incorrect. loginerror.message = Username of password incorrect.
loginerror.resetpassword = Reset password loginerror.resetpassword = Reset password
#Bill number
# Validationmessages
map.id = # map.id = #
navi.auth.login = frontpage navi.auth.login = frontpage
...@@ -136,6 +143,6 @@ resetMail.username = Username ...@@ -136,6 +143,6 @@ resetMail.username = Username
resetmailSent.body = Email has been sent containing a link where you can change the password. resetmailSent.body = Email has been sent containing a link where you can change the password.
resetmailSent.header = Email sent resetmailSent.header = Email sent
subnavi.cards = \t\t subnavi.cards = \u0009\u0009
user.unauthenticated = Kirjautumaton user.unauthenticated = Kirjautumaton
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Sat Mar 30 17:56:44 EET 2013
acc_line.eventuser = Customer acc_line.eventuser = Customer
acc_line.nick = Nick acc_line.nick = Nick
...@@ -75,6 +77,7 @@ bill.printBill = Print bill ...@@ -75,6 +77,7 @@ bill.printBill = Print bill
bill.receiverAddress = Receiver address bill.receiverAddress = Receiver address
bill.referenceNumberBase = Reference number base bill.referenceNumberBase = Reference number base
bill.referencenumber = Reference nr. bill.referencenumber = Reference nr.
bill.save = Save
bill.sentDate = Sent date bill.sentDate = Sent date
bill.show = Show bill.show = Show
bill.theirReference = Clients reference bill.theirReference = Clients reference
...@@ -274,6 +277,11 @@ game.gamepoints = Game points ...@@ -274,6 +277,11 @@ game.gamepoints = Game points
gamepoints = Gamepoints gamepoints = Gamepoints
generic.sure.header = Confirmation
generic.sure.message = Are you sure?
generic.sure.no = No
generic.sure.yes = Yes
global.cancel = Cancel global.cancel = Cancel
global.copyright = Codecrew Ry global.copyright = Codecrew Ry
global.eventname = Event name global.eventname = Event name
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) #Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number #Sat Mar 30 17:56:44 EET 2013
# Validationmessages
actionlog.create.header = Create new actionmessage actionlog.create.header = Create new actionmessage
actionlog.create.message = Message actionlog.create.message = Message
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Sat Mar 30 17:56:44 EET 2013
acc_line.eventuser = Asiakas acc_line.eventuser = Asiakas
acc_line.nick = Nimimerkki acc_line.nick = Nimimerkki
...@@ -77,6 +79,7 @@ bill.printBill = Tulosta lasku ...@@ -77,6 +79,7 @@ bill.printBill = Tulosta lasku
bill.receiverAddress = Kauppiaan osoite bill.receiverAddress = Kauppiaan osoite
bill.referenceNumberBase = Viitenumeropohja bill.referenceNumberBase = Viitenumeropohja
bill.referencenumber = Viitenumero bill.referencenumber = Viitenumero
bill.save = Tallenna
bill.sentDate = P\u00E4iv\u00E4ys bill.sentDate = P\u00E4iv\u00E4ys
bill.show = N\u00E4yt\u00E4 bill.show = N\u00E4yt\u00E4
bill.theirReference = Asiakkaan viite bill.theirReference = Asiakkaan viite
...@@ -274,6 +277,11 @@ game.gamepoints = Insomnia Game pisteet: ...@@ -274,6 +277,11 @@ game.gamepoints = Insomnia Game pisteet:
gamepoints = Pelipisteit\u00E4 gamepoints = Pelipisteit\u00E4
generic.sure.header = Varmistusikkuna
generic.sure.message = Oletko aivan varma?
generic.sure.no = Ei
generic.sure.yes = Kyll\u00E4
global.cancel = Peruuta global.cancel = Peruuta
global.copyright = Codecrew Ry global.copyright = Codecrew Ry
global.eventname = Tapahtumanimi global.eventname = Tapahtumanimi
......
#Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net) #Generated by ResourceBundle Editor (http://eclipse-rbe.sourceforge.net)
#Bill number #Sat Mar 30 17:56:44 EET 2013
# Validationmessages
actionlog.create.header = Luo uusi ActionMessage actionlog.create.header = Luo uusi ActionMessage
actionlog.create.message = Viesti actionlog.create.message = Viesti
......
...@@ -116,4 +116,23 @@ public class BillEditView extends GenericCDIView { ...@@ -116,4 +116,23 @@ public class BillEditView extends GenericCDIView {
public void setVmreturn(VerkkomaksutReturnEntry vmreturn) { public void setVmreturn(VerkkomaksutReturnEntry vmreturn) {
this.vmreturn = vmreturn; this.vmreturn = vmreturn;
} }
public String expireBill() {
bill.markExpired();
this.save();
return null;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!