Commit 9497091c by Tuukka Kivilahti

finalizing

1 parent 6dda4622
...@@ -112,7 +112,7 @@ public class BillPBean { ...@@ -112,7 +112,7 @@ public class BillPBean {
logger.debug("Creating Bill prepaidInstant product {}, {}", prod.getName(), bl.getQuantity()); logger.debug("Creating Bill prepaidInstant product {}, {}", prod.getName(), bl.getQuantity());
AccountEvent ac2 = productPBean.createAccountEvent(prod, null,bl.getQuantity(), user, bill.getSentDate(), bl.getFoodwave()); AccountEvent ac2 = productPBean.createAccountEvent(prod, null,bl.getQuantity(), user, bill.getSentDate(), bl.getName() ,bl.getFoodwave());
logger.info("Created ac from product. {}, userproducts {}", ac2, user.getAccountEvents().size()); logger.info("Created ac from product. {}, userproducts {}", ac2, user.getAccountEvents().size());
ac2.setSeller(permbean.getCurrentUser()); ac2.setSeller(permbean.getCurrentUser());
......
...@@ -22,10 +22,7 @@ import java.security.Principal; ...@@ -22,10 +22,7 @@ import java.security.Principal;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.annotation.security.DeclareRoles; import javax.annotation.security.DeclareRoles;
import javax.ejb.EJB; import javax.ejb.*;
import javax.ejb.LocalBean;
import javax.ejb.SessionContext;
import javax.ejb.Stateless;
import javax.resource.spi.IllegalStateException; import javax.resource.spi.IllegalStateException;
import fi.codecrew.moya.enums.apps.*; import fi.codecrew.moya.enums.apps.*;
......
...@@ -474,7 +474,7 @@ public class ProductBean implements ProductBeanLocal { ...@@ -474,7 +474,7 @@ public class ProductBean implements ProductBeanLocal {
public AccountEvent createAccountEvent(Product product, BigDecimal overriddenUnitPrice, BigDecimal quantity, EventUser user) { public AccountEvent createAccountEvent(Product product, BigDecimal overriddenUnitPrice, BigDecimal quantity, EventUser user) {
user = eventUserFacade.reload(user); user = eventUserFacade.reload(user);
AccountEvent ret = productPBean.createAccountEvent(product, overriddenUnitPrice, quantity, user, new Date(), null); AccountEvent ret = productPBean.createAccountEvent(product, overriddenUnitPrice, quantity, user, new Date(), null, null);
cardTemplateBean.checkPrintedCard(user); cardTemplateBean.checkPrintedCard(user);
return ret; return ret;
} }
...@@ -562,7 +562,10 @@ public class ProductBean implements ProductBeanLocal { ...@@ -562,7 +562,10 @@ public class ProductBean implements ProductBeanLocal {
continue; continue;
} }
// TODO: pizzas also removed // foods are handled from different view, remove them from here
if(ae.getProduct().getFoodWaveTemplates() != null && !ae.getProduct().getFoodWaveTemplates().isEmpty()) {
continue;
}
retlist.add(ae); retlist.add(ae);
} }
......
...@@ -75,8 +75,11 @@ public class ProductPBean { ...@@ -75,8 +75,11 @@ public class ProductPBean {
} }
public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user, Date date) { public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user, Date date) {
return this.createAccountEvent(product, null, quantity, user, date, null, null);
}
return this.createAccountEvent(product, null, quantity, user, date, null); public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user, Date date, String description) {
return this.createAccountEvent(product, null, quantity, user, date, description, null);
} }
/** /**
...@@ -95,7 +98,7 @@ public class ProductPBean { ...@@ -95,7 +98,7 @@ public class ProductPBean {
* AccountEvent creation time * AccountEvent creation time
* @return The created AccountEvent entity * @return The created AccountEvent entity
*/ */
public AccountEvent createAccountEvent(Product product, BigDecimal overriddenUnitPrice, BigDecimal quantity, EventUser user, Date date, FoodWave foodwave) { public AccountEvent createAccountEvent(Product product, BigDecimal overriddenUnitPrice, BigDecimal quantity, EventUser user, Date date, String description, FoodWave foodwave) {
if (!accounteventfacade.isAttached(product)) { if (!accounteventfacade.isAttached(product)) {
product = productFacade.reload(product); product = productFacade.reload(product);
...@@ -125,6 +128,18 @@ public class ProductPBean { ...@@ -125,6 +128,18 @@ public class ProductPBean {
AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity, Calendar.getInstance()); AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity, Calendar.getInstance());
// If product name is edited, move it into the description
if(description != null && !description.isEmpty() && !product.getName().equals(description)) {
String aeDescription = description;
// Remove product name from option descriptions
aeDescription = aeDescription.replaceFirst("^" + product.getName() + ",?", "").trim();
ret.setDescription(aeDescription);
}
// ret.setDelivered(Calendar.getInstance()); // ret.setDelivered(Calendar.getInstance());
ret.setSeller(permbean.getCurrentUser()); ret.setSeller(permbean.getCurrentUser());
......
...@@ -186,7 +186,7 @@ public class ReaderBean implements ReaderBeanLocal { ...@@ -186,7 +186,7 @@ public class ReaderBean implements ReaderBeanLocal {
if (reader.isAutoproduct()) { if (reader.isAutoproduct()) {
EventUser eu = userbean.getEventUser(card.getUser().getUser(), false); EventUser eu = userbean.getEventUser(card.getUser().getUser(), false);
if (eu != null) { if (eu != null) {
AccountEvent createAc = productPBean.createAccountEvent(reader.getAutomaticProduct(), reader.getAutomaticProductCount(), eu, new Date()); AccountEvent createAc = productPBean.createAccountEvent(reader.getAutomaticProduct(), reader.getAutomaticProductCount(), eu, new Date(), "Created automatically");
readerfacade.flush(); readerfacade.flush();
logger.info("Creating new accountevent from autoproduct {}", createAc); logger.info("Creating new accountevent from autoproduct {}", createAc);
event.setNotes("Created automatic account event from reader. " + createAc); event.setNotes("Created automatic account event from reader. " + createAc);
......
...@@ -57,9 +57,19 @@ ...@@ -57,9 +57,19 @@
</p:dataTable> </p:dataTable>
</p:fieldset> </p:fieldset>
<br /><br /><br /> <br /><br />
<br />
<p:commandButton value="#{i18n['incomingflow.markEverythingGiven']}" update="membershipForm accounteventlistform" disabled="#{cardlessIncomingView.allGiven}" actionListener="#{cardlessIncomingView.giveEverything}" /> <p:commandButton value="#{i18n['incomingflow.markEverythingGiven']}" update="membershipForm accounteventlistform" disabled="#{cardlessIncomingView.allGiven}" actionListener="#{cardlessIncomingView.giveEverything}" />
<br /><br /><br /> <br />
<p:fragment id="ungivenFragment" >
<span style="color: red; font-size: larger; font-weight: bolder;">
<h:outputText rendered="#{cardlessIncomingView.ungivenAccountevents}" value="#{i18n['incomingflow.ungivenProducts']}" />
</span>
</p:fragment>
<br />
<br />
<h:outputText rendered="#{empty cardlessIncomingView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" /> <h:outputText rendered="#{empty cardlessIncomingView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" />
<p:fieldset id="groupMembershipList" rendered="#{!empty cardlessIncomingView.groupMemberships}" legend="#{i18n['incomingflow.groupmemberships']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}"> <p:fieldset id="groupMembershipList" rendered="#{!empty cardlessIncomingView.groupMemberships}" legend="#{i18n['incomingflow.groupmemberships']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}">
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" /> <p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
...@@ -124,8 +134,8 @@ ...@@ -124,8 +134,8 @@
<h:outputText value="#{prod.description}" /> <h:outputText value="#{prod.description}" />
</p:column> </p:column>
<p:column> <p:column>
<p:commandButton update=":accounteventlistform" rendered="#{empty prod.delivered}" actionListener="#{cardlessIncomingView.giveAccountEvent}" value="#{i18n['incomingflow.giveAccountEvent']}" /> <p:commandButton update=":accounteventlistform :membershipForm:ungivenFragment" rendered="#{empty prod.delivered}" actionListener="#{cardlessIncomingView.giveAccountEvent}" value="#{i18n['incomingflow.giveAccountEvent']}" />
<p:commandButton update=":accounteventlistform" rendered="#{!empty prod.delivered}" actionListener="#{cardlessIncomingView.ungiveAccountEvent}" value="#{i18n['incomingflow.ungiveAccountEvent']}" /> <p:commandButton update=":accounteventlistform :membershipForm:ungivenFragment" rendered="#{!empty prod.delivered}" actionListener="#{cardlessIncomingView.ungiveAccountEvent}" value="#{i18n['incomingflow.ungiveAccountEvent']}" />
</p:column> </p:column>
</p:dataTable> </p:dataTable>
......
...@@ -179,12 +179,6 @@ public class CardlessIncomingView extends GenericCDIView { ...@@ -179,12 +179,6 @@ public class CardlessIncomingView extends GenericCDIView {
} }
} }
for(AccountEvent ae : productBean.getDeliverableAccountEvents(userview.getSelectedUser())) {
if(!ae.isEventDelivered()) {
productBean.markDelivered(ae,Calendar.getInstance());
}
}
addFaceMessage("incomingflow.allGiven",count); addFaceMessage("incomingflow.allGiven",count);
memberlist = null; memberlist = null;
...@@ -192,6 +186,27 @@ public class CardlessIncomingView extends GenericCDIView { ...@@ -192,6 +186,27 @@ public class CardlessIncomingView extends GenericCDIView {
} }
public boolean isAllGiven() { public boolean isAllGiven() {
List<GroupMembership> memberships = ticketBean.findMembershipPrintlistForUser(userview.getSelectedUser());
for(GroupMembership gm : memberships) {
if(gm.getEnteredEvent() != null) {
return false;
}
}
return true;
}
public boolean isUngivenAccountevents() {
List<AccountEvent> accountEvents = productBean.getDeliverableAccountEvents(userview.getSelectedUser());
for(AccountEvent ae : accountEvents) {
if(!ae.isEventDelivered()) {
return true;
}
}
return false; return false;
} }
......
...@@ -302,7 +302,7 @@ public class ProductShopItem implements Serializable { ...@@ -302,7 +302,7 @@ public class ProductShopItem implements Serializable {
if(option == null) if(option == null)
continue; continue;
if(retString.length() == 0) { if(retString.length() > 0) {
retString.append(", "); retString.append(", ");
} }
retString.append(option.getName()); retString.append(option.getName());
......
...@@ -384,7 +384,7 @@ incomingflow.giveplace = Mark given ...@@ -384,7 +384,7 @@ incomingflow.giveplace = Mark given
incomingflow.groupmemberships = Computer places and tickets incomingflow.groupmemberships = Computer places and tickets
incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user
incomingflow.invalidbarcode.title = Invalid code incomingflow.invalidbarcode.title = Invalid code
incomingflow.markEverythingGiven = Give all ungiven items incomingflow.markEverythingGiven=Give all ungiven tickets
incomingflow.multisearch = Multisearch incomingflow.multisearch = Multisearch
incomingflow.placesummary = Place summary incomingflow.placesummary = Place summary
incomingflow.printedCard = Card incomingflow.printedCard = Card
...@@ -1619,3 +1619,4 @@ incomingflow.giveAccountEvent=Mark given ...@@ -1619,3 +1619,4 @@ incomingflow.giveAccountEvent=Mark given
incomingflow.ungiveAccountEvent=Mark not given incomingflow.ungiveAccountEvent=Mark not given
incomingflow.deliverableProducts=Products to deliver incomingflow.deliverableProducts=Products to deliver
placegroupview.accountEventDescription=Description placegroupview.accountEventDescription=Description
incomingflow.ungivenProducts=User has ungiven deliverable products
...@@ -597,7 +597,7 @@ incomingflow.giveplace = Mark given ...@@ -597,7 +597,7 @@ incomingflow.giveplace = Mark given
incomingflow.groupmemberships = Computer places and tickets incomingflow.groupmemberships = Computer places and tickets
incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user incomingflow.invalidbarcode.message = Nothing found with the barcode, you can now add it to the user
incomingflow.invalidbarcode.title = Invalid code incomingflow.invalidbarcode.title = Invalid code
incomingflow.markEverythingGiven = Give all ungiven items incomingflow.markEverythingGiven=Give all ungiven tickets
incomingflow.multisearch = Multisearch incomingflow.multisearch = Multisearch
incomingflow.placesummary = Place summary incomingflow.placesummary = Place summary
incomingflow.printedCard = Card incomingflow.printedCard = Card
...@@ -1900,3 +1900,4 @@ incomingflow.giveAccountEvent=Mark given ...@@ -1900,3 +1900,4 @@ incomingflow.giveAccountEvent=Mark given
incomingflow.ungiveAccountEvent=Mark not given incomingflow.ungiveAccountEvent=Mark not given
incomingflow.deliverableProducts=Products to deliver incomingflow.deliverableProducts=Products to deliver
placegroupview.accountEventDescription=Description placegroupview.accountEventDescription=Description
incomingflow.ungivenProducts=User has ungiven deliverable products
...@@ -598,7 +598,7 @@ incomingflow.giveplace = Merkitse annetuksi ...@@ -598,7 +598,7 @@ incomingflow.giveplace = Merkitse annetuksi
incomingflow.groupmemberships = Konepaikat sek\u00E4 liput incomingflow.groupmemberships = Konepaikat sek\u00E4 liput
incomingflow.invalidbarcode.message = Piipatulla koodilla ei l\u00F6ytynyt mit\u00E4\u00E4n, voit lis\u00E4t\u00E4 koodin k\u00E4ytt\u00E4j\u00E4\u00E4n incomingflow.invalidbarcode.message = Piipatulla koodilla ei l\u00F6ytynyt mit\u00E4\u00E4n, voit lis\u00E4t\u00E4 koodin k\u00E4ytt\u00E4j\u00E4\u00E4n
incomingflow.invalidbarcode.title = Virheellinen koodi incomingflow.invalidbarcode.title = Virheellinen koodi
incomingflow.markEverythingGiven = Anna kaikki antamattomat tuotteet incomingflow.markEverythingGiven=Anna kaikki antamattomat liput
incomingflow.multisearch = Monihaku incomingflow.multisearch = Monihaku
incomingflow.placesummary = Paikkayhteenveto incomingflow.placesummary = Paikkayhteenveto
incomingflow.printedCard = Kortti incomingflow.printedCard = Kortti
...@@ -1887,3 +1887,4 @@ incomingflow.giveAccountEvent=Merkitse annetuksi ...@@ -1887,3 +1887,4 @@ incomingflow.giveAccountEvent=Merkitse annetuksi
incomingflow.ungiveAccountEvent=Ei olekkaan annettu incomingflow.ungiveAccountEvent=Ei olekkaan annettu
incomingflow.deliverableProducts=Toimitettavat tuotteet incomingflow.deliverableProducts=Toimitettavat tuotteet
placegroupview.accountEventDescription=Kuvaus placegroupview.accountEventDescription=Kuvaus
incomingflow.ungivenProducts=K\u00E4ytt\u00E4j\u00E4ll\u00E4 on toimittamattomia tuotteita
...@@ -78,6 +78,11 @@ ...@@ -78,6 +78,11 @@
<repositories> <repositories>
<repository> <repository>
<id>prime-repo</id>
<name>PrimeFaces Maven Repository</name>
<url>https://repository.primefaces.org</url>
</repository>
<repository>
<id>iudex</id> <id>iudex</id>
<url>http://iudex.fi/maven/</url> <url>http://iudex.fi/maven/</url>
</repository> </repository>
...@@ -86,11 +91,8 @@ ...@@ -86,11 +91,8 @@
<name>jvnet-nexus-releases</name> <name>jvnet-nexus-releases</name>
<url>https://maven.java.net/content/repositories/releases/</url> <url>https://maven.java.net/content/repositories/releases/</url>
</repository> </repository>
<repository> <!--
<id>prime-repo</id> -->
<name>PrimeFaces Maven Repository</name>
<url>http://repository.primefaces.org</url>
</repository>
<repository> <repository>
<id>apache.snapshots</id> <id>apache.snapshots</id>
<url>http://repository.apache.org/snapshots/</url> <url>http://repository.apache.org/snapshots/</url>
...@@ -99,5 +101,7 @@ ...@@ -99,5 +101,7 @@
<id>clojars.org</id> <id>clojars.org</id>
<url>http://clojars.org/repo</url> <url>http://clojars.org/repo</url>
</repository> </repository>
</repositories> </repositories>
</project> </project>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!