Commit 911702a4 by Tuukka Kivilahti

and refactoring should be done

1 parent c1931ff3
Showing with 141 additions and 205 deletions
...@@ -186,7 +186,7 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -186,7 +186,7 @@ public class BarcodeBean implements BarcodeBeanLocal {
} catch (NumberFormatException x) { } catch (NumberFormatException x) {
} }
return printedCardFacade.findByBarcode(barcode); return printedCardFacade.findByCode(barcode);
} }
public EventUser getUser(String barcode) { public EventUser getUser(String barcode) {
...@@ -224,7 +224,8 @@ public class BarcodeBean implements BarcodeBeanLocal { ...@@ -224,7 +224,8 @@ public class BarcodeBean implements BarcodeBeanLocal {
@Override @Override
public Place getPlaceFromBarcode(String barcode) { public Place getPlaceFromBarcode(String barcode) {
throw new UnsupportedOperationException();
// TODO: tarttee hakea se paikkakoodi, ja sen avulla paikka. Toivon että se on ny tämä eikä placecodehäsmäkkä, mikä se oikeasti on. Vittu lisää refactorointia // TODO: tarttee hakea se paikkakoodi, ja sen avulla paikka. Toivon että se on ny tämä eikä placecodehäsmäkkä, mikä se oikeasti on. Vittu lisää refactorointia
} }
......
...@@ -67,8 +67,12 @@ public class ReaderBean implements ReaderBeanLocal { ...@@ -67,8 +67,12 @@ public class ReaderBean implements ReaderBeanLocal {
@Override @Override
public ReaderEvent checkCode(String readerIdent, String code) { public ReaderEvent checkCode(String readerIdent, String code) {
Reader reader = readerfacade.findOrCreateByIdent(readerIdent); Reader reader = readerfacade.findOrCreateByIdent(readerIdent);
return checkCode(reader, code);
}
@Override
public ReaderEvent checkCode(Reader reader, String code) {
code = code.replace("\"\b", ""); code = code.replace("\"\b", "");
...@@ -158,7 +162,7 @@ public class ReaderBean implements ReaderBeanLocal { ...@@ -158,7 +162,7 @@ public class ReaderBean implements ReaderBeanLocal {
@Override @Override
public ReaderEvent assocTagToCard(ReaderEvent readerEvent, PrintedCard card) { public ReaderEvent assocCodeToCard(ReaderEvent readerEvent, PrintedCard card) {
CardCode code = new CardCode(card, readerEvent.getReader().getType(), readerEvent.getValue()); CardCode code = new CardCode(card, readerEvent.getReader().getType(), readerEvent.getValue());
...@@ -208,7 +212,7 @@ public class ReaderBean implements ReaderBeanLocal { ...@@ -208,7 +212,7 @@ public class ReaderBean implements ReaderBeanLocal {
@Override @Override
public User findTagFromAnyEvent(String value) { public User findTagFromAnyEvent(String value) {
PrintedCard card = cardfacade.findLatestByRfidFromAny(value); PrintedCard card = cardfacade.findLatestByCodeFromAny(value);
User ret = null; User ret = null;
if (card != null && card.getUser() != null) { if (card != null && card.getUser() != null) {
ret = card.getUser().getUser(); ret = card.getUser().getUser();
......
...@@ -9,6 +9,7 @@ import fi.codecrew.moya.enums.CardState; ...@@ -9,6 +9,7 @@ import fi.codecrew.moya.enums.CardState;
import fi.codecrew.moya.model.CardTemplate; import fi.codecrew.moya.model.CardTemplate;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.utilities.jsf.EntityFinderBean; import fi.codecrew.moya.utilities.jsf.EntityFinderBean;
@Local @Local
......
...@@ -17,7 +17,7 @@ public interface ReaderBeanLocal { ...@@ -17,7 +17,7 @@ public interface ReaderBeanLocal {
// ReaderEvent assocTagToPlacecode(String tag, String readerIdent, String // ReaderEvent assocTagToPlacecode(String tag, String readerIdent, String
// placecode) throws BortalCatchableException, PermissionDeniedException; // placecode) throws BortalCatchableException, PermissionDeniedException;
ReaderEvent assocTagToCard(ReaderEvent readerEvent, PrintedCard card); ReaderEvent assocCodeToCard(ReaderEvent readerEvent, PrintedCard card);
List<Reader> getReaders(); List<Reader> getReaders();
...@@ -41,6 +41,8 @@ public interface ReaderBeanLocal { ...@@ -41,6 +41,8 @@ public interface ReaderBeanLocal {
List<ReaderEvent> getLastReaderEvents(); List<ReaderEvent> getLastReaderEvents();
ReaderEvent checkCode(String readerIdent, String code); ReaderEvent checkCode(String readerIdent, String code);
ReaderEvent checkCode(Reader reader, String code);
List<ReaderEvent> getReaderEvents(Integer readerId, Integer count); List<ReaderEvent> getReaderEvents(Integer readerId, Integer count);
......
...@@ -171,34 +171,7 @@ public class PrintedCard extends GenericEntity { ...@@ -171,34 +171,7 @@ public class PrintedCard extends GenericEntity {
public int getPrintCount() { public int getPrintCount() {
return printCount; return printCount;
} }
public static final Comparator<PrintedCard> GAMEPOINT_COMPARATOR = new Comparator<PrintedCard>() {
@Override
public int compare(PrintedCard o1, PrintedCard o2) {
int ret = o2.getGamepoints().compareTo(o1.getGamepoints());
if (ret == 0 && o1.getUser().getUser().getNick() != null && o2.getUser().getUser().getNick() != null)
{
ret = o1.getUser().getUser().getNick().compareTo(o2.getUser().getUser().getNick());
}
return ret;
}
};
@Transient
private Integer gamepoints = null;
public Integer getGamepoints() {
if (gamepoints == null) {
Integer ret = 0;
for (ReaderEvent re : this.getReaderEvents()) {
ret += re.getGamePoint();
}
gamepoints = ret;
}
return gamepoints;
}
public CardState getCardState() { public CardState getCardState() {
return cardState; return cardState;
...@@ -208,21 +181,4 @@ public class PrintedCard extends GenericEntity { ...@@ -208,21 +181,4 @@ public class PrintedCard extends GenericEntity {
this.cardState = cardState; this.cardState = cardState;
} }
@Transient
private transient ListDataModel<ReaderEvent> revents;
public ListDataModel<ReaderEvent> getGameCards() {
if (revents == null) {
List<ReaderEvent> ev = this.getReaderEvents();
ArrayList<ReaderEvent> ret = new ArrayList<ReaderEvent>();
for (ReaderEvent e : ev) {
if (e.getGamePoint() > 0) {
ret.add(e);
}
}
revents = new ListDataModel<ReaderEvent>(ret);
}
return revents;
}
} }
...@@ -2,6 +2,7 @@ ...@@ -2,6 +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" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login" xmlns:tools="http://java.sun.com/jsf/composite/cditools" <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:login="http://java.sun.com/jsf/composite/cditools/login" xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:p="http://primefaces.org/ui"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader" xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
> >
...@@ -18,23 +19,32 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader" ...@@ -18,23 +19,32 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
</composite:interface> </composite:interface>
<composite:implementation> <composite:implementation>
<h:form id="reader_autopoll" rendered="#{readerView.pollingMode}">
<p:poll interval="1" listener="#{cc.attrs.selectaction}" onerror="location.reload();" />
</h:form>
<h:form rendered="#{empty readerNameContainer.readerId}"> <h:form rendered="#{empty readerNameContainer.readerId}">
<h:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr"> <p:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="#{i18n['reader.name']}" /> <h:outputText value="#{i18n['reader.name']}" />
</f:facet> </f:facet>
<h:outputText value="#{rr.identification}" /> <p:outputText value="#{rr.identification}" />
</h:column> </p:column>
<h:column> <p:column>
<h:commandButton action="#{readerListDataView.selectReader}" value="#{i18n['reader.select']}" /> <p:commandButton action="#{readerListDataView.selectReader}" value="#{i18n['reader.select']}" />
</h:column> </p:column>
</h:dataTable> </p:dataTable>
</h:form>
<h:form>
<p:outputLabel value="#{i18n['reader.autopoll']}" /><p:selectBooleanButton offLabel="#{i18n['off']}" onLabel="#{i18n['on']}" value="#{readerView.pollingMode}" immediate="true" update="reader_autopoll">
</h:form> </h:form>
<reader:readerevents rendered="#{!empty readerNameContainer.readerId}" showAssociateToUser="#{cc.attrs.showAssociateToUser}" selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" /> <reader:readerevents rendered="#{!empty readerNameContainer.readerId}" showAssociateToUser="#{cc.attrs.showAssociateToUser}" selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" />
</composite:implementation> </composite:implementation>
......
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login"
xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
>
<composite:interface>
<composite:attribute name="selectvalue" required="false" />
<composite:attribute name="selectaction" method-signature="java.lang.String action()" required="false" />
<composite:attribute name="linkvalue" required="false" />
<composite:attribute name="linkoutcome" required="false" />
</composite:interface>
<composite:implementation>
<reader:barcode selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" /> <br />
<reader:rfid selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" /> <br />
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core"
xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets"
xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login"
xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
>
<composite:interface>
<composite:attribute name="selectvalue" required="false" />
<composite:attribute name="selectaction" method-signature="java.lang.String action()" required="false" />
<composite:attribute name="linkvalue" required="false" />
<composite:attribute name="linkoutcome" required="false" />
</composite:interface>
<composite:implementation>
todo: kato tapahtuman conffeista kumpi käytössä: <br />
<reader:barcode selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" /> <br />
<reader:rfid selectvalue="#{cc.attrs.selectvalue}" selectaction="#{cc.attrs.selectaction}" linkvalue="#{cc.attrs.linkvalue}" linkoutcome="#{cc.attrs.linkoutcome}" /> <br />
</composite:implementation>
</html>
\ No newline at end of file
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!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" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:login="http://java.sun.com/jsf/composite/cditools/login" xmlns:tools="http://java.sun.com/jsf/composite/cditools"> <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:login="http://java.sun.com/jsf/composite/cditools/login" xmlns:tools="http://java.sun.com/jsf/composite/cditools"
xmlns:p="http://primefaces.org/ui">
<composite:interface> <composite:interface>
<composite:attribute name="selectvalue" required="false" /> <composite:attribute name="selectvalue" required="false" />
...@@ -10,11 +12,9 @@ ...@@ -10,11 +12,9 @@
<composite:implementation> <composite:implementation>
<h:form> <h:form>
<p:outputLabel value="#{i18n['code.inputfield']}" />
<h:outputLabel value="#{i18n['shop.barcode']}" /> <p:inputText id="code" value="#{readerView.userInsertCode}" />
<h:inputText id="barcode" value="#{readerView.barcode}" /> <p:commandButton action="#{cc.attrs.selectaction}" value="#{cc.attrs.selectvalue}" update="@all" />
<h:commandButton action="#{cc.attrs.selectaction}" value="#{cc.attrs.selectvalue}" />
</h:form> </h:form>
</composite:implementation> </composite:implementation>
......
...@@ -16,44 +16,39 @@ ...@@ -16,44 +16,39 @@
<composite:implementation> <composite:implementation>
<h:form> <h:form>
<p:poll interval="3" onerror="location.reload();" /> <p:poll interval="3" onerror="location.reload();" update="eventlist" />
<h:dataTable border="1" id="event" value="#{readerView.readerEvents}" var="event"> <p:dataTable border="1" id="eventlist" value="#{readerView.readerEvents}" var="event">
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['readerevent.tagname']}" /> <h:outputText value="${i18n['readerevent.tagname']}" />
</f:facet> </f:facet>
<h:outputText rendered="#{!empty event.printedCard}" id="cardtag" value="#{event.printedCard.rfidUid}" /> <p:outputText rendered="#{!empty event.printedCard}" id="cardtag" value="#{event.printedCard.rfidUid}" />
<h:outputText rendered="#{empty event.printedCard}" id="newtag" value="#{event.value}" /> <p:outputText rendered="#{empty event.printedCard}" id="newtag" value="#{event.value}" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['reader.user']}" /> <h:outputText value="${i18n['reader.user']}" />
</f:facet> </f:facet>
<h:outputText rendered="#{!empty event.printedCard}" value="#{event.printedCard.user.wholeName} (#{event.printedCard.user.nick})" /> <p:outputText rendered="#{!empty event.printedCard}" value="#{event.printedCard.user.wholeName} (#{event.printedCard.user.nick})" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header"> <f:facet name="header">
<h:outputText value="${i18n['readerevent.seenSince']}" /> <h:outputText value="${i18n['readerevent.seenSince']}" />
</f:facet> </f:facet>
<h:outputText value="#{event.seenSince}" /> <p:outputText value="#{event.seenSince}" />
</h:column> </p:column>
<h:column> <p:column>
<f:facet name="header">
<h:outputText value="${i18n['gamepoints']}" />
</f:facet>
<h:outputText value="#{event.gamePoint}" />
</h:column>
<h:column>
<h:link rendered="#{!empty event.printedCard and !empty cc.attrs.linkoutcome}" outcome="#{cc.attrs.linkoutcome}" value="#{cc.attrs.linkvalue}"> <h:link rendered="#{!empty event.printedCard and !empty cc.attrs.linkoutcome}" outcome="#{cc.attrs.linkoutcome}" value="#{cc.attrs.linkvalue}">
<f:param name="userid" value="#{event.printedCard.user.user.id}" /> <f:param name="userid" value="#{event.printedCard.user.user.id}" />
</h:link> </h:link>
<h:commandLink rendered="#{!empty cc.attrs.selectaction}" action="#{cc.attrs.selectaction}" value="#{cc.attrs.selectvalue}" /> <p:commandLink rendered="#{!empty cc.attrs.selectaction}" actionListener="#{cc.attrs.selectaction}" value="#{cc.attrs.selectvalue}" update="@all" />
<!--
<h:link rendered="#{empty event.printedCard and !empty cc.attrs.showAssociateToUser}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}"> <h:link rendered="#{empty event.printedCard and !empty cc.attrs.showAssociateToUser}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}">
<f:param name="eventid" value="#{event.id}" /> <f:param name="eventid" value="#{event.id}" />
</h:link> </h:link>
...@@ -66,10 +61,10 @@ ...@@ -66,10 +61,10 @@
<h:link rendered="#{empty event.printedCard}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}"> <h:link rendered="#{empty event.printedCard}" outcome="/shop/assocToUser" value="#{i18n['readerevent.associateToUser']}">
<f:param name="eventid" value="#{event.id}" /> <f:param name="eventid" value="#{event.id}" />
</h:link> </h:link> -->
</h:column> </p:column>
</h:dataTable> </p:dataTable>
</h:form> </h:form>
......
...@@ -36,7 +36,7 @@ ...@@ -36,7 +36,7 @@
<h:panelGroup> <h:panelGroup>
<reader:barcode selectaction="#{productShopView.readBarcode}" selectvalue="#{i18n['shop.readBarcode']}" /> <reader:codeField selectaction="#{productShopView.readCode}" selectvalue="#{i18n['shop.readBarcode']}" />
<br /> <br />
<p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods"> <p:dataTable id="prods" value="#{productShopView.boughtItems}" var="prods">
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
</f:metadata> </f:metadata>
<ui:define name="content"> <ui:define name="content">
<reader:readerevents rendered="#{!empty readerNameContainer.readerId}" /> <reader:backendReader rendered="#{!empty readerNameContainer.readerId}" />
<reader:readerlist rendered="#{empty readerNameContainer.readerId}" /> <reader:readerlist rendered="#{empty readerNameContainer.readerId}" />
</ui:define> </ui:define>
</ui:composition> </ui:composition>
......
...@@ -63,7 +63,7 @@ ...@@ -63,7 +63,7 @@
</h:form> </h:form>
<h3>RFID</h3> <h3>RFID</h3>
<reader:barcode_rfid selectvalue="#{i18n['readerevent.associateToUser']}" selectaction="#{userView.attachBarcodeToCard()}" /> <reader:backendReader selectvalue="#{i18n['readerevent.associateToUser']}" selectaction="#{userView.attachCodeToCard}" />
</ui:fragment> </ui:fragment>
......
...@@ -109,6 +109,8 @@ card.massprint.title = Print all ...@@ -109,6 +109,8 @@ card.massprint.title = Print all
cardTemplate.emptyCardTemplate = ---- cardTemplate.emptyCardTemplate = ----
code.inputfield = Sy\u00F6t\u00E4 viivakoodi
error.contact = If this happens again, contact Info with the following code: error.contact = If this happens again, contact Info with the following code:
error.error = You have encountered an error. error.error = You have encountered an error.
......
...@@ -215,6 +215,8 @@ checkout.return.errorMessage = Error confirming the successfull return message ...@@ -215,6 +215,8 @@ checkout.return.errorMessage = Error confirming the successfull return message
checkout.return.successDelayed = Delayed payment successfull. Payment will be confirmed at a later time, usually within a hour. checkout.return.successDelayed = Delayed payment successfull. Payment will be confirmed at a later time, usually within a hour.
checkout.return.successMessage = Payment confirmed. Your products have been paid. checkout.return.successMessage = Payment confirmed. Your products have been paid.
code.inputfield = Give readercode
compo.edit = Edit compo compo.edit = Edit compo
compo.saveVotes = Save votes compo.saveVotes = Save votes
compo.savesort = Save order compo.savesort = Save order
...@@ -1153,7 +1155,7 @@ user.accountBalance = Account balance ...@@ -1153,7 +1155,7 @@ user.accountBalance = Account balance
user.accountEventHeader = Account events user.accountEventHeader = Account events
user.accountevents = Account events user.accountevents = Account events
user.address = Address user.address = Address
user.age = Age user.age = Age
user.bank = Bank user.bank = Bank
user.bankaccount = Bank number user.bankaccount = Bank number
user.birthday = Birthday user.birthday = Birthday
......
...@@ -217,6 +217,8 @@ checkout.return.errorMessage = Virhe maksun onnistuneen maksun vahvistuksessa. ...@@ -217,6 +217,8 @@ checkout.return.errorMessage = Virhe maksun onnistuneen maksun vahvistuksessa.
checkout.return.successDelayed = Viiv\u00E4stetty maksu onnistunut. Maksu vahvistet\u00E4\u00E4n my\u00F6hemp\u00E4n\u00E4 ajankohtana, yleens\u00E4 noin tunnin sis\u00E4ll\u00E4. checkout.return.successDelayed = Viiv\u00E4stetty maksu onnistunut. Maksu vahvistet\u00E4\u00E4n my\u00F6hemp\u00E4n\u00E4 ajankohtana, yleens\u00E4 noin tunnin sis\u00E4ll\u00E4.
checkout.return.successMessage = Maksu vahvistettu. Tuotteet on maksettu. Voit siirty\u00E4 eteenp\u00E4in tilauksessasi. checkout.return.successMessage = Maksu vahvistettu. Tuotteet on maksettu. Voit siirty\u00E4 eteenp\u00E4in tilauksessasi.
code.inputfield = Sy\u00F6t\u00E4 viivakoodi
compo.edit = Muokkaa compoa compo.edit = Muokkaa compoa
compo.saveVotes = Tallenna \u00E4\u00E4net compo.saveVotes = Tallenna \u00E4\u00E4net
compo.savesort = Tallenna j\u00E4rjestys compo.savesort = Tallenna j\u00E4rjestys
...@@ -1138,7 +1140,7 @@ user.accountBalance = Tilin saldo ...@@ -1138,7 +1140,7 @@ user.accountBalance = Tilin saldo
user.accountEventHeader = Tilitapahtumat user.accountEventHeader = Tilitapahtumat
user.accountevents = Tilitapahtumat user.accountevents = Tilitapahtumat
user.address = Osoite user.address = Osoite
user.age = Ik user.age = Ik\u00E4
user.bank = Pankki user.bank = Pankki
user.bankaccount = Pankkitili user.bankaccount = Pankkitili
user.birthday = Syntym\u00E4aika user.birthday = Syntym\u00E4aika
......
...@@ -38,10 +38,6 @@ public class ReaderView extends GenericCDIView { ...@@ -38,10 +38,6 @@ public class ReaderView extends GenericCDIView {
private static final long serialVersionUID = 802344850073689859L; private static final long serialVersionUID = 802344850073689859L;
private String userInsertCode;
private ReaderEvent event;
private boolean pollingMode = false; private boolean pollingMode = false;
private ReaderEvent lastReadEvent = null; private ReaderEvent lastReadEvent = null;
...@@ -187,13 +183,6 @@ public class ReaderView extends GenericCDIView { ...@@ -187,13 +183,6 @@ public class ReaderView extends GenericCDIView {
this.namecontainer = namecontainer; this.namecontainer = namecontainer;
} }
public ReaderEvent getEvent() {
return event;
}
public void setEvent(ReaderEvent event) {
this.event = event;
}
public ListDataModel<UserCardWrapper> getUserlist() { public ListDataModel<UserCardWrapper> getUserlist() {
...@@ -243,6 +232,12 @@ public class ReaderView extends GenericCDIView { ...@@ -243,6 +232,12 @@ public class ReaderView extends GenericCDIView {
public ReaderEvent getReaderEvent() { public ReaderEvent getReaderEvent() {
if(pollingMode && isNewCodes()) {
pollingCodeHandled();
return readerbean.getLastReaderEvent(namecontainer.getReaderId());
}
if (readerEventList == null) if (readerEventList == null)
return null; return null;
...@@ -280,11 +275,31 @@ public class ReaderView extends GenericCDIView { ...@@ -280,11 +275,31 @@ public class ReaderView extends GenericCDIView {
public String getUserInsertCode() { public String getUserInsertCode() {
return userInsertCode; return "";
} }
public void setUserInsertCode(String userInsertCode) { public void setUserInsertCode(String userInsertCode) {
this.userInsertCode = userInsertCode; readerbean.checkCode(readerbean.getReader(readerid), userInsertCode);
}
public boolean isPollingMode() {
return pollingMode;
}
public void setPollingMode(boolean pollingMode) {
if(!this.pollingMode && pollingMode) {
this.initializeForPolling();
}
this.pollingMode = pollingMode;
}
public void readerPoll() {
} }
} }
...@@ -25,8 +25,8 @@ import fi.codecrew.moya.model.Bill; ...@@ -25,8 +25,8 @@ import fi.codecrew.moya.model.Bill;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEventProperty; import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey; import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.Product; import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ReaderEvent;
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;
import fi.codecrew.moya.web.cdiview.reader.ReaderView; import fi.codecrew.moya.web.cdiview.reader.ReaderView;
...@@ -425,24 +425,24 @@ public class ProductShopView extends GenericCDIView { ...@@ -425,24 +425,24 @@ public class ProductShopView extends GenericCDIView {
this.hasLimits = hasLimits; this.hasLimits = hasLimits;
} }
public String readBarcode() { public String readCode() {
PrintedCard card = readerView.getPrintedCard(); ReaderEvent event = readerView.getReaderEvent();
if (readerView.getBarcode() == null || readerView.getBarcode().trim().isEmpty()) { if(event == null) {
return null; return null;
} }
if (card != null) { if (event.getPrintedCard() != null) {
if (card.getUser() != null) { if (event.getPrintedCard().getUser() != null) {
userView.setUser(card.getUser()); userView.setUser(event.getPrintedCard().getUser());
this.user = card.getUser(); this.user = event.getPrintedCard().getUser();
initShopView(); initShopView();
return null; return null;
} }
} }
Product product = productBean.findByBarcode(readerView.getBarcode()); Product product = event.getProduct();
this.blip = false; this.blip = false;
// find product index, set index and add one // find product index, set index and add one
...@@ -461,7 +461,7 @@ public class ProductShopView extends GenericCDIView { ...@@ -461,7 +461,7 @@ public class ProductShopView extends GenericCDIView {
} }
n++; n++;
} }
readerView.clearBarcode();
logger.debug("barcode read"); logger.debug("barcode read");
return "success"; return "success";
} }
......
...@@ -34,6 +34,7 @@ import fi.codecrew.moya.enums.apps.UserPermission; ...@@ -34,6 +34,7 @@ import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.CardTemplate; import fi.codecrew.moya.model.CardTemplate;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.model.Role; import fi.codecrew.moya.model.Role;
import fi.codecrew.moya.model.User; import fi.codecrew.moya.model.User;
import fi.codecrew.moya.model.UserImage; import fi.codecrew.moya.model.UserImage;
...@@ -347,30 +348,24 @@ public class UserView extends GenericCDIView { ...@@ -347,30 +348,24 @@ public class UserView extends GenericCDIView {
* *
* @return * @return
*/ */
public String attachBarcodeToCard() { public String attachCodeToCard() {
PrintedCard card = readerView.getPrintedCard(); ReaderEvent event = readerView.getReaderEvent();
if(event == null)
return null;
// already attached // already attached
if (card != null) { if (event.getPrintedCard() != null) {
super.addFaceMessage("usercard.alreadyassociated"); super.addFaceMessage("usercard.alreadyassociated");
return null; return null;
} }
// still there, we can get real card and update it's barcodes // still there, we can get real card and update it's barcodes
card = cardBean.checkPrintedCard(user); PrintedCard card = cardBean.checkPrintedCard(user);
if (readerView.getBarcode() != null && !readerView.getBarcode().isEmpty()) { readerbean.assocCodeToCard(event , card);
card.setBarcode(readerView.getBarcode());
card.setCardState(CardState.PRINTED);
//super.addFaceMessage("usercard.associated");
MessageHelper.info("usercard.associated");
logger.debug("barcode {} to card {} ", readerView.getBarcode(), card.getUser().getNick());
cardBean.saveCard(card);
} else if (readerView.getReaderEvent() != null) {
readerbean.assocTagToCard(readerView.getReaderEvent() , card);
}
return null; return null;
} }
......
...@@ -24,6 +24,7 @@ import fi.codecrew.moya.enums.apps.UserPermission; ...@@ -24,6 +24,7 @@ import fi.codecrew.moya.enums.apps.UserPermission;
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.PrintedCard; import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.ReaderEvent;
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.web.annotations.SelectedUser; import fi.codecrew.moya.web.annotations.SelectedUser;
...@@ -130,7 +131,7 @@ public class IncomingView extends GenericCDIView { ...@@ -130,7 +131,7 @@ public class IncomingView extends GenericCDIView {
if (!initialized) { if (!initialized) {
logger.debug("INITIALIZING!!!!"); logger.debug("INITIALIZING!!!!");
initializePoller(); //initializePoller();
initialized = true; initialized = true;
super.beginConversation(); super.beginConversation();
} }
...@@ -146,9 +147,7 @@ public class IncomingView extends GenericCDIView { ...@@ -146,9 +147,7 @@ public class IncomingView extends GenericCDIView {
return null; return null;
} }
public void initializePoller() {
readerView.initializeForPolling();
}
public String changeToIncomingView() { public String changeToIncomingView() {
//super.navihandler.redirectNavigation("printCard.jsf?userid="+user.getUser().getId()); //super.navihandler.redirectNavigation("printCard.jsf?userid="+user.getUser().getId());
...@@ -157,13 +156,14 @@ public class IncomingView extends GenericCDIView { ...@@ -157,13 +156,14 @@ public class IncomingView extends GenericCDIView {
public void polledRead() { public void polledRead() {
if (!readerView.isNewBarcodes()) { ReaderEvent event = readerView.getReaderEvent();
if(event == null)
return; return;
}
logger.debug(":Barcode:"); logger.debug(":got.code:");
EventUser user = readerView.getUser(); EventUser user = event.getUser();
if (user != null) { if (user != null) {
if (!user.equals(userview.getUser())) { if (!user.equals(userview.getUser())) {
logger.info("found user {}, redirecting", user.getNick()); logger.info("found user {}, redirecting", user.getNick());
...@@ -182,11 +182,13 @@ public class IncomingView extends GenericCDIView { ...@@ -182,11 +182,13 @@ public class IncomingView extends GenericCDIView {
} }
} }
readerView.pollingBarcodeHandled();
} }
public String selectUser() { public String selectUser() {
EventUser user = readerView.getUser();
ReaderEvent event = readerView.getReaderEvent();
EventUser user = event.getUser();
memberlist = null; memberlist = null;
if (user == null) { if (user == null) {
......
...@@ -8,6 +8,7 @@ import org.slf4j.Logger; ...@@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.ReaderEvent;
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;
import fi.codecrew.moya.web.cdiview.reader.ReaderView; import fi.codecrew.moya.web.cdiview.reader.ReaderView;
...@@ -41,7 +42,13 @@ public class InfoView extends GenericCDIView { ...@@ -41,7 +42,13 @@ public class InfoView extends GenericCDIView {
} }
public String selectUser() { public String selectUser() {
EventUser user = readerView.getUser();
ReaderEvent event = readerView.getReaderEvent();
if(event == null)
return null;
EventUser user = event.getUser();
if(user == null) { if(user == null) {
return null; return null;
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!