Commit c8f22e56 by Antti Tönkyrä

Merge branch 'master' of codecrew.fi:bortal into tournament

2 parents 4218fe4c df8a84c0
Showing with 520 additions and 216 deletions
...@@ -6,3 +6,4 @@ ...@@ -6,3 +6,4 @@
/code/MoyaDatabase/src/fi/codecrew/moya/model/*/*_.java /code/MoyaDatabase/src/fi/codecrew/moya/model/*/*_.java
*~ *~
.metadata .metadata
/code/*/target/
...@@ -2,8 +2,12 @@ ...@@ -2,8 +2,12 @@
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish 3.1.2"/> <classpathentry kind="con" path="org.eclipse.jst.server.core.container/com.sun.enterprise.jst.server.runtimeTarget/GlassFish 3.1.2"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry combineaccessrules="false" kind="src" path="/MoyaAuthModuleClient"/> <classpathentry combineaccessrules="false" kind="src" path="/MoyaAuthModuleClient"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/auth-libs"/> <classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/auth-libs"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
#Fri Jul 16 17:41:25 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<faceted-project> <faceted-project>
<runtime name="GlassFish 3.1.2"/> <runtime name="GlassFish 3.1.2"/>
<installed facet="java" version="1.6"/> <installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
...@@ -7,10 +7,6 @@ ...@@ -7,10 +7,6 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
#Wed Oct 27 01:24:28 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.6"/> <installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
<attribute name="owner.project.facets" value="jst.ejb"/> <attribute name="owner.project.facets" value="jst.ejb"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/MoyaBeansClient"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
#Sat Dec 17 01:39:19 EET 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<runtime name="GlassFish 3.1.2"/> <runtime name="GlassFish 3.1.2"/>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="jst.ejb"/> <fixed facet="jst.ejb"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.ejb" version="3.1"/> <installed facet="jst.ejb" version="3.1"/>
<installed facet="sun.facet" version="9"/> <installed facet="sun.facet" version="9"/>
<installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
default.configuration=
eclipse.preferences.version=1
hibernate3.enabled=false
...@@ -10,10 +10,10 @@ import javax.ejb.Stateless; ...@@ -10,10 +10,10 @@ import javax.ejb.Stateless;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import com.sun.xml.bind.v2.model.core.ID;
import fi.codecrew.moya.facade.PrintedCardFacade; import fi.codecrew.moya.facade.PrintedCardFacade;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.User;
import fi.codecrew.moya.utilities.BarcodeUtils; import fi.codecrew.moya.utilities.BarcodeUtils;
/** /**
...@@ -23,12 +23,18 @@ import fi.codecrew.moya.utilities.BarcodeUtils; ...@@ -23,12 +23,18 @@ import fi.codecrew.moya.utilities.BarcodeUtils;
@LocalBean @LocalBean
public class BarcodeBean implements BarcodeBeanLocal { public class BarcodeBean implements BarcodeBeanLocal {
private static final String PRINTED_CARD_PREFIX = "277"; private static final String PRINTED_CARD_PREFIX = "277"; //2M
private static final String EVENTUSER_PREFIX = "279"; //2O
//private static final String NEXT_PREFIX = "289"; //2Y
//private static final String NEXT_PREFIX = "265"; //2A
private static final Logger logger = LoggerFactory.getLogger(BarcodeBean.class); private static final Logger logger = LoggerFactory.getLogger(BarcodeBean.class);
@EJB @EJB
PrintedCardFacade printedCardFacade; PrintedCardFacade printedCardFacade;
@EJB
UserBeanLocal userBean;
/** /**
* Default constructor. * Default constructor.
*/ */
...@@ -36,6 +42,21 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -36,6 +42,21 @@ public class BarcodeBean implements BarcodeBeanLocal {
// TODO Auto-generated constructor stub // TODO Auto-generated constructor stub
} }
public InputStream getUserBarcode(EventUser user) throws IOException {
StringBuilder sb = new StringBuilder();
sb.append(EVENTUSER_PREFIX);
String idStr = user.getId().toString();
for (int i = 12 - idStr.length() - sb.length(); i > 0; --i) {
sb.append("0");
}
sb.append(idStr);
String barcode = sb.toString();
logger.debug("Geneating barcode for user {} : {}", user, barcode);
return BarcodeUtils.getBarcodeEAN(barcode);
}
public InputStream getCardBarcode(PrintedCard printedCard) throws IOException { public InputStream getCardBarcode(PrintedCard printedCard) throws IOException {
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
sb.append(PRINTED_CARD_PREFIX); sb.append(PRINTED_CARD_PREFIX);
...@@ -69,4 +90,22 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -69,4 +90,22 @@ public class BarcodeBean implements BarcodeBeanLocal {
return printedCardFacade.findByBarcode(barcode); return printedCardFacade.findByBarcode(barcode);
} }
public EventUser getUser(String barcode) {
if(barcode == null || barcode.isEmpty())
return null;
// it's our special front barcode
try {
if (barcode.startsWith(EVENTUSER_PREFIX)) {
int id = Integer.parseInt(barcode.substring(3));
EventUser user = userBean.findByEventUserId(id);
return user;
}
} catch (NumberFormatException x) {
}
return null;
}
} }
package fi.codecrew.moya.beans; package fi.codecrew.moya.beans;
import java.io.IOException; import java.io.IOException;
import java.io.StringReader; import java.io.InputStream;
import java.io.StringWriter; import java.io.StringWriter;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -21,11 +20,13 @@ import javax.ejb.EJB; ...@@ -21,11 +20,13 @@ import javax.ejb.EJB;
import javax.ejb.EJBException; import javax.ejb.EJBException;
import javax.ejb.LocalBean; import javax.ejb.LocalBean;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils; import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.ClientProtocolException;
import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost; import org.apache.http.client.methods.HttpPost;
import org.apache.http.impl.client.DefaultHttpClient; import org.apache.http.impl.client.DefaultHttpClient;
...@@ -36,11 +37,8 @@ import org.w3c.dom.Document; ...@@ -36,11 +37,8 @@ import org.w3c.dom.Document;
import org.w3c.dom.Element; import org.w3c.dom.Element;
import org.w3c.dom.Node; import org.w3c.dom.Node;
import org.w3c.dom.NodeList; import org.w3c.dom.NodeList;
import org.xml.sax.InputSource;
import org.xml.sax.SAXException; import org.xml.sax.SAXException;
import com.sun.org.apache.xerces.internal.parsers.DOMParser;
import fi.codecrew.moya.checkoutfi.CheckoutFiParam; import fi.codecrew.moya.checkoutfi.CheckoutFiParam;
import fi.codecrew.moya.clientutils.BortalLocalContextHolder; import fi.codecrew.moya.clientutils.BortalLocalContextHolder;
import fi.codecrew.moya.enums.apps.BillPermission; import fi.codecrew.moya.enums.apps.BillPermission;
...@@ -94,10 +92,25 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -94,10 +92,25 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
|| merchantPassword == null || merchantPassword.isEmpty()); || merchantPassword == null || merchantPassword.isEmpty());
} }
public static void main(String[] asd) public static void main(String[] asd) throws ParserConfigurationException, SAXException, IOException
{ {
System.out.println(Calendar.getInstance().getTimeInMillis()); // DocumentBuilderFactory dbFactory =
System.out.println(Calendar.getInstance().getTimeInMillis() / 1000); // DocumentBuilderFactory.newInstance();
// DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
// Document doc = dBuilder.parse(xmlstr);
// // DOMParser parser = new DOMParser();
// // Document doc = parser.getDocument();
// // parser.parse(new InputSource(new StringReader(xmlReturn)));
// Element root = doc.getDocumentElement();
// root.normalize();
// // NodeList rootChildren = root.getChildNodes();
// // for (int i = 0; i < rootChildren.getLength(); ++i)
// // {
// // logger.info("Rootchild {}", rootChildren.item(i).getNodeName());
// // }
//
// Node payments = root.getElementsByTagName("banks").item(0);
} }
private static final String DATEFORMAT = "yyyyMMdd"; private static final String DATEFORMAT = "yyyyMMdd";
...@@ -168,8 +181,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -168,8 +181,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
try { try {
final String calculatedHash = PasswordFunctions.calculateMd5(mdString.toString()); final String calculatedHash = PasswordFunctions.calculateMd5(mdString.toString());
// logger.info("Calculated checksum {} from {}", logger.info("Calculated checksum {} from {}",
// mdString.toString(), calculatedHash); mdString.toString(), calculatedHash);
nameValuePairs.add(new BasicNameValuePair("MAC", calculatedHash)); nameValuePairs.add(new BasicNameValuePair("MAC", calculatedHash));
...@@ -188,12 +201,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -188,12 +201,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
return parseTokenXml(xmlReturn); return parseTokenXml(xmlReturn);
} catch (UnsupportedEncodingException e) {
logger.warn("Error sending checkout.fi request", e);
} catch (ClientProtocolException e) {
logger.warn("Error sending query to checkout.fi", e);
} catch (IOException e) { } catch (IOException e) {
logger.warn("Error sending query to checkout.fi", e); logger.warn("Error sending checkout.fi request", e);
} }
return null; return null;
...@@ -229,9 +238,15 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -229,9 +238,15 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
private static List<CheckoutBank> parseTokenXml(String xmlReturn) { private static List<CheckoutBank> parseTokenXml(String xmlReturn) {
try { try {
DOMParser parser = new DOMParser(); // DOMParser parser = new DOMParser();
parser.parse(new InputSource(new StringReader(xmlReturn))); // parser.parse(new InputSource(new StringReader(xmlReturn)));
Document doc = parser.getDocument(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
InputStream xmlstr = IOUtils.toInputStream(xmlReturn);
Document doc = dBuilder.parse(xmlstr);
// Document doc = parser.getDocument();
Element root = doc.getDocumentElement(); Element root = doc.getDocumentElement();
root.normalize(); root.normalize();
// NodeList rootChildren = root.getChildNodes(); // NodeList rootChildren = root.getChildNodes();
...@@ -258,12 +273,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -258,12 +273,8 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
} }
return retbanks; return retbanks;
} catch (SAXException e) { } catch (SAXException | IOException | ParserConfigurationException e) {
// TODO Auto-generated catch block logger.warn("Error parsing response from checkout response:" + xmlReturn, e);
e.printStackTrace();
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
} }
return null; return null;
} }
......
...@@ -8,12 +8,10 @@ import javax.annotation.security.RolesAllowed; ...@@ -8,12 +8,10 @@ import javax.annotation.security.RolesAllowed;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.ejb.Stateless; import javax.ejb.Stateless;
import sun.reflect.generics.reflectiveObjects.NotImplementedException; import fi.codecrew.moya.enums.apps.ShopPermission;
import fi.codecrew.moya.facade.FoodWaveFacade; import fi.codecrew.moya.facade.FoodWaveFacade;
import fi.codecrew.moya.facade.FoodWaveTemplateFacade; import fi.codecrew.moya.facade.FoodWaveTemplateFacade;
import fi.codecrew.moya.facade.ProductFacade; import fi.codecrew.moya.facade.ProductFacade;
import fi.codecrew.moya.beans.FoodWaveBeanLocal;
import fi.codecrew.moya.enums.apps.ShopPermission;
import fi.codecrew.moya.model.FoodWave; import fi.codecrew.moya.model.FoodWave;
import fi.codecrew.moya.model.FoodWaveTemplate; import fi.codecrew.moya.model.FoodWaveTemplate;
import fi.codecrew.moya.model.Product; import fi.codecrew.moya.model.Product;
...@@ -59,7 +57,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal { ...@@ -59,7 +57,7 @@ public class FoodWaveBean implements FoodWaveBeanLocal {
@Override @Override
public List<FoodWave> findShoppableFoodwaves() { public List<FoodWave> findShoppableFoodwaves() {
throw new NotImplementedException(); throw new java.lang.UnsupportedOperationException();
} }
@Override @Override
......
...@@ -175,7 +175,8 @@ public class PermissionBean implements PermissionBeanLocal { ...@@ -175,7 +175,8 @@ public class PermissionBean implements PermissionBeanLocal {
public boolean isLoggedIn() { public boolean isLoggedIn() {
Principal principal = context.getCallerPrincipal(); Principal principal = context.getCallerPrincipal();
boolean ret = principal != null && !User.ANONYMOUS_LOGINNAME.equalsIgnoreCase(principal.getName()); boolean ret = principal != null && !User.ANONYMOUS_LOGINNAME.equalsIgnoreCase(principal.getName());
logger.info("Checking principal {} against anon: {}", principal, ret); // logger.info("Checking principal {} against anon: {}", principal,
// ret);
return ret; return ret;
// return !getAnonEventUser().equals(getCurrentUser()) || // return !getAnonEventUser().equals(getCurrentUser()) ||
// getCurrentUser().getUser().isSuperadmin(); // getCurrentUser().getUser().isSuperadmin();
......
...@@ -483,7 +483,6 @@ public class PlaceBean implements PlaceBeanLocal { ...@@ -483,7 +483,6 @@ public class PlaceBean implements PlaceBeanLocal {
@RolesAllowed(MapPermission.S_BUY_PLACES) @RolesAllowed(MapPermission.S_BUY_PLACES)
public Place unbuyPlace(Place place) { public Place unbuyPlace(Place place) {
place = placeFacade.reload(place); place = placeFacade.reload(place);
if (place.getGroup() != null) { if (place.getGroup() != null) {
place.getGroup().getPlaces().remove(place); place.getGroup().getPlaces().remove(place);
} }
......
...@@ -21,21 +21,19 @@ import com.pdfjet.PDF; ...@@ -21,21 +21,19 @@ import com.pdfjet.PDF;
import com.pdfjet.Page; import com.pdfjet.Page;
import com.pdfjet.TextLine; import com.pdfjet.TextLine;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.facade.EventUserFacade; import fi.codecrew.moya.facade.EventUserFacade;
import fi.codecrew.moya.facade.GroupMembershipFacade; import fi.codecrew.moya.facade.GroupMembershipFacade;
import fi.codecrew.moya.facade.PlaceGroupFacade; import fi.codecrew.moya.facade.PlaceGroupFacade;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.LoggingBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceGroupBeanLocal;
import fi.codecrew.moya.beans.SecurityLogType;
import fi.codecrew.moya.enums.apps.MapPermission;
import fi.codecrew.moya.enums.apps.SpecialPermission;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership; import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.PlaceGroup; import fi.codecrew.moya.model.PlaceGroup;
import fi.codecrew.moya.model.User; import fi.codecrew.moya.model.User;
import fi.codecrew.moya.utilities.BarcodeUtils; import fi.codecrew.moya.utilities.BarcodeUtils;
import fi.codecrew.moya.utilities.I18n;
/** /**
* Session Bean implementation class PlaceGroupBean * Session Bean implementation class PlaceGroupBean
...@@ -50,6 +48,9 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal { ...@@ -50,6 +48,9 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
private EventBeanLocal eventbean; private EventBeanLocal eventbean;
@EJB @EJB
private BarcodeBeanLocal barcodeBean;
@EJB
private GroupMembershipFacade gmemfacade; private GroupMembershipFacade gmemfacade;
@EJB @EJB
private LoggingBeanLocal loggingbean; private LoggingBeanLocal loggingbean;
...@@ -134,6 +135,22 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal { ...@@ -134,6 +135,22 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
@RolesAllowed(SpecialPermission.S_USER) @RolesAllowed(SpecialPermission.S_USER)
public void getGroupMembershipPdf(EventUser usr, OutputStream ostream) { public void getGroupMembershipPdf(EventUser usr, OutputStream ostream) {
List<GroupMembership> memberships = getMembershipsAndCreations(usr); List<GroupMembership> memberships = getMembershipsAndCreations(usr);
LanEventProperty tmpProperty = eventbean.getProperty(LanEventPropertyKey.PLACECODE_FROM_USER);
boolean placecodeFromUser = false;
if (tmpProperty != null && tmpProperty.isBooleanValue())
{
placecodeFromUser = true;
}
tmpProperty = eventbean.getProperty(LanEventPropertyKey.PLACECODE_PRINT_ONLY_OWN);
boolean printOnlyOwn = false;
if (tmpProperty != null && tmpProperty.isBooleanValue())
{
printOnlyOwn = true;
}
try { try {
PDF pdf = new PDF(ostream); PDF pdf = new PDF(ostream);
Font font = new Font(pdf, CoreFont.TIMES_ROMAN); Font font = new Font(pdf, CoreFont.TIMES_ROMAN);
...@@ -149,15 +166,35 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal { ...@@ -149,15 +166,35 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
y = YSTART; y = YSTART;
} }
if(printOnlyOwn && (membership.getUser() == null || !membership.getUser().equals(usr))) {
continue;
}
// //
// PNGImage jpeg = new // PNGImage jpeg = new
// PNGImage(BarcodeBean.getBarcode(membership.getInviteToken())); // PNGImage(BarcodeBean.getBarcode(membership.getInviteToken()));
// logger.debug("Jpeg: " + jpeg.getWidth() + " h. " + // logger.debug("Jpeg: " + jpeg.getWidth() + " h. " +
// jpeg.getHeight()); // jpeg.getHeight());
if(placecodeFromUser) {
if(membership.getUser() != null) {
Image image = new Image(pdf, barcodeBean.getUserBarcode(membership.getUser()), ImageType.PNG);
image.scaleBy(0.8);
image.setPosition(50, y);
image.drawOn(page);
} else {
TextLine nouser = new TextLine(bigfont, "EMPTY PLACE" );
nouser.setPosition(85, y+10);
nouser.drawOn(page);
}
} else {
Image image = new Image(pdf, BarcodeUtils.getBarcode(membership.getInviteToken()), ImageType.PNG); Image image = new Image(pdf, BarcodeUtils.getBarcode(membership.getInviteToken()), ImageType.PNG);
image.scaleBy(0.8); image.scaleBy(0.8);
image.setPosition(50, y); image.setPosition(50, y);
image.drawOn(page); image.drawOn(page);
}
StringBuilder sb = new StringBuilder(); StringBuilder sb = new StringBuilder();
if (membership.getPlaceReservation().getName() != null) if (membership.getPlaceReservation().getName() != null)
......
...@@ -14,11 +14,8 @@ import javax.ejb.Stateless; ...@@ -14,11 +14,8 @@ import javax.ejb.Stateless;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.facade.SitePageFacade;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.SitePageBeanLocal;
import fi.codecrew.moya.enums.apps.ContentPermission; import fi.codecrew.moya.enums.apps.ContentPermission;
import fi.codecrew.moya.facade.SitePageFacade;
import fi.codecrew.moya.model.PageContent; import fi.codecrew.moya.model.PageContent;
import fi.codecrew.moya.model.Role; import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.model.SitePage; import fi.codecrew.moya.model.SitePage;
...@@ -122,6 +119,7 @@ public class SitePageBean implements SitePageBeanLocal { ...@@ -122,6 +119,7 @@ public class SitePageBean implements SitePageBeanLocal {
{ {
for (Role r : page.getAllowedRoles()) { for (Role r : page.getAllowedRoles()) {
if (roles.contains(r)) { if (roles.contains(r)) {
logger.debug("Has role for page {}, role {}", page, r);
ret = sitepagefacade.findContents(page, new Date()); ret = sitepagefacade.findContents(page, new Date());
break; break;
} }
......
...@@ -133,7 +133,7 @@ public class UserBean implements UserBeanLocal { ...@@ -133,7 +133,7 @@ public class UserBean implements UserBeanLocal {
EventUser ret = eventUserFacade.merge(user); EventUser ret = eventUserFacade.merge(user);
ctbean.checkPrintedCard(ret); ctbean.checkPrintedCard(ret);
currentEventuser = null; // currentEventuser = null;
return ret; return ret;
} }
...@@ -150,13 +150,15 @@ public class UserBean implements UserBeanLocal { ...@@ -150,13 +150,15 @@ public class UserBean implements UserBeanLocal {
} }
private EventUser currentEventuser; // private EventUser currentEventuser;
private ArrayList<Role> currentEventuserRoles; // private ArrayList<Role> currentEventuserRoles;
public ArrayList<Role> localFindUsersRoles(EventUser u) { public ArrayList<Role> localFindUsersRoles(EventUser u) {
if (currentEventuser != null && u.equals(currentEventuser)) { // if (currentEventuser != null && u.equals(currentEventuser)) {
return currentEventuserRoles; // logger.debug("Returnin cached eventuserroles for user {}: {}",
} // currentEventuser, currentEventuserRoles);
// return currentEventuserRoles;
// }
Set<Role> checkedRoles = new HashSet<Role>(); Set<Role> checkedRoles = new HashSet<Role>();
if (u != null) if (u != null)
{ {
...@@ -183,9 +185,12 @@ public class UserBean implements UserBeanLocal { ...@@ -183,9 +185,12 @@ public class UserBean implements UserBeanLocal {
} }
} }
} }
currentEventuser = u; // currentEventuser = u;
currentEventuserRoles = new ArrayList<Role>(checkedRoles); // currentEventuserRoles = new ArrayList<Role>(checkedRoles);
return currentEventuserRoles; // logger.debug("Returning parsed eventUser roles for user {}: {} ", u,
// currentEventuserRoles);
// return currentEventuserRoles;
return new ArrayList<Role>(checkedRoles);
} }
private static void addRecursive(Set<Role> checkedRoles, Collection<Role> roles) { private static void addRecursive(Set<Role> checkedRoles, Collection<Role> roles) {
......
...@@ -74,7 +74,7 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal { ...@@ -74,7 +74,7 @@ public class VerkkomaksutFiBean implements VerkkomaksutFiBeanLocal {
LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.VERKKOMAKSU_KEY_EXPIRE); LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.VERKKOMAKSU_KEY_EXPIRE);
String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_ID); String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_ID);
String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_PASSWORD); String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.VERKKOMAKSU_MERCHANT_PASSWORD);
return !((expire != null && new Date().after(expire.getDateValue())) return !((expire != null && expire.getDateValue() != null && new Date().after(expire.getDateValue()))
|| merchantid == null || merchantid.isEmpty() || merchantid == null || merchantid.isEmpty()
|| merchantPassword == null || merchantPassword.isEmpty()); || merchantPassword == null || merchantPassword.isEmpty());
} }
......
...@@ -22,7 +22,6 @@ import fi.codecrew.moya.facade.callbacks.EventUserAccountSaldoPredicate; ...@@ -22,7 +22,6 @@ import fi.codecrew.moya.facade.callbacks.EventUserAccountSaldoPredicate;
import fi.codecrew.moya.facade.callbacks.EventUserPlacegroupPredicate; import fi.codecrew.moya.facade.callbacks.EventUserPlacegroupPredicate;
import fi.codecrew.moya.facade.callbacks.EventUserRolefilter; import fi.codecrew.moya.facade.callbacks.EventUserRolefilter;
import fi.codecrew.moya.facade.callbacks.EventUserSearchPredicate; import fi.codecrew.moya.facade.callbacks.EventUserSearchPredicate;
import fi.codecrew.moya.facade.callbacks.FacadeCallback;
import fi.codecrew.moya.facade.callbacks.OrderCallback; import fi.codecrew.moya.facade.callbacks.OrderCallback;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.EventUser_; import fi.codecrew.moya.model.EventUser_;
...@@ -31,6 +30,7 @@ import fi.codecrew.moya.model.User; ...@@ -31,6 +30,7 @@ import fi.codecrew.moya.model.User;
import fi.codecrew.moya.model.User_; import fi.codecrew.moya.model.User_;
import fi.codecrew.moya.util.UserSearchQuery; import fi.codecrew.moya.util.UserSearchQuery;
import fi.codecrew.moya.utilities.SearchResult; import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
/** /**
* Session Bean implementation class EventUserFacade * Session Bean implementation class EventUserFacade
...@@ -71,10 +71,11 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> { ...@@ -71,10 +71,11 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> {
private EventUser checkCache(final String login, final LanEvent event) { private EventUser checkCache(final String login, final LanEvent event) {
if (!logincache.containsKey(event.getId())) if (!logincache.containsKey(event.getId()))
logincache.put(event.getId(), new HashMap<String, Integer>()); logincache.put(event.getId(), new HashMap<String, Integer>());
Integer euId = null; Integer euId = null;
EventUser ret = null; EventUser ret = null;
if ((euId = logincache.get(event.getId()).get(login)) != null) { if ((euId = logincache.get(event.getId()).get(login)) != null) {
ret = find(euId); ret = this.find(euId);
} }
return ret; return ret;
...@@ -101,8 +102,7 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> { ...@@ -101,8 +102,7 @@ public class EventUserFacade extends IntegerPkGenericFacade<EventUser> {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<EventUser> cq = cb.createQuery(EventUser.class); CriteriaQuery<EventUser> cq = cb.createQuery(EventUser.class);
Root<EventUser> root = cq.from(EventUser.class); Root<EventUser> root = cq.from(EventUser.class);
cq.where(cb.equal(root.get(EventUser_.event), cq.where(cb.equal(root.get(EventUser_.event), eventBean.getCurrentEvent()));
eventBean.getCurrentEvent()));
return getEm().createQuery(cq).getResultList(); return getEm().createQuery(cq).getResultList();
} }
......
package fi.codecrew.moya.facade; package fi.codecrew.moya.facade;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -11,11 +10,10 @@ import javax.persistence.criteria.CriteriaBuilder; ...@@ -11,11 +10,10 @@ import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import fi.codecrew.moya.model.FoodWaveTemplate_;
import fi.codecrew.moya.model.FoodWave_;
import fi.codecrew.moya.model.OrgRole_;
import fi.codecrew.moya.beans.EventBeanLocal; import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.model.FoodWave; import fi.codecrew.moya.model.FoodWave;
import fi.codecrew.moya.model.FoodWaveTemplate_;
import fi.codecrew.moya.model.FoodWave_;
@Stateless @Stateless
@LocalBean @LocalBean
...@@ -32,7 +30,7 @@ public class FoodWaveFacade extends IntegerPkGenericFacade<FoodWave> { ...@@ -32,7 +30,7 @@ public class FoodWaveFacade extends IntegerPkGenericFacade<FoodWave> {
CriteriaBuilder cb = getEm().getCriteriaBuilder(); CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<FoodWave> cq = cb.createQuery(FoodWave.class); CriteriaQuery<FoodWave> cq = cb.createQuery(FoodWave.class);
Root<FoodWave> root = cq.from(FoodWave.class); Root<FoodWave> root = cq.from(FoodWave.class);
cq.where( cb.equal(root.get(FoodWave_.template).get(FoodWaveTemplate_.event), eventBean.getCurrentEvent())); cq.where(cb.equal(root.get(FoodWave_.template).get(FoodWaveTemplate_.event), eventBean.getCurrentEvent()));
return getEm().createQuery(cq).getResultList(); return getEm().createQuery(cq).getResultList();
} }
......
...@@ -3,6 +3,7 @@ package fi.codecrew.moya.facade; ...@@ -3,6 +3,7 @@ package fi.codecrew.moya.facade;
import javax.persistence.EntityManager; import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext; import javax.persistence.PersistenceContext;
import fi.codecrew.moya.utilities.jpa.GenericFacade;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
/** /**
......
...@@ -15,7 +15,6 @@ import javax.persistence.metamodel.SingularAttribute; ...@@ -15,7 +15,6 @@ import javax.persistence.metamodel.SingularAttribute;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.facade.callbacks.FacadeCallback;
import fi.codecrew.moya.facade.callbacks.OrderCallback; import fi.codecrew.moya.facade.callbacks.OrderCallback;
import fi.codecrew.moya.facade.callbacks.StringSearchPredicateCreator; import fi.codecrew.moya.facade.callbacks.StringSearchPredicateCreator;
import fi.codecrew.moya.model.User_; import fi.codecrew.moya.model.User_;
...@@ -23,6 +22,7 @@ import fi.codecrew.moya.beans.EventBeanLocal; ...@@ -23,6 +22,7 @@ import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.model.User; import fi.codecrew.moya.model.User;
import fi.codecrew.moya.utilities.SearchQuery; import fi.codecrew.moya.utilities.SearchQuery;
import fi.codecrew.moya.utilities.SearchResult; import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
@Stateless @Stateless
@LocalBean @LocalBean
......
...@@ -9,6 +9,7 @@ import javax.persistence.criteria.From; ...@@ -9,6 +9,7 @@ import javax.persistence.criteria.From;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
public class AndPredicateCreator<A, T extends ModelInterface> implements FacadeCallback<T> { public class AndPredicateCreator<A, T extends ModelInterface> implements FacadeCallback<T> {
......
...@@ -10,6 +10,7 @@ import javax.persistence.criteria.Predicate; ...@@ -10,6 +10,7 @@ import javax.persistence.criteria.Predicate;
import fi.codecrew.moya.model.EventUser_; import fi.codecrew.moya.model.EventUser_;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent; import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
public class EventLimiter implements FacadeCallback<EventUser> { public class EventLimiter implements FacadeCallback<EventUser> {
......
...@@ -14,6 +14,7 @@ import fi.codecrew.moya.model.AccountEvent_; ...@@ -14,6 +14,7 @@ import fi.codecrew.moya.model.AccountEvent_;
import fi.codecrew.moya.enums.DatabaseValueCompare; import fi.codecrew.moya.enums.DatabaseValueCompare;
import fi.codecrew.moya.model.AccountEvent; import fi.codecrew.moya.model.AccountEvent;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
public class EventUserAccountSaldoPredicate implements FacadeCallback<EventUser> { public class EventUserAccountSaldoPredicate implements FacadeCallback<EventUser> {
private final DatabaseValueCompare compare; private final DatabaseValueCompare compare;
......
...@@ -9,6 +9,7 @@ import javax.persistence.criteria.Predicate; ...@@ -9,6 +9,7 @@ import javax.persistence.criteria.Predicate;
import fi.codecrew.moya.model.EventUser_; import fi.codecrew.moya.model.EventUser_;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
public class EventUserPlacegroupPredicate implements FacadeCallback<EventUser> { public class EventUserPlacegroupPredicate implements FacadeCallback<EventUser> {
......
...@@ -25,6 +25,7 @@ import fi.codecrew.moya.model.Product_; ...@@ -25,6 +25,7 @@ import fi.codecrew.moya.model.Product_;
import fi.codecrew.moya.model.Role_; import fi.codecrew.moya.model.Role_;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.Role; import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
public class EventUserRolefilter implements FacadeCallback<EventUser> { public class EventUserRolefilter implements FacadeCallback<EventUser> {
......
...@@ -11,6 +11,7 @@ import javax.persistence.metamodel.SingularAttribute; ...@@ -11,6 +11,7 @@ import javax.persistence.metamodel.SingularAttribute;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
public class OrPredicateCreator<A, T extends ModelInterface> implements FacadeCallback<T> { public class OrPredicateCreator<A, T extends ModelInterface> implements FacadeCallback<T> {
......
...@@ -9,6 +9,7 @@ import javax.persistence.criteria.Path; ...@@ -9,6 +9,7 @@ import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
public class OrderCallback<T extends ModelInterface> implements FacadeCallback<T> { public class OrderCallback<T extends ModelInterface> implements FacadeCallback<T> {
......
...@@ -10,6 +10,7 @@ import javax.persistence.criteria.Path; ...@@ -10,6 +10,7 @@ import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.metamodel.SingularAttribute; import javax.persistence.metamodel.SingularAttribute;
import fi.codecrew.moya.utilities.jpa.FacadeCallback;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
public abstract class PathStringSearchPredicateCreator<T extends ModelInterface, D extends ModelInterface> implements FacadeCallback<T> { public abstract class PathStringSearchPredicateCreator<T extends ModelInterface, D extends ModelInterface> implements FacadeCallback<T> {
......
...@@ -7,6 +7,11 @@ ...@@ -7,6 +7,11 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/MoyaDatabase"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
#Thu Oct 27 18:05:08 EEST 2011
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -4,5 +4,5 @@ ...@@ -4,5 +4,5 @@
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="java" version="1.6"/> <installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
...@@ -5,12 +5,16 @@ import java.io.InputStream; ...@@ -5,12 +5,16 @@ import java.io.InputStream;
import javax.ejb.Local; import javax.ejb.Local;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
@Local @Local
public interface BarcodeBeanLocal { public interface BarcodeBeanLocal {
public PrintedCard getPrintedCard(String barcode) ; public PrintedCard getPrintedCard(String barcode) ;
public EventUser getUser(String barcode);
public InputStream getUserBarcode(EventUser user) throws IOException;
public InputStream getCardBarcode(PrintedCard printedCard) throws IOException; public InputStream getCardBarcode(PrintedCard printedCard) throws IOException;
} }
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<classpath> <classpath>
<classpathentry kind="src" path="src"/> <classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<classpathentry kind="output" path="bin"/> <classpathentry kind="output" path="bin"/>
</classpath> </classpath>
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
org.eclipse.jdt.core.formatter.align_type_members_on_columns=false org.eclipse.jdt.core.formatter.align_type_members_on_columns=false
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_allocation_expression=16
org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0 org.eclipse.jdt.core.formatter.alignment_for_arguments_in_annotation=0
......
...@@ -6,5 +6,5 @@ ...@@ -6,5 +6,5 @@
<fixed facet="jpt.jpa"/> <fixed facet="jpt.jpa"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="jpt.jpa" version="2.0"/> <installed facet="jpt.jpa" version="2.0"/>
<installed facet="jst.java" version="1.6"/> <installed facet="jst.java" version="1.7"/>
</faceted-project> </faceted-project>
...@@ -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" />
......
...@@ -97,6 +97,10 @@ public class Bill extends GenericEntity { ...@@ -97,6 +97,10 @@ public class Bill extends GenericEntity {
@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,30 @@ public class Bill extends GenericEntity { ...@@ -425,4 +436,30 @@ 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();
}
} }
...@@ -6,6 +6,7 @@ import javax.persistence.GenerationType; ...@@ -6,6 +6,7 @@ import javax.persistence.GenerationType;
import javax.persistence.Id; import javax.persistence.Id;
import javax.persistence.MappedSuperclass; import javax.persistence.MappedSuperclass;
import fi.codecrew.moya.utilities.jpa.EntityEquals;
import fi.codecrew.moya.utilities.jpa.ModelInterface; import fi.codecrew.moya.utilities.jpa.ModelInterface;
@MappedSuperclass @MappedSuperclass
......
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
*/ */
package fi.codecrew.moya.model; package fi.codecrew.moya.model;
import static javax.persistence.CascadeType.ALL;
import java.util.Calendar; import java.util.Calendar;
import javax.persistence.CascadeType;
import javax.persistence.Column; import javax.persistence.Column;
import javax.persistence.Entity; import javax.persistence.Entity;
import javax.persistence.JoinColumn; import javax.persistence.JoinColumn;
...@@ -50,7 +49,7 @@ public class GroupMembership extends GenericEntity { ...@@ -50,7 +49,7 @@ public class GroupMembership extends GenericEntity {
@Column(name = "invite_name") @Column(name = "invite_name")
private String inviteName; private String inviteName;
@ManyToOne(optional = false, cascade = ALL) @ManyToOne(optional = false, cascade = CascadeType.PERSIST)
@JoinColumn(name = GROUP_ID, referencedColumnName = "id", nullable = false) @JoinColumn(name = GROUP_ID, referencedColumnName = "id", nullable = false)
private PlaceGroup placeGroup; private PlaceGroup placeGroup;
......
...@@ -8,7 +8,10 @@ public enum LanEventPropertyKey { ...@@ -8,7 +8,10 @@ public enum LanEventPropertyKey {
PORTAL_EMAIL_NAME(Type.TEXT, "Streamparty intranet"), PORTAL_EMAIL_NAME(Type.TEXT, "Streamparty intranet"),
ADMIN_MAIL(Type.TEXT, "intra@streamparty.org"), ADMIN_MAIL(Type.TEXT, "intra@streamparty.org"),
EVENT_LAYOUT(Type.TEXT, "template1"), EVENT_LAYOUT(Type.TEXT, "template1"),
SHOP_DEFAULT_CASH(Type.BOOL, null), ; SHOP_DEFAULT_CASH(Type.BOOL, null),
PLACECODE_FROM_USER(Type.BOOL, null),
PLACECODE_PRINT_ONLY_OWN(Type.BOOL, null),
;
private enum Type { private enum Type {
TEXT, DATE, DATA, BOOL TEXT, DATE, DATA, BOOL
}; };
...@@ -29,7 +32,7 @@ public enum LanEventPropertyKey { ...@@ -29,7 +32,7 @@ public enum LanEventPropertyKey {
} }
public boolean isBoolean() { public boolean isBoolean() {
return Type.DATA.equals(type); return Type.BOOL.equals(type);
} }
private LanEventPropertyKey(Type t, String def) private LanEventPropertyKey(Type t, String def)
......
...@@ -64,15 +64,14 @@ public class PlaceGroup extends GenericEntity { ...@@ -64,15 +64,14 @@ public class PlaceGroup extends GenericEntity {
@ManyToOne @ManyToOne
private EventUser creator; private EventUser creator;
@OneToMany(cascade = CascadeType.ALL, mappedBy = "placeGroup") @OneToMany(cascade = { CascadeType.PERSIST }, mappedBy = "placeGroup")
private List<GroupMembership> members = new ArrayList<GroupMembership>(); private List<GroupMembership> members = new ArrayList<GroupMembership>();
@OneToMany(mappedBy = "group") @OneToMany(mappedBy = "group")
@OrderBy("name") @OrderBy("name")
private List<Place> places; private List<Place> places;
public PlaceGroup(LanEvent event, Calendar groupCreated, Calendar groupEdited, public PlaceGroup(LanEvent event, Calendar groupCreated, Calendar groupEdited, boolean groupActive) {
boolean groupActive) {
this.event = event; this.event = event;
this.created = groupCreated; this.created = groupCreated;
this.edited = groupEdited; this.edited = groupEdited;
......
eclipse.preferences.version=1
encoding/<project>=UTF-8
...@@ -8,10 +8,6 @@ ...@@ -8,10 +8,6 @@
<attribute name="owner.project.facets" value="jst.web"/> <attribute name="owner.project.facets" value="jst.web"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7"/>
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<fixed facet="wst.jsdt.web"/> <fixed facet="wst.jsdt.web"/>
<fixed facet="jst.web"/> <fixed facet="jst.web"/>
<fixed facet="java"/> <fixed facet="java"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="3.0"/> <installed facet="jst.web" version="3.0"/>
<installed facet="sun.facet" version="9"/> <installed facet="sun.facet" version="9"/>
<installed facet="wst.jsdt.web" version="1.0"/> <installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
...@@ -7,6 +7,10 @@ ...@@ -7,6 +7,10 @@
<attribute name="owner.project.facets" value="jst.utility"/> <attribute name="owner.project.facets" value="jst.utility"/>
</attributes> </attributes>
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
#Sat Jun 12 05:34:28 EEST 2010
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -3,6 +3,6 @@ ...@@ -3,6 +3,6 @@
<runtime name="GlassFish 3.1.2"/> <runtime name="GlassFish 3.1.2"/>
<fixed facet="jst.java"/> <fixed facet="jst.java"/>
<fixed facet="jst.utility"/> <fixed facet="jst.utility"/>
<installed facet="jst.java" version="6.0"/>
<installed facet="jst.utility" version="1.0"/> <installed facet="jst.utility" version="1.0"/>
<installed facet="jst.java" version="1.7"/>
</faceted-project> </faceted-project>
package fi.codecrew.moya.model; package fi.codecrew.moya.utilities.jpa;
import java.util.Date; import java.util.Date;
import java.util.Random; import java.util.Random;
......
package fi.codecrew.moya.facade.callbacks; package fi.codecrew.moya.utilities.jpa;
import java.util.List; import java.util.List;
...@@ -7,7 +7,6 @@ import javax.persistence.criteria.CriteriaQuery; ...@@ -7,7 +7,6 @@ import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.From; import javax.persistence.criteria.From;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import fi.codecrew.moya.utilities.jpa.ModelInterface;
public interface FacadeCallback<C extends ModelInterface> { public interface FacadeCallback<C extends ModelInterface> {
......
package fi.codecrew.moya.facade; package fi.codecrew.moya.utilities.jpa;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections; import java.util.Collections;
...@@ -14,10 +14,8 @@ import javax.persistence.criteria.Path; ...@@ -14,10 +14,8 @@ import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate; import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root; import javax.persistence.criteria.Root;
import fi.codecrew.moya.facade.callbacks.FacadeCallback;
import fi.codecrew.moya.utilities.SearchQuery; import fi.codecrew.moya.utilities.SearchQuery;
import fi.codecrew.moya.utilities.SearchResult; import fi.codecrew.moya.utilities.SearchResult;
import fi.codecrew.moya.utilities.jpa.ModelInterface;
public abstract class GenericFacade<C extends ModelInterface> { public abstract class GenericFacade<C extends ModelInterface> {
......
...@@ -8,6 +8,11 @@ ...@@ -8,6 +8,11 @@
</classpathentry> </classpathentry>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.web.container"/>
<classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/> <classpathentry kind="con" path="org.eclipse.jst.j2ee.internal.module.container"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/> <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.7">
<attributes>
<attribute name="owner.project.facets" value="java"/>
</attributes>
</classpathentry>
<classpathentry combineaccessrules="false" kind="src" path="/MoyaBeansClient"/>
<classpathentry kind="output" path="build/classes"/> <classpathentry kind="output" path="build/classes"/>
</classpath> </classpath>
eclipse.preferences.version=1 eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.7
org.eclipse.jdt.core.compiler.compliance=1.6 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.7
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.6 org.eclipse.jdt.core.compiler.source=1.7
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
<fixed facet="jst.web"/> <fixed facet="jst.web"/>
<fixed facet="java"/> <fixed facet="java"/>
<fixed facet="wst.jsdt.web"/> <fixed facet="wst.jsdt.web"/>
<installed facet="java" version="1.6"/>
<installed facet="jst.web" version="3.0"/> <installed facet="jst.web" version="3.0"/>
<installed facet="sun.facet" version="9"/> <installed facet="sun.facet" version="9"/>
<installed facet="wst.jsdt.web" version="1.0"/> <installed facet="wst.jsdt.web" version="1.0"/>
<installed facet="java" version="1.7"/>
</faceted-project> </faceted-project>
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0"> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
id="WebApp_ID" version="3.0">
<display-name>LanBortalWeb</display-name> <display-name>LanBortalWeb</display-name>
<session-config> <session-config>
<session-timeout>120</session-timeout> <session-timeout>120</session-timeout>
</session-config> </session-config>
<context-param> <context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name> <param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value> <!-- Production | Development -->
<!-- <param-value>Production</param-value> --> <param-value>Production</param-value>
</context-param> </context-param>
<context-param> <context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name> <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
......
<!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: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">
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>
...@@ -15,7 +14,7 @@ ...@@ -15,7 +14,7 @@
<ui:define name="content"> <ui:define name="content">
<h:form id="billform"> <h:form id="billform">
<h:panelGrid columns="2"> <p:panelGrid columns="2">
<h:outputLabel for="paidDate" value="#{i18n['bill.paidDate']}:" /> <h:outputLabel for="paidDate" value="#{i18n['bill.paidDate']}:" />
<h:inputText id="paidDate" value="#{billEditView.bill.paidDate}"> <h:inputText id="paidDate" value="#{billEditView.bill.paidDate}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
...@@ -62,49 +61,53 @@ ...@@ -62,49 +61,53 @@
<h:outputLabel for="notes" value="#{i18n['bill.notes']}:" /> <h:outputLabel for="notes" value="#{i18n['bill.notes']}:" />
<h:inputTextarea id="notes" cols="50" rows="5" value="#{billEditView.bill.notes}" /> <h:inputTextarea id="notes" cols="50" rows="5" value="#{billEditView.bill.notes}" />
<h:commandButton id="commitbtn" action="#{billEditView.save()}" value="#{i18n['bill.save']}" /> <p:commandButton id="commitbtn" actionListener="#{billEditView.save()}" ajax="false" value="#{i18n['bill.save']}" />
</h:panelGrid> </p:panelGrid>
<h:dataTable border="1" id="user" value="#{billEditView.bill.billLines}" var="billine"> <p:dataTable border="1" id="user" value="#{billEditView.bill.billLines}" var="billine">
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n[billine.name]}" /> <h:outputText value="#{i18n['billine.name']}" />
</f:facet> </f:facet>
<h:inputText value="#{billine.name}" /> <h:inputText value="#{billine.name}" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['billine.unitPrice']}" /> <h:outputText value="#{i18n['billine.unitPrice']}" />
</f:facet> </f:facet>
<h:inputText value="#{billine.unitPrice}" size="6" /> <h:inputText value="#{billine.unitPrice}" size="6" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['billine.quantity']}" /> <h:outputText value="#{i18n['billine.quantity']}" />
</f:facet> </f:facet>
<h:inputText value="#{billine.quantity}" size="6" /> <h:inputText value="#{billine.quantity}" size="6" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['billine.unitName']}" /> <h:outputText value="#{i18n['billine.unitName']}" />
</f:facet> </f:facet>
<h:inputText value="#{billine.unitName}" size="5" /> <h:inputText value="#{billine.unitName}" size="5" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['billine.vat']}" /> <h:outputText value="#{i18n['billine.vat']}" />
</f:facet> </f:facet>
<h:inputText value="#{billine.vat}" size="4" /> <h:inputText value="#{billine.vat}" size="4" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['billine.referencedProduct']}" /> <h:outputText value="#{i18n['billine.referencedProduct']}" />
</f:facet> </f:facet>
<h:outputText value="#{billine.lineProduct.name}" /> <h:outputText value="#{billine.lineProduct.name}" />
</h:column> </p:column>
</p:dataTable>
</h:dataTable>
</h:form> </h:form>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
</h:body> </h:body>
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
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:tools="http://java.sun.com/jsf/composite/tools" <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:tools="http://java.sun.com/jsf/composite/tools"
xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:f="http://java.sun.com/jsf/core"> xmlns:bill="http://java.sun.com/jsf/composite/cditools/bills" xmlns:p="http://primefaces.org/ui" xmlns:f="http://java.sun.com/jsf/core">
<h:body> <h:body>
...@@ -24,9 +24,10 @@ ...@@ -24,9 +24,10 @@
</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>
...@@ -57,6 +58,20 @@ ...@@ -57,6 +58,20 @@
</tr> </tr>
</table> </table>
</ui:fragment> </ui:fragment>
<ui:fragment rendered="#{!billEditView.bill.paid and !billEditView.bill.expired}">
<h:form>
<p:commandButton id="cancelbtn" onclick="confirmation.show()" value="#{i18n['bill.cancel']}" />
<p:confirmDialog id="confirmDialog" message="#{i18n['generic.sure.message']}" header="#{i18n['generic.sure.header']}" severity="alert" widgetVar="confirmation">
<p:commandButton value="#{i18n['generic.sure.yes']}" onclick="confirmation.hide()" actionListener="#{billEditView.expireBill()}" ajax="false" />
<p:commandButton value="#{i18n['generic.sure.no']}" onclick="confirmation.hide()" type="button" />
</p:confirmDialog>
</h:form>
</ui:fragment>
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -77,6 +77,8 @@ ...@@ -77,6 +77,8 @@
<h:column> <h:column>
<f:facet name="header">#{i18n['lanEventProperty.value']}</f:facet> <f:facet name="header">#{i18n['lanEventProperty.value']}</f:facet>
<h:outputText rendered="#{prop.key.text}" value="#{prop.textvalue}" /> <h:outputText rendered="#{prop.key.text}" value="#{prop.textvalue}" />
<h:outputText rendered="#{prop.key.boolean and prop.booleanValue}" value="true" />
<h:outputText rendered="#{prop.key.boolean and not prop.booleanValue}" value="false" />
<h:outputText rendered="#{prop.key.date}" value="#{prop.dateValue}"> <h:outputText rendered="#{prop.key.date}" value="#{prop.dateValue}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText> </h:outputText>
...@@ -124,6 +126,10 @@ ...@@ -124,6 +126,10 @@
<p:calendar rendered="#{eventPropertyView.property.key.date}" value="#{eventPropertyView.property.dateValue}" pattern="#{sessionHandler.datetimeFormat}" /> <p:calendar rendered="#{eventPropertyView.property.key.date}" value="#{eventPropertyView.property.dateValue}" pattern="#{sessionHandler.datetimeFormat}" />
<h:message rendered="#{eventPropertyView.property.key.date}" for="textval" /> <h:message rendered="#{eventPropertyView.property.key.date}" for="textval" />
<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:message rendered="#{eventPropertyView.property.key.boolean}" for="booleanval" />
</h:panelGrid> </h:panelGrid>
<h:commandButton action="#{eventPropertyView.saveProperty}" value="#{i18n['lanEventProperty.save']}" /> <h:commandButton action="#{eventPropertyView.saveProperty}" value="#{i18n['lanEventProperty.save']}" />
</h:form> </h:form>
......
...@@ -7,8 +7,7 @@ ...@@ -7,8 +7,7 @@
<h:head> <h:head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title><h:outputText value="#{layoutView.getHeader()}" /></title> <title><h:outputText value="#{layoutView.getHeader()}" /></title>
<meta name="description" content="Insomnia lippukauppa" /> <meta name="description" content="#{layoutView.getHeader()}" />
<meta name="author" content="Niko Juusela, csharp" />
<meta http-equiv="Content-Language" content="fi" /> <meta http-equiv="Content-Language" content="fi" />
<link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia2/css/tyyli.css" /> <link rel="stylesheet" type="text/css" href="#{request.contextPath}/resources/style/insomnia2/css/tyyli.css" />
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<!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" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" <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:ui="http://java.sun.com/jsf/facelets" xmlns:p="http://primefaces.org/ui" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools">
<composite:interface> <composite:interface>
</composite:interface> </composite:interface>
...@@ -10,71 +10,89 @@ ...@@ -10,71 +10,89 @@
<composite:implementation> <composite:implementation>
<h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" /> <h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" />
<!-- koyhan miehen confirmaationappi: -->
<input type="button" class="ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" style="padding: 3px;" value="#{i18n['bill.markPaid.show']}" onclick="showMarkPaidButtons();" />
<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">
<h:column rendered="#{billListView.canWriteBill}"> <p:dataTable styleClass="bordertable" id="billList" value="#{billListView.bills}" var="bill"
rowStyleClass="#{bill.expired ? 'expired' : (bill.paidDate != null ? 'paid' : null)}" >
<p:column rendered="#{billListView.canWriteBill}">
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.payer']}" /> <h:outputText value="#{i18n['bill.payer']}" />
</f:facet> </f:facet>
<h:link rendered="#{billListView.canWriteBill}" outcome="/useradmin/edit" value="#{bill.addr1}"> <h:link rendered="#{billListView.canWriteBill}" outcome="/useradmin/edit" value="#{bill.addr1}">
<f:param name="userid" value="#{bill.user.user.id}" /> <f:param name="userid" value="#{bill.user.user.id}" />
</h:link> </h:link>
<h:outputText rendered="#{not billListView.canWriteBill}" value="#{bill.addr1}" /> <h:outputText rendered="#{not billListView.canWriteBill}" value="#{bill.addr1}" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.sentDate']}" /> <h:outputText value="${i18n['bill.sentDate']}" />
</f:facet> </f:facet>
<h:outputText value="#{bill.sentDateTime}"> <h:outputText value="#{bill.sentDateTime}">
<f:convertDateTime pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" /> <f:convertDateTime pattern="#{sessionHandler.dateFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText> </h:outputText>
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.billNumber']}" /> <h:outputText value="${i18n['bill.billNumber']}" />
</f:facet> </f:facet>
<h:outputText value="#{bill.billNumber}" /> <h:outputText value="#{bill.billNumber}" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.referencenumber']}" /> <h:outputText value="${i18n['bill.referencenumber']}" />
</f:facet> </f:facet>
<h:outputText value="#{bill.referenceNumberBase}"> <h:outputText value="#{bill.referenceNumberBase}">
<f:converter binding="#{referenceNumberConverter}" /> <f:converter binding="#{referenceNumberConverter}" />
</h:outputText> </h:outputText>
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['bill.totalPrice']}" /> <h:outputText value="${i18n['bill.totalPrice']}" />
</f:facet> </f:facet>
<h:outputText value="#{bill.totalPrice()}"> <h:outputText value="#{bill.totalPrice()}">
<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> </p:column>
<h:column> <p:column>
<ui:fragment 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> </ui:fragment>
<h:column> </p:column>
<p:column>
<h:link outcome="/bill/showBill" value="#{i18n['bill.show']}"> <h:link outcome="/bill/showBill" value="#{i18n['bill.show']}">
<f:param name="billid" value="#{bill.id}" /> <f:param name="billid" value="#{bill.id}" />
</h:link> </h:link>
</h:column> </p:column>
<h:column rendered="#{billListView.canWriteBill}"> <p:column rendered="#{billListView.canWriteBill}">
<h:link outcome="/bill/edit" value="#{i18n['bill.edit']}"> <h:link outcome="/bill/edit" value="#{i18n['bill.edit']}">
<f:param name="billid" value="#{bill.id}" /> <f:param name="billid" value="#{bill.id}" />
</h:link> </h:link>
</h:column> </p:column>
<h:column rendered="#{billListView.canWriteBill}"> <p:column rendered="#{billListView.canWriteBill}">
<h:commandButton rendered="#{bill.paidDate == null}" action="#{billListView.markPaid()}" value="#{i18n['bill.markPaid']}"> <h:commandButton rendered="#{bill.paidDate == null}" styleClass="markPaidButton" action="#{billListView.markPaid()}" value="#{i18n['bill.markPaid']}">
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
<h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" /> <h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" />
</h:column> </p:column>
</h:dataTable> </p:dataTable>
</h:form> </h:form>
<script type="text/javascript">
function showMarkPaidButtons() {
$(".markPaidButton").removeAttr('disabled');
}
$(".markPaidButton").attr('disabled', 'disabled');
</script>
</composite:implementation> </composite:implementation>
......
...@@ -10,13 +10,13 @@ ...@@ -10,13 +10,13 @@
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<h:panelGrid columns="2" columnClasses="topalign,topalign"> <h:panelGrid columns="2" columnClasses="topalign,topalign" styleClass="#{cc.attrs.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}" />
<h:outputLabel for="refnr" value="#{i18n['bill.referencenumber']}" /> <h:outputLabel rendered="{!cc.attrs.bill.expired}" for="refnr" value="#{i18n['bill.referencenumber']}" />
<h:outputText id="refnr" value="#{cc.attrs.bill.referenceNumber}" /> <h:outputText rendered="{!cc.attrs.bill.expired}" id="refnr" value="#{cc.attrs.bill.referenceNumber}" />
<h:outputLabel for="billAmount" value="#{i18n['bill.billAmount']}" /> <h:outputLabel for="billAmount" value="#{i18n['bill.billAmount']}" />
<h:outputText id="billAmount" value="#{cc.attrs.bill.totalPrice()}"> <h:outputText id="billAmount" value="#{cc.attrs.bill.totalPrice()}">
...@@ -31,8 +31,16 @@ ...@@ -31,8 +31,16 @@
<h:outputLabel for="paymenttime" value="#{i18n['bill.paymentTime']}:" /> <h:outputLabel for="paymenttime" value="#{i18n['bill.paymentTime']}:" />
<h:outputText id="paymenttime" value="#{cc.attrs.bill.paymentTime eq 0 ? i18n['bill.paymentTime.now'] : cc.attrs.bill.paymentTime}" /> <h:outputText id="paymenttime" value="#{cc.attrs.bill.paymentTime eq 0 ? i18n['bill.paymentTime.now'] : cc.attrs.bill.paymentTime}" />
<h:outputLabel for="noticetime" value="#{i18n['bill.noticetime']}:" /> <h:outputLabel rendered="{!cc.attrs.bill.expired}" for="noticetime" value="#{i18n['bill.noticetime']}:" />
<h:outputText id="noticetime" value="#{cc.attrs.bill.noticetime}" /> <h:outputText rendered="{!cc.attrs.bill.expired}" 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}">
<f:convertDateTime pattern="#{sessionHandler.datetimeFormat}" timeZone="#{sessionHandler.timezone}" />
</h:outputText>
<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">
...@@ -58,15 +66,15 @@ ...@@ -58,15 +66,15 @@
<h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.billAddress4}" value="&lt;br />" escape="false" /> <h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.billAddress4}" value="&lt;br />" escape="false" />
<h:outputText id="recAddr4" value="#{cc.attrs.bill.event.organiser.billAddress4}" /> <h:outputText id="recAddr4" value="#{cc.attrs.bill.event.organiser.billAddress4}" />
</h:panelGroup> </h:panelGroup>
<h:outputLabel rendered="#{!empty cc.attrs.bill.event.organiser.bankName1}" for="bankname1" value="#{i18n['eventorg.bankName1']}" /> <h:outputLabel rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankName1}" for="bankname1" value="#{i18n['eventorg.bankName1']}" />
<h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.bankName1}" id="bankname1" value="#{cc.attrs.bill.event.organiser.bankName1}" /> <h:outputText rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankName1}" id="bankname1" value="#{cc.attrs.bill.event.organiser.bankName1}" />
<h:outputLabel rendered="#{!empty cc.attrs.bill.event.organiser.bankNumber1}" for="banknumber1" value="#{i18n['eventorg.bankNumber1']}" /> <h:outputLabel rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankNumber1}" for="banknumber1" value="#{i18n['eventorg.bankNumber1']}" />
<h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.bankNumber1}" id="banknumber1" value="#{cc.attrs.bill.event.organiser.bankNumber1}" /> <h:outputText rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankNumber1}" id="banknumber1" value="#{cc.attrs.bill.event.organiser.bankNumber1}" />
<h:outputLabel rendered="#{!empty cc.attrs.bill.event.organiser.bankName2}" for="bankname2" value="#{i18n['eventorg.bankName2']}" /> <h:outputLabel rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankName2}" for="bankname2" value="#{i18n['eventorg.bankName2']}" />
<h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.bankName2}" id="bankname2" value="#{cc.attrs.bill.event.organiser.bankName2}" /> <h:outputText rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankName2}" id="bankname2" value="#{cc.attrs.bill.event.organiser.bankName2}" />
<h:outputLabel rendered="#{!empty cc.attrs.bill.event.organiser.bankNumber2}" for="banknumber2" value="#{i18n['eventorg.bankNumber2']}" /> <h:outputLabel rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankNumber2}" for="banknumber2" value="#{i18n['eventorg.bankNumber2']}" />
<h:outputText rendered="#{!empty cc.attrs.bill.event.organiser.bankNumber2}" id="banknumber2" value="#{cc.attrs.bill.event.organiser.bankNumber2}" /> <h:outputText rendered="#{!cc.attrs.bill.expired and !empty cc.attrs.bill.event.organiser.bankNumber2}" id="banknumber2" value="#{cc.attrs.bill.event.organiser.bankNumber2}" />
</h:panelGrid> </h:panelGrid>
......
...@@ -130,3 +130,7 @@ vertical-align: top; ...@@ -130,3 +130,7 @@ vertical-align: top;
label { label {
} }
.expired {
color: #c0c0c0;
}
...@@ -221,3 +221,7 @@ h1 { ...@@ -221,3 +221,7 @@ h1 {
{ {
vertical-align:top; vertical-align:top;
} }
.expired {
color: #c0c0c0;
}
...@@ -295,3 +295,12 @@ button.ui-button span ...@@ -295,3 +295,12 @@ button.ui-button span
padding: .4em .5em; padding: .4em .5em;
} }
.expired {
color: #c0c0c0;
}
.paid {
color: #006600;
}
...@@ -287,3 +287,7 @@ padding: 5px; ...@@ -287,3 +287,7 @@ padding: 5px;
padding-left: 1em; padding-left: 1em;
vertical-align: top; vertical-align: top;
} }
.expired {
color: #c0c0c0;
}
\ No newline at end of file
...@@ -236,3 +236,7 @@ table.bordertable td,table.bordertable th { ...@@ -236,3 +236,7 @@ table.bordertable td,table.bordertable th {
table.bordertable { table.bordertable {
border-collapse: collapse; border-collapse: collapse;
} }
.expired {
color: #c0c0c0;
}
\ No newline at end of file
...@@ -140,6 +140,10 @@ label { ...@@ -140,6 +140,10 @@ label {
} }
.expired {
color: #c0c0c0;
}
/* input { /* input {
border: 1px solid #ccc; border: 1px solid #ccc;
padding: 3px 6px; padding: 3px 6px;
......
#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,14 @@ actionlog.tasklist.header = Tasklist ...@@ -14,6 +16,14 @@ actionlog.tasklist.header = Tasklist
actionlog.time = Time actionlog.time = Time
actionlog.user = User actionlog.user = User
bill.billAmount = Amount
bill.billNumber = Number
bill.cancel = Cancel bill
bill.expires = Expires
bill.isExpired = Bill is expired
bill.markPaid.show = Show Mark paid -buttons
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 +86,11 @@ error.error = You have encountered an error. ...@@ -76,6 +86,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,14 +110,19 @@ loginerror.header = Login failed ...@@ -95,14 +110,19 @@ 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
navi.auth.loginerror = frontpage navi.auth.loginerror = frontpage
navi.auth.logout = frontpage navi.auth.logout = frontpage
page.bill.billSummary.header = Summary of bills
page.bill.edit.header = Edit bill
page.bill.list.header = Bills
page.bill.listAll.header = Bills
page.bill.placemap.header = Place map
page.bill.show.header = Bill info
pagegroup.auth.login = frontpage pagegroup.auth.login = frontpage
passwordChanged.body = You can now login with the new password. passwordChanged.body = You can now login with the new password.
...@@ -136,6 +156,6 @@ resetMail.username = Username ...@@ -136,6 +156,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
...@@ -57,12 +59,16 @@ bill.address = Payers address ...@@ -57,12 +59,16 @@ bill.address = Payers address
bill.billAmount = Bill amount bill.billAmount = Bill amount
bill.billIsPaid = Bill is paid bill.billIsPaid = Bill is paid
bill.billLines = Products bill.billLines = Products
bill.billNumber = Bill number bill.billNumber = Number
bill.billPaidDate = Paid date bill.billPaidDate = Paid date
bill.cancel = Cancel bill
bill.deliveryTerms = Delivery terms bill.deliveryTerms = Delivery terms
bill.edit = edit bill.edit = edit
bill.expires = Expires
bill.isExpired = Bill is expired
bill.isPaid = Paid bill.isPaid = Paid
bill.markPaid = Mark paid bill.markPaid = Mark paid
bill.markPaid.show = Show Mark paid -buttons
bill.markedPaid = Bill marked paid bill.markedPaid = Bill marked paid
bill.notes = Notes bill.notes = Notes
bill.noticetime = Notice time bill.noticetime = Notice time
...@@ -75,6 +81,7 @@ bill.printBill = Print bill ...@@ -75,6 +81,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 +281,11 @@ game.gamepoints = Game points ...@@ -274,6 +281,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
...@@ -401,6 +413,7 @@ page.auth.notauthorized.pagegroup = frontpage ...@@ -401,6 +413,7 @@ page.auth.notauthorized.pagegroup = frontpage
page.auth.resetPassword.header = Reset password page.auth.resetPassword.header = Reset password
page.bill.billSummary.header = Summary of bills page.bill.billSummary.header = Summary of bills
page.bill.edit.header = Edit bill page.bill.edit.header = Edit bill
page.bill.list.header = Bills
page.bill.listAll.header = Bills page.bill.listAll.header = Bills
page.bill.placemap.header = Place map page.bill.placemap.header = Place map
page.bill.show.header = Bill info page.bill.show.header = Bill info
......
#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
...@@ -59,12 +61,16 @@ bill.billIsPaid = Lasku on maksettu ...@@ -59,12 +61,16 @@ bill.billIsPaid = Lasku on maksettu
bill.billLines = Tuotteet bill.billLines = Tuotteet
bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaan haluamasi paikat. Tervetuloa tapahtumaan! bill.billMarkedPaidMail.message = Laskusi numero {0} on merkitty maksetuksi. Voit nyt siirty\u00E4 lippukauppaan varamaan haluamasi paikat. Tervetuloa tapahtumaan!
bill.billMarkedPaidMail.subject = Lasku merkitty maksetuksi bill.billMarkedPaidMail.subject = Lasku merkitty maksetuksi
bill.billNumber = Laskun numero bill.billNumber = Numero
bill.billPaidDate = Maksup\u00E4iv\u00E4 bill.billPaidDate = Maksup\u00E4iv\u00E4
bill.cancel = Peruuta lasku
bill.deliveryTerms = Toimitusehdot bill.deliveryTerms = Toimitusehdot
bill.edit = Muokkaa bill.edit = Muokkaa
bill.expires = Vanhentuu
bill.isExpired = Lasku on vanhentunut
bill.isPaid = Maksettu bill.isPaid = Maksettu
bill.markPaid = Maksettu bill.markPaid = Maksettu
bill.markPaid.show = N\u00E4yt\u00E4 Maksettu -napit
bill.markedPaid = Lasku merkitty maksetuksi. bill.markedPaid = Lasku merkitty maksetuksi.
bill.notes = Huomioita bill.notes = Huomioita
bill.noticetime = Huomautusaika bill.noticetime = Huomautusaika
...@@ -77,10 +83,11 @@ bill.printBill = Tulosta lasku ...@@ -77,10 +83,11 @@ 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
bill.totalPrice = Laskun summa bill.totalPrice = Summa
bill.totalprice = Yhteens\u00E4 bill.totalprice = Yhteens\u00E4
billLine.eventuser = Asiakas billLine.eventuser = Asiakas
...@@ -274,6 +281,11 @@ game.gamepoints = Insomnia Game pisteet: ...@@ -274,6 +281,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
...@@ -413,7 +425,10 @@ page.auth.logout.header = Uloskirjautuminen ...@@ -413,7 +425,10 @@ page.auth.logout.header = Uloskirjautuminen
page.auth.logoutsuccess.header = Logout page.auth.logoutsuccess.header = Logout
page.auth.resetPassword.header = Nollaa salasana page.auth.resetPassword.header = Nollaa salasana
page.bill.billSummary.header = Laskujen yhteenveto page.bill.billSummary.header = Laskujen yhteenveto
page.bill.edit.header = Muokkaa laskua
page.bill.list.header = Laskut page.bill.list.header = Laskut
page.bill.listAll.header = Laskut
page.bill.placemap.header = Paikkakartta
page.bill.show.header = Laskun tiedot page.bill.show.header = Laskun tiedot
page.checkout.cancel.header = Maksu peruutettu. page.checkout.cancel.header = Maksu peruutettu.
page.checkout.delayed.header = Viiv\u00E4stetty maksu page.checkout.delayed.header = Viiv\u00E4stetty maksu
......
#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
......
...@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse; ...@@ -12,6 +12,7 @@ import javax.servlet.http.HttpServletResponse;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal; import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceGroupBeanLocal; import fi.codecrew.moya.beans.PlaceGroupBeanLocal;
......
...@@ -116,4 +116,24 @@ public class BillEditView extends GenericCDIView { ...@@ -116,4 +116,24 @@ public class BillEditView extends GenericCDIView {
public void setVmreturn(VerkkomaksutReturnEntry vmreturn) { public void setVmreturn(VerkkomaksutReturnEntry vmreturn) {
this.vmreturn = vmreturn; this.vmreturn = vmreturn;
} }
public void expireBill() {
System.out.println("EXPIRE BILL; WE ARE THERE");
bill.markExpired();
System.out.println(""+ bill.getExpires().getTime());
this.save();
}
} }
...@@ -17,7 +17,7 @@ import fi.codecrew.moya.model.FoodWave; ...@@ -17,7 +17,7 @@ import fi.codecrew.moya.model.FoodWave;
import fi.codecrew.moya.web.annotations.SelectedUser; import fi.codecrew.moya.web.annotations.SelectedUser;
import fi.codecrew.moya.web.cdiview.GenericCDIView; import fi.codecrew.moya.web.cdiview.GenericCDIView;
@Named @Named()
@ConversationScoped @ConversationScoped
public class FoodShopView extends GenericCDIView { public class FoodShopView extends GenericCDIView {
...@@ -26,7 +26,6 @@ public class FoodShopView extends GenericCDIView { ...@@ -26,7 +26,6 @@ public class FoodShopView extends GenericCDIView {
private static final long serialVersionUID = 1288114954999406683L; private static final long serialVersionUID = 1288114954999406683L;
@Inject @Inject
@SelectedUser @SelectedUser
private EventUser user; private EventUser user;
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!