Commit b197f1a6 by Tuomas Riihimäki

Random stuff.

1 parent 0cbebcb7
Showing with 212 additions and 98 deletions
......@@ -16,6 +16,11 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
......@@ -26,5 +31,6 @@
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
......@@ -72,6 +72,8 @@ public class BillBean implements BillBeanLocal {
private LoggingBeanLocal loggingBean;
@EJB
private EventUserFacade eventUserFacade;
@EJB
private ProductPBean productPBean;
/**
* Default constructor.
......@@ -238,7 +240,7 @@ public class BillBean implements BillBeanLocal {
placebean.lockPlaceProduct(bill.getUser(), prod, bl.getQuantity());
}
AccountEvent ac2 = productBean.createAccountEvent(prod, bl.getQuantity(), user, bill.getSentDate());
AccountEvent ac2 = productPBean.createAccountEvent(prod, bl.getQuantity(), user, bill.getSentDate());
logger.info("Created ac from product. {}, userproducts {}", ac2, user.getAccountEvents().size());
ac2.setSeller(permbean.getCurrentUser());
......
......@@ -86,9 +86,9 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@Override
public boolean isPaymentEnabled()
{
LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
final LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
final String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
final String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
return !((expire != null && new Date().after(expire.getDateValue()))
|| merchantid == null || merchantid.isEmpty()
|| merchantPassword == null || merchantPassword.isEmpty());
......@@ -107,24 +107,25 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
@RolesAllowed(BillPermission.S_CREATE_VERKKOMAKSU)
public List<CheckoutBank> getToken(Bill bill)
{
LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
final LanEventPrivateProperty expire = eventbean.getPrivateProperty(LanEventPrivatePropertyKey.CHECKOUT_FI_KEY_EXPIRE);
final String merchantid = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_ID);
final String merchantPassword = eventbean.getPrivatePropertyString(LanEventPrivatePropertyKey.CHECKOUT_FI_MERCHANT_PASSWORD);
if ((expire != null && new Date().after(expire.getDateValue()))
|| merchantid == null || merchantid.isEmpty()
|| merchantPassword == null || merchantPassword.isEmpty())
{
return null;
}
String priceInCents = Integer.valueOf(bill.totalPrice().multiply(TO_CENTS).intValue()).toString();
Map<CheckoutFiParam, String> postParams = new HashMap<CheckoutFiParam, String>();
final String priceInCents = Integer.valueOf(bill.totalPrice().multiply(TO_CENTS).intValue()).toString();
final Map<CheckoutFiParam, String> postParams = new HashMap<CheckoutFiParam, String>();
String returnUrl = new StringBuilder(BortalLocalContextHolder.isSsl() ? "https://" : "http://")
final String returnUrl = new StringBuilder(BortalLocalContextHolder.isSsl() ? "https://" : "http://")
.append(BortalLocalContextHolder.getHostname())
.append("/LanBortalWeb/checkout/")
.toString();
StringBuilder stamp = new StringBuilder();
final StringBuilder stamp = new StringBuilder();
stamp.append(bill.getId());
stamp.append(STAMP_SPLITCHAR);
stamp.append(bill.getSentDate().getTimeInMillis() / 1000);
......@@ -167,14 +168,16 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
nameValuePairs.add(new BasicNameValuePair("MAC", calculatedHash));
HttpPost postRequest = new HttpPost(REMOTE_URL);
final HttpPost postRequest = new HttpPost(REMOTE_URL);
postRequest.setEntity(new UrlEncodedFormEntity(nameValuePairs));
DefaultHttpClient client = new DefaultHttpClient();
final DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(postRequest);
StringWriter writer = new StringWriter();
final StringWriter writer = new StringWriter();
IOUtils.copy(response.getEntity().getContent(), writer, "UTF8");
String xmlReturn = writer.toString();
final String xmlReturn = writer.toString();
// logger.info("Got response from checkout.fi msg {}, {} ",
// response.getStatusLine().getStatusCode(), xmlReturn);
......
......@@ -5,6 +5,7 @@
package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
......@@ -53,9 +54,11 @@ import fi.insomnia.bortal.model.ProductFlag;
*/
@Stateless
@LocalBean
@DeclareRoles({ MapPermission.S_BUY_PLACES,
@DeclareRoles({
MapPermission.S_BUY_PLACES,
MapPermission.S_MANAGE_MAPS,
MapPermission.S_VIEW,
MapPermission.S_MANAGE_OTHERS,
})
public class PlaceBean implements PlaceBeanLocal {
private static final String PLACE_RESERVE_TIMEOUTER = "Map reserve timeouter";
......@@ -93,6 +96,8 @@ public class PlaceBean implements PlaceBeanLocal {
private AccountEventBeanLocal acbean;
@EJB
private PlaceGroupFacade pgfacade;
@EJB
private ProductPBean productPBean;
@Override
@RolesAllowed(MapPermission.S_MANAGE_MAPS)
......@@ -231,12 +236,12 @@ public class PlaceBean implements PlaceBeanLocal {
// }
@Override
@RolesAllowed(MapPermission.S_BUY_PLACES)
@RolesAllowed({ MapPermission.S_BUY_PLACES, MapPermission.S_MANAGE_OTHERS })
public PlaceGroup buySelectedPlaces(EventUser user) throws BortalCatchableException {
if (user == null) {
user = permbean.getCurrentUser();
} else {
if (!user.equals(permbean.getCurrentUser())) {
if (!user.equals(permbean.getCurrentUser()) && !permbean.hasPermission(MapPermission.MANAGE_OTHERS)) {
loggerbean.logMessage(SecurityLogType.permissionDenied, permbean.getCurrentUser(), "Can not buy places for user " + user);
throw new EJBAccessException("Not enough permissions to buy place");
}
......@@ -253,13 +258,13 @@ public class PlaceBean implements PlaceBeanLocal {
BigDecimal totalprice = addAndCalcPrice(user, null);
BigDecimal balance = user.getAccountBalance();
if (balance.compareTo(totalprice) < 0) {
if (balance.compareTo(totalprice) < 0 && !permbean.hasPermission(MapPermission.MANAGE_OTHERS)) {
logger.info("User {} Could not buy things because account balance {} is too low for purchase {}", new Object[] { user, balance, totalprice });
return null;
}
for (Entry<Product, Integer> line : getPlaceProductcount(places).entrySet()) {
productBean.createAccountEvent(line.getKey(), new BigDecimal(line.getValue()), user);
productPBean.createAccountEvent(line.getKey(), new BigDecimal(line.getValue()), user, Calendar.getInstance());
}
PlaceGroup pg = new PlaceGroup(event, Calendar.getInstance(), Calendar.getInstance(), true);
......@@ -357,6 +362,13 @@ public class PlaceBean implements PlaceBeanLocal {
GroupMembership membership = new GroupMembership(pg, p, gmemfacade.createInviteToken());
pg.getMembers().add(membership);
p.setPlaceReserver(membership);
if (pg.getPlaces() == null) {
pg.setPlaces(new ArrayList<Place>());
}
if (!pg.getPlaces().contains(p))
{
pg.getPlaces().add(p);
}
return membership;
}
......
......@@ -23,6 +23,7 @@ import com.pdfjet.TextLine;
import fi.insomnia.bortal.enums.apps.MapPermission;
import fi.insomnia.bortal.enums.apps.SpecialPermission;
import fi.insomnia.bortal.facade.EventUserFacade;
import fi.insomnia.bortal.facade.GroupMembershipFacade;
import fi.insomnia.bortal.facade.PlaceGroupFacade;
import fi.insomnia.bortal.model.EventUser;
......@@ -53,6 +54,8 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
private LoggingBeanLocal loggerbean;
@EJB
private PlaceGroupFacade pgfacade;
@EJB
private EventUserFacade eventuserfacade;
/**
* Default constructor.
......@@ -102,17 +105,18 @@ public class PlaceGroupBean implements PlaceGroupBeanLocal {
@Override
@RolesAllowed(MapPermission.S_BUY_PLACES)
public boolean associateToToken(EventUser user, String token) {
user = eventuserfacade.reload(user);
if (!permbean.isCurrentUser(user) && !permbean.hasPermission(MapPermission.MANAGE_OTHERS)) {
throw new EJBAccessException();
}
token = token.trim();
GroupMembership mem = gmemfacade.findByToken(token);
boolean ret = false;
if (mem != null && mem.getUser() == null) {
mem.setUser(user);
gmemfacade.merge(mem);
// gmemfacade.merge(mem);
ret = true;
}
......
......@@ -2,7 +2,6 @@ package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
......@@ -28,7 +27,6 @@ import fi.insomnia.bortal.facade.ProductFacade;
import fi.insomnia.bortal.facade.UserFacade;
import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.DiscountInstance;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.LanEvent;
import fi.insomnia.bortal.model.Product;
......@@ -78,6 +76,8 @@ public class ProductBean implements ProductBeanLocal {
private EventBeanLocal eventbean;
@EJB
private BillLineFacade billLineFacade;
@EJB
private ProductPBean productPBean;
private static final Logger logger = LoggerFactory.getLogger(ProductBean.class);
......@@ -290,36 +290,6 @@ public class ProductBean implements ProductBeanLocal {
// return ret;
// }
public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user, Calendar date) {
BigDecimal unitPrice = product.getPrice().negate();
List<Discount> discounts = product.getActiveDiscounts(quantity, date);
for (Discount d : discounts) {
unitPrice = unitPrice.multiply(d.getPercentage());
}
AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity, Calendar.getInstance());
ret.setDelivered(Calendar.getInstance());
ret.setSeller(permbean.getCurrentUser());
List<DiscountInstance> accEventdiscounts = ret.getDiscountInstances();
for (Discount d : discounts) {
// discountsArray.add(discInst);
// discountinstancefacade.create(discInst);
accEventdiscounts.add(new DiscountInstance(ret, d));
}
if (user.getAccountEvents() == null) {
user.setAccountEvents(new ArrayList<AccountEvent>());
}
user.getAccountEvents().add(ret);
accounteventfacade.create(ret);
// flush changes to db.
// userFacade.flush();
return ret;
}
@Override
public Product findById(int id) {
Product ret = productFacade.find(id);
......@@ -354,14 +324,15 @@ public class ProductBean implements ProductBeanLocal {
@Override
public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user) {
return createAccountEvent(product, quantity, user, Calendar.getInstance());
user = eventUserFacade.reload(user);
AccountEvent ret = productPBean.createAccountEvent(product, quantity, user, Calendar.getInstance());
return ret;
}
@Override
//@RolesAllowed(ShopPermission.S_LIST_ALL_PRODUCTS)
// @RolesAllowed(ShopPermission.S_LIST_ALL_PRODUCTS)
public Product findByBarcode(String barcode) {
return productFacade.findProductByBarcode(barcode);
}
}
package fi.insomnia.bortal.beans;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import javax.ejb.EJB;
import javax.ejb.LocalBean;
import javax.ejb.Stateless;
import fi.insomnia.bortal.facade.AccountEventFacade;
import fi.insomnia.bortal.model.AccountEvent;
import fi.insomnia.bortal.model.Discount;
import fi.insomnia.bortal.model.DiscountInstance;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.Product;
/**
* Session Bean implementation class ProductPBean
*/
@Stateless
@LocalBean
public class ProductPBean {
@EJB
private PermissionBean permbean;
private AccountEventFacade accounteventfacade;
/**
* Default constructor.
*/
public ProductPBean() {
// TODO Auto-generated constructor stub
}
/**
* Creates new AccountEvent from provided product to provided user <br>
* <strong>Notice</strong>, that this function expects the user parameter to
* be attached entity!
*
* @param product
* Product to create the account event from
* @param quantity
* How many products have been bought
* @param user
* user to whom the product should be created. MUST BE ATTACHED
* ENTITY!
* @param date
* AccountEvent creation time
* @return The created AccountEvent entity
*/
public AccountEvent createAccountEvent(Product product, BigDecimal quantity, EventUser user, Calendar date) {
BigDecimal unitPrice = product.getPrice().negate();
List<Discount> discounts = product.getActiveDiscounts(quantity, date);
for (Discount d : discounts) {
unitPrice = unitPrice.multiply(d.getPercentage());
}
AccountEvent ret = new AccountEvent(user, product, unitPrice, quantity, Calendar.getInstance());
ret.setDelivered(Calendar.getInstance());
ret.setSeller(permbean.getCurrentUser());
List<DiscountInstance> accEventdiscounts = ret.getDiscountInstances();
for (Discount d : discounts) {
// discountsArray.add(discInst);
// discountinstancefacade.create(discInst);
accEventdiscounts.add(new DiscountInstance(ret, d));
}
if (user.getAccountEvents() == null) {
user.setAccountEvents(new ArrayList<AccountEvent>());
}
user.getAccountEvents().add(ret);
accounteventfacade.create(ret);
// flush changes to db.
// userFacade.flush();
return ret;
}
}
......@@ -16,6 +16,11 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
......@@ -26,5 +31,6 @@
<nature>org.eclipse.wst.common.modulecore.ModuleCoreNature</nature>
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
......@@ -36,9 +36,9 @@ public interface ProductBeanLocal {
// List<Discount> getActiveDiscounts(Product product, BigDecimal quantity);
Product findById(int parseInt);
Product findByBarcode(String barcode);
List<Product> findForStaffshop();
Discount findDiscount(Integer discountid);
......
......@@ -17,7 +17,7 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
......@@ -36,6 +36,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
......@@ -43,5 +48,6 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.axdt.as3.imp.nature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
Manifest-Version: 1.0
Class-Path: lib/LanBortalUtilities.jar
bcprov-jdk16-146.jar
bcmail-jdk16-146.jar
Class-Path: bcprov-jdk16-146.jar
bcmail-jdk16-146.jar
LanBortalUtilities.jar
......@@ -26,7 +26,9 @@ public abstract class EntityEquals {
@Override
public boolean equals(Object o) {
boolean ret = false;
if (o != null && o instanceof EntityEquals && this.getClass().getCanonicalName().equals(o.getClass().getCanonicalName())) {
if (this == o) {
ret = true;
} else if (o != null && o instanceof EntityEquals && this.getClass().getCanonicalName().equals(o.getClass().getCanonicalName())) {
EntityEquals oobj = (EntityEquals) o;
if (getId() == null) {
ret = (getRndid().equals(oobj.rndid));
......
......@@ -16,7 +16,6 @@ import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.persistence.UniqueConstraint;
import org.eclipse.persistence.annotations.OptimisticLocking;
import org.eclipse.persistence.annotations.OptimisticLockingType;
......@@ -25,7 +24,9 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
*
*/
@Entity
@Table(name = "group_memberships", uniqueConstraints = { @UniqueConstraint(columnNames = { GroupMembership.EVENTUSER_ID, GroupMembership.GROUP_ID }) })
@Table(name = "group_memberships")
// , uniqueConstraints = { @UniqueConstraint(columnNames = {
// GroupMembership.EVENTUSER_ID, GroupMembership.GROUP_ID }) })
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class GroupMembership extends GenericEntity {
......
......@@ -17,7 +17,7 @@ import org.eclipse.persistence.annotations.OptimisticLockingType;
import org.eclipse.persistence.annotations.PrivateOwned;
@Entity
@Table(name = "site_pages", uniqueConstraints = @UniqueConstraint(columnNames = { "event_id", "name" }))
@Table(name = "site_pages", uniqueConstraints = @UniqueConstraint(columnNames = { SitePage.EVENT_ID_COLUMN, "name" }))
@OptimisticLocking(type = OptimisticLockingType.CHANGED_COLUMNS)
public class SitePage extends GenericEntity {
......
......@@ -5,7 +5,7 @@ import javax.persistence.metamodel.ListAttribute;
import javax.persistence.metamodel.SingularAttribute;
import javax.persistence.metamodel.StaticMetamodel;
@Generated(value="Dali", date="2012-05-12T14:43:39.125+0300")
@Generated(value="Dali", date="2012-10-04T21:02:39.749+0300")
@StaticMetamodel(SitePage.class)
public class SitePage_ extends GenericEntity_ {
public static volatile SingularAttribute<SitePage, LanEvent> event;
......
......@@ -16,7 +16,7 @@
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
......@@ -25,6 +25,11 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jem.workbench.JavaEMFNature</nature>
......@@ -32,5 +37,6 @@
<nature>org.eclipse.wst.common.project.facet.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.axdt.as3.imp.nature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
......@@ -126,7 +126,7 @@
<h:inputTextarea value="#{placeView.place.group.details}" />
<h:outputLabel value="#{i18n['placegroup.creator']}" />
<h:link outcome="/user/edit" value="#{placeView.place.group.creator.wholeName}" >
<h:link outcome="/useradmin/edit" value="#{placeView.place.group.creator.wholeName}" >
<f:param name="userid" value="#{placeView.place.group.creator.id}"/>
</h:link>
</h:panelGrid>
......@@ -147,7 +147,7 @@
<h:column>
<h:outputText rendered="#{empty place.placeReserver.user}" value="#{i18n['place.noReserver']}" />
<h:link rendered="#{!empty place.placeReserver.user}" outcome="/user/edit">
<h:link rendered="#{!empty place.placeReserver.user}" outcome="/useradmin/edit">
<h:outputText value="#{place.placeReserver.user.wholeName}" />
(<h:outputText value="#{place.placeReserver.user.nick}" />)
<f:param name="userid" value="#{place.placeReserver.user.user.id}" />
......
......@@ -18,7 +18,8 @@
<div style="margin-top: 5px;">
<h:commandButton action="#{cc.attrs.commitaction}" id="commitbutton-top" value="#{cc.attrs.commitValue}" />
</div>
<h:dataTable columnClasses=",numalign,numalign,,numalign" styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart">
<h:dataTable columnClasses="nowrap,numalign,numalign,nowrap,numalign" styleClass="bordertable" id="billcart" value="#{cc.attrs.items}" var="cart">
<h:column>
<f:facet name="header">
<h:outputText id="name" value="${i18n['product.name']}" />
......
......@@ -24,7 +24,7 @@
<h2>#{i18n['role.permissionheader']}</h2>
<p>
<h:form id="permissionform">
<h:commandButton id="save" value="#{i18n['role.savePermissions']}" action="#{roleView.savePermissions}" />
<h:commandButton id="save1" value="#{i18n['role.savePermissions']}" action="#{roleView.savePermissions}" />
<h:dataTable border="1" id="bortalApps" value="#{roleView.rolePermissions}" var="bapp">
<h:column>
<f:facet name="header">
......@@ -54,7 +54,7 @@
<!-- </ui:repeat> -->
<!-- </h:column> -->
</h:dataTable>
<h:commandButton id="save" value="#{i18n['role.savePermissions']}" action="#{roleView.savePermissions}" />
<h:commandButton id="save2" value="#{i18n['role.savePermissions']}" action="#{roleView.savePermissions}" />
</h:form>
</p>
......
......@@ -172,7 +172,7 @@ a:hover {
width: 100%;
background: url(../img/container-top.png) no-repeat;
height: 15px;
padding-left: 1em;
padding-left: 1em;
}
.container.bottom {
......@@ -231,7 +231,7 @@ td ul {
#right ul {
color: #7dac0c;
list-style-type: square;
list-style-position:inside;
list-style-position: inside;
}
#right ul li {
......@@ -240,19 +240,22 @@ td ul {
#right ul li a {
color: #0073bc;
text-decoration: none;
text-decoration: none;
}
#right ul li a:hover {
color: #7dac0c;
text-decoration: none;
text-decoration: none;
}
table {
border-collapse: collapse;
}
table.border td,table.border th {
padding: 1px 4px;
}
.nowrap {
white-space: nowrap;
}
\ No newline at end of file
......@@ -25,11 +25,8 @@
</ui:define>
<ui:define name="content">
<h:form id="shoppingcartform">
<h:panelGrid columns="2">
<h:panelGrid columns="2">
<h:outputLabel value="#{i18n['shop.accountBalance']}" />
......@@ -47,7 +44,6 @@
<f:ajax render="@form" event="valueChange" />
<f:convertNumber />
</h:inputText>
</h:panelGrid>
<h:panelGroup>
<h:outputLabel value="#{i18n['shop.readBarcode']}" />
......
......@@ -22,6 +22,7 @@ import fi.insomnia.bortal.exceptions.BortalCatchableException;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.EventUser;
import fi.insomnia.bortal.model.Place;
import fi.insomnia.bortal.model.PlaceGroup;
import fi.insomnia.bortal.model.User;
import fi.insomnia.bortal.utilities.SearchQuery;
import fi.insomnia.bortal.web.annotations.SelectedUser;
......@@ -105,20 +106,18 @@ public class PlaceView extends GenericCDIView {
price = placebean.getTotalReservationPrice(place);
} else {
price = placebean.getTotalReservationPrice(user, place);
}
logger.debug("Balance {}, price {}", balance, price);
if (price.compareTo(balance) <= 0) {
logger.debug("Place was free. Marking for user.");
if (!placebean.reservePlace(place, user)) {
this.addFaceMessage("mapView.errorWhenReservingPlace");
}
} else {
if (balance.compareTo(BigDecimal.ZERO) > 0) {
addFaceMessage("mapView.notEnoughCreditsToReserve");
}
logger.debug("Did not have enought money to reserve place! required {} , got {}", price, balance);
logger.debug("Did not have enought credits to reserve place! required {} , got {}", price, balance);
}
}
}
......@@ -140,7 +139,12 @@ public class PlaceView extends GenericCDIView {
try {
EventUser user = userbean.getEventUser(userlist.getRowData());
if (placebean.reservePlace(place, user)) {
placebean.buySelectedPlaces(user);
PlaceGroup newgroup = placebean.buySelectedPlaces(user);
for (Place p : newgroup.getPlaces()) {
if (p.equals(place)) {
place = p;
}
}
}
} catch (BortalCatchableException e) {
......
......@@ -33,13 +33,12 @@ public class TokenView extends GenericCDIView {
return null;
}
String ret = "myGroups";
// String ret = "myGroups";
if (!placegroupbean.associateToToken(user, getToken())) {
this.addFaceMessage("placetoken.tokenNotFound");
ret = null;
}
return ret;
return null;
}
public void setToken(String token) {
......
......@@ -176,15 +176,13 @@ public class ProductShopView extends GenericCDIView {
EventUser retuser = null;
for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
retuser = productBean.createAccountEvent(shopitem.getProduct(),
shopitem.getCount(), user).getUser();
retuser = productBean.createAccountEvent(shopitem.getProduct(), shopitem.getCount(), user).getUser();
}
}
if (cash != null && cash.compareTo(BigDecimal.ZERO) != 0) {
Product credProd = productBean.findCreditProduct();
retuser = productBean.createAccountEvent(credProd, cash, user)
.getUser();
retuser = productBean.createAccountEvent(credProd, cash, user).getUser();
}
if (user != null) {
user = retuser;
......
......@@ -10,8 +10,19 @@
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.jboss.tools.jst.web.kb.kbbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.jboss.tools.jst.web.kb.kbnature</nature>
</natures>
</projectDescription>
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!