Commit 9cb48f04 by Tuukka Kivilahti

adding deliverable stuff

1 parent dbdee32e
......@@ -45,22 +45,22 @@ public class BootstrapBean implements BootstrapBeanLocal {
static {
// {"Query1","Query2",...}
dbUpdates.add(new String[] { "" }); // first version, no changes
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN game integer NOT NULL REFERENCES tournament_games(id)" });
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN rules integer NOT NULL REFERENCES tournament_rules(id)" });
dbUpdates.add(new String[] { "ALTER TABLE tournaments ADD COLUMN max_participants integer NOT NULL DEFAULT 0" });
dbUpdates.add(new String[] { "ALTER TABLE tournament_participants ADD COLUMN tournament integer NOT NULL REFERENCES tournaments(id)" });
dbUpdates.add(new String[] { "DELETE FROM application_permissions WHERE application = 'MAP' and permission = 'RELEASE_PLACE'" });
dbUpdates.add(new String[] { "ALTER TABLE site_page_content ADD COLUMN locale varchar(10)" });
dbUpdates.add(new String[] { "ALTER TABLE products ALTER COLUMN vat TYPE NUMERIC(4,3)" });
dbUpdates.add(new String[] { "ALTER TABLE actionlog_messages DROP COLUMN crew" });
dbUpdates.add(new String[] { "delete from application_permissions where application ilike '%terminal%'" });
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{""}); // first version, no changes
dbUpdates.add(new String[]{"ALTER TABLE tournaments ADD COLUMN game integer NOT NULL REFERENCES tournament_games(id)"});
dbUpdates.add(new String[]{"ALTER TABLE tournaments ADD COLUMN rules integer NOT NULL REFERENCES tournament_rules(id)"});
dbUpdates.add(new String[]{"ALTER TABLE tournaments ADD COLUMN max_participants integer NOT NULL DEFAULT 0"});
dbUpdates.add(new String[]{"ALTER TABLE tournament_participants ADD COLUMN tournament integer NOT NULL REFERENCES tournaments(id)"});
dbUpdates.add(new String[]{"DELETE FROM application_permissions WHERE application = 'MAP' and permission = 'RELEASE_PLACE'"});
dbUpdates.add(new String[]{"ALTER TABLE site_page_content ADD COLUMN locale varchar(10)"});
dbUpdates.add(new String[]{"ALTER TABLE products ALTER COLUMN vat TYPE NUMERIC(4,3)"});
dbUpdates.add(new String[]{"ALTER TABLE actionlog_messages DROP COLUMN crew"});
dbUpdates.add(new String[]{"delete from application_permissions where application ilike '%terminal%'"});
dbUpdates.add(new String[]{
"ALTER TABLE org_roles ADD ldap_role boolean not null default false",
"ALTER TABLE org_roles ADD ldap_weight integer NOT NULL default 100"
});
// barcodefuckup
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"DROP TABLE card_barcode",
"ALTER TABLE printed_cards DROP COLUMN barcode;",
"ALTER TABLE printed_cards DROP COLUMN rfid_uid;",
......@@ -72,11 +72,11 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE reader_events ALTER COLUMN type DROP DEFAULT;",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"delete from menu_navigation where item_id in (select id from menuitem where url in ( '/actionlog/messagelist'))",
"delete from menuitem where url in ('/actionlog/messagelist')",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"alter table compos add hidden boolean default false not null"
});
......@@ -151,16 +151,16 @@ public class BootstrapBean implements BootstrapBeanLocal {
"user_notes",
"users"));
dbUpdates.add(new String[] { "CREATE TABLE network_associations (id SERIAL NOT NULL, create_time TIMESTAMPTZ NOT NULL, ip TEXT, mac TEXT, meta TEXT, modify_time TIMESTAMPTZ NOT NULL, status TEXT NOT NULL, event INTEGER, event_user INTEGER, place INTEGER, PRIMARY KEY (id))" });
dbUpdates.add(new String[]{"CREATE TABLE network_associations (id SERIAL NOT NULL, create_time TIMESTAMPTZ NOT NULL, ip TEXT, mac TEXT, meta TEXT, modify_time TIMESTAMPTZ NOT NULL, status TEXT NOT NULL, event INTEGER, event_user INTEGER, place INTEGER, PRIMARY KEY (id))"});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE card_text_data (id SERIAL NOT NULL, font_name TEXT NOT NULL, font_style INTEGER NOT NULL, size INTEGER NOT NULL, text TEXT, text_alignment TEXT NOT NULL, card_text_data_type TEXT NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE card_object_data (id SERIAL NOT NULL, card_object_data_type TEXT NOT NULL, size INTEGER NOT NULL, x INTEGER NOT NULL, y INTEGER NOT NULL, z_index INTEGER NOT NULL, PRIMARY KEY (id));"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE card_text_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;",
"ALTER TABLE card_object_data ADD COLUMN card_templates_id integer REFERENCES card_templates(id) DEFAULT null;"
});
......@@ -168,29 +168,29 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(alterTables("ADD COLUMN meta json",
"card_text_data",
"card_object_data"));
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE card_text_data ADD COLUMN font_color_r integer DEFAULT 0;",
"ALTER TABLE card_text_data ADD COLUMN font_color_g integer DEFAULT 0;",
"ALTER TABLE card_text_data ADD COLUMN font_color_b integer DEFAULT 0;"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE card_text_data ALTER COLUMN size TYPE numeric(5,2);",
"ALTER TABLE card_object_data ALTER COLUMN size TYPE numeric(5,2);"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE card_text_data DROP COLUMN font_style;",
"ALTER TABLE card_text_data ADD COLUMN font_style TEXT NOT NULL DEFAULT 'PLAIN';"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE event_log RENAME log_id TO id;"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE network_associations ALTER COLUMN meta TYPE json USING (meta::json);"
});
dbUpdates.add(new String[] { "CREATE TABLE lecture_groups (id SERIAL NOT NULL, event_id integer NOT NULL, description TEXT, name TEXT, select_count INTEGER, meta json, PRIMARY KEY (id))",
dbUpdates.add(new String[]{"CREATE TABLE lecture_groups (id SERIAL NOT NULL, event_id integer NOT NULL, description TEXT, name TEXT, select_count INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lectures (id SERIAL NOT NULL, description TEXT, hours numeric(10,2), max_participants_count INTEGER, name TEXT, start_time TIMESTAMPTZ, lecture_group_id INTEGER, meta json, PRIMARY KEY (id))",
"CREATE TABLE lecture_roles (role_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (role_id, lecture_id))",
"CREATE TABLE lecture_participants (eventuser_id INTEGER NOT NULL, lecture_id INTEGER NOT NULL, PRIMARY KEY (eventuser_id, lecture_id))",
......@@ -198,66 +198,66 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)",
"ALTER TABLE lecture_roles ADD CONSTRAINT FK_lecture_roles_role_id FOREIGN KEY (role_id) REFERENCES roles (id)",
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_eventuser_id FOREIGN KEY (eventuser_id) REFERENCES event_users (id)",
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)" });
"ALTER TABLE lecture_participants ADD CONSTRAINT FK_lecture_participants_lecture_id FOREIGN KEY (lecture_id) REFERENCES lectures (id)"});
dbUpdates.add(new String[] { "ALTER TABLE roles ADD COLUMN user_selectable_role boolean DEFAULT false;" });
dbUpdates.add(new String[]{"ALTER TABLE roles ADD COLUMN user_selectable_role boolean DEFAULT false;"});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE group_memberships ADD COLUMN place_product INTEGER",
"ALTER TABLE group_memberships ADD CONSTRAINT FK_group_memberships_place_product FOREIGN KEY (place_product) REFERENCES products (id)"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE events ADD COLUMN ticket_sales_begin timestamp without time zone DEFAULT null;",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE events ADD COLUMN theme varchar(255) DEFAULT null;",
});
// Deprekoidaan ko. enum, jolloin se pitää myös poistaa tietokannasta
// tai saadaan poikkeuksia nyrkillä kurkusta .
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"DELETE FROM product_productflags where productflags = 'PREPAID_INSTANT_CREATE'"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE food_wave_templates ADD COLUMN wait_payments_minutes integer DEFAULT null;",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE maps ADD COLUMN width integer",
"ALTER TABLE maps ADD COLUMN height integer",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE place_slots (id SERIAL NOT NULL, CREATED TIMESTAMPTZ, DESCRIPTION TEXT, meta json, USED TIMESTAMPTZ, BILL_id INTEGER NOT NULL, PRODUCT_id INTEGER NOT NULL, PLACE_id INTEGER UNIQUE, PRIMARY KEY (id))",
"ALTER TABLE place_slots ADD CONSTRAINT FK_place_slots_BILL_id FOREIGN KEY (BILL_id) REFERENCES bills (id)",
"ALTER TABLE place_slots ADD CONSTRAINT FK_place_slots_PLACE_id FOREIGN KEY (PLACE_id) REFERENCES places (id)",
"ALTER TABLE place_slots ADD CONSTRAINT FK_place_slots_PRODUCT_id FOREIGN KEY (PRODUCT_id) REFERENCES products (id)"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE maps ADD COLUMN mime_type TEXT default 'image/png'",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE group_memberships ADD COLUMN entered_event_admin_id INTEGER",
"ALTER TABLE group_memberships ADD CONSTRAINT FK_group_memberships_entered_event_admin_id FOREIGN KEY (entered_event_admin_id) REFERENCES event_users (id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE group_memberships DROP COLUMN place_product",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"DELETE FROM product_limitations_roles where productlimitation_id in (SELECT id FROM product_limitations WHERE TYPE = 'PLACE')",
"DELETE FROM products_product_limitations where productlimits_id in (SELECT id FROM product_limitations WHERE TYPE = 'PLACE')",
"DELETE FROM product_limitations WHERE TYPE = 'PLACE'",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
new DDLBuilder().createTable("vips")
.serialPK("id")
.text("description", false)
......@@ -270,7 +270,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
.toString()
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE vip_product_deliveries (id SERIAL NOT NULL, DELIVERYTIME TIMESTAMPTZ NOT NULL, meta json, NOTES TEXT, quantity DECIMAL(24,4) NOT NULL, DELIVERER_id INTEGER NOT NULL, VIPPRODUCT_id INTEGER NOT NULL, PRIMARY KEY (id))",
"CREATE TABLE vip_products (id SERIAL NOT NULL, meta json, NAME TEXT, NOTES TEXT, quantity DECIMAL(24,4) NOT NULL, PRODUCT_id INTEGER, VIP_id INTEGER NOT NULL, PRIMARY KEY (id))",
"ALTER TABLE vip_product_deliveries ADD CONSTRAINT FK_vip_product_deliveries_DELIVERER_id FOREIGN KEY (DELIVERER_id) REFERENCES event_users (id)",
......@@ -280,24 +280,24 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE vips ADD shortdescr TEXT"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE products ADD shop_required_role INTEGER",
"ALTER TABLE products ADD CONSTRAINT FK_products_shop_required_role FOREIGN KEY (shop_required_role) REFERENCES roles (id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE org_roles ADD user_requestable BOOLEAN NOT NULL DEFAULT FALSE",
"ALTER TABLE org_roles ADD notes TEXT",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE org_role_requests (id INTEGER NOT NULL, handled_notes TEXT, meta json, request_date TIMESTAMPTZ NOT NULL, requeste_handled TIMESTAMPTZ, request_notes TEXT, handler_id INTEGER NOT NULL, requested_role INTEGER NOT NULL, user_id INTEGER NOT NULL, PRIMARY KEY (id))",
"ALTER TABLE org_role_requests ADD CONSTRAINT FK_org_role_requests_handler_id FOREIGN KEY (handler_id) REFERENCES users (id)",
"ALTER TABLE org_role_requests ADD CONSTRAINT FK_org_role_requests_requested_role FOREIGN KEY (requested_role) REFERENCES org_roles (id)",
"ALTER TABLE org_role_requests ADD CONSTRAINT FK_org_role_requests_user_id FOREIGN KEY (user_id) REFERENCES users (id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE events ADD codecrew_responsible_user_id INTEGER",
"ALTER TABLE events ADD CONSTRAINT FK_events_codecrew_responsible_users FOREIGN KEY (codecrew_responsible_user_id) REFERENCES users (id)",
"ALTER TABLE events ADD organiser_responsible_user_id INTEGER",
......@@ -305,12 +305,12 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE events ADD codecrew_notes TEXT",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"update events set end_time = '2010-01-01 00:00:00' where end_time is null"
});
// ... jepjep.. Lefu
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"DROP TABLE org_role_requests",
"CREATE TABLE org_role_requests (id SERIAL NOT NULL, handled_notes TEXT, meta json, request_date TIMESTAMPTZ NOT NULL, requeste_handled TIMESTAMPTZ, request_notes TEXT, handler_id INTEGER, requested_role INTEGER NOT NULL, user_id INTEGER NOT NULL, PRIMARY KEY (id))",
"ALTER TABLE org_role_requests ADD CONSTRAINT FK_org_role_requests_handler_id FOREIGN KEY (handler_id) REFERENCES users (id)",
......@@ -319,7 +319,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
});
// Run some profiling against local database. These were few of the low hanging fruits.
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
// User searching in admin view (seq scan to index scan)
"CREATE INDEX idx_eventuser_event ON event_users (event_id)",
// Menu subpage parent search.
......@@ -333,17 +333,17 @@ public class BootstrapBean implements BootstrapBeanLocal {
"CREATE INDEX idx_place_slots_products ON place_slots (product_id, place_id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE event_users ADD tokencode text"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE event_users ADD UNIQUE (tokencode)"
});
deleteMenu("/useradmin/changePassword");
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE helps (id SERIAL NOT NULL, path TEXT, meta json, PRIMARY KEY (id))",
"CREATE TABLE help_texts (id SERIAL NOT NULL, " +
......@@ -376,7 +376,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE help_texts DROP COLUMN users_id;",
"ALTER TABLE help_texts ADD COLUMN event_users_id INTEGER NOT NULL;",
"ALTER TABLE help_text_histories DROP COLUMN users_id;",
......@@ -391,23 +391,19 @@ public class BootstrapBean implements BootstrapBeanLocal {
});
dbUpdates.add(new String[] {
"ALTER TABLE help_texts DROP COLUMN title;"
});
// we do rename magic, so we do not lose reserve -information. We don't really care about this time maybe being 1hour offsync
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE places RENAME release_time TO reserve_time;"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE tournament_roles (role_id INTEGER NOT NULL, tournament_id INTEGER NOT NULL, PRIMARY KEY (role_id, tournament_id))",
"ALTER TABLE tournament_roles ADD CONSTRAINT FK_tournament_roles_tournament_id FOREIGN KEY (tournament_id) REFERENCES tournaments (id)",
"ALTER TABLE tournament_roles ADD CONSTRAINT FK_tournament_roles_role_id FOREIGN KEY (role_id) REFERENCES roles (id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE product_option_groups (id SERIAL NOT NULL, meta json, name TEXT, required BOOLEAN NOT NULL, default_product_option_id INTEGER, product_id INTEGER NOT NULL, PRIMARY KEY (id))",
"CREATE TABLE product_options (id SERIAL NOT NULL, meta json, name TEXT, priority INTEGER, price_change INTEGER, product_option_group_id INTEGER NOT NULL, PRIMARY KEY (id))",
"ALTER TABLE product_option_groups ADD CONSTRAINT FK_product_option_groups_default_product_option_id FOREIGN KEY (default_product_option_id) REFERENCES product_options (id)",
......@@ -417,21 +413,21 @@ public class BootstrapBean implements BootstrapBeanLocal {
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE products ADD COLUMN min_buy_count INTEGER default 0;"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE discounts ADD COLUMN sort INTEGER NOT NULL default 10;"
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"CREATE TABLE map_queue_rules (id SERIAL NOT NULL, meta json, reserving_size INTEGER, default_timeout_min INTEGER, minium_slots_in_queue INTEGER, map_id INTEGER NOT NULL , PRIMARY KEY (id))",
"ALTER TABLE map_queue_rules ADD CONSTRAINT FK_map_queue_rules_map_id FOREIGN KEY (map_id) REFERENCES maps (id)",
});
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"ALTER TABLE map_queue_rules ADD COLUMN biggest_first BOOLEAN default false",
});
......@@ -441,13 +437,18 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE product_dependencies ADD CONSTRAINT FK_product_dependencies_supporter_id FOREIGN KEY (supporter_id) REFERENCES products (id)",
});
dbUpdates.add(new String[]{
"ALTER TABLE account_events DROP COLUMN delivered_count;"
});
}
public BootstrapBean() {
}
private static void deleteMenu(String menupath) {
dbUpdates.add(new String[] {
dbUpdates.add(new String[]{
"delete from menu_navigation where item_id in (select id from menuitem where url in ( '" + menupath + "'))",
"delete from menuitem where url in ('" + menupath + "')",
});
......@@ -458,10 +459,8 @@ public class BootstrapBean implements BootstrapBeanLocal {
* <table>
* <statement>" for each of tables.
*
* @param alterStatement
* e.g. "ADD meta json"
* @param tables
* table name strings
* @param alterStatement e.g. "ADD meta json"
* @param tables table name strings
* @return1
*/
private static final String[] alterTables(String alterStatement, String... tables) {
......
......@@ -607,7 +607,7 @@ public class ProductBean implements ProductBeanLocal {
e = accounteventfacade.reload(e);
if (e.getDelivered() != null)
{
throw new EJBException("AccountEvent " + e + " already marked paid!");
throw new EJBException("AccountEvent " + e + " already marked delivered!");
}
e.setDelivered(c);
......
......@@ -74,9 +74,6 @@ public class AccountEvent extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP)
private Calendar delivered;
@Column(name = "delivered_count", nullable = false, precision = 24, scale = 4)
private BigDecimal deliveredCount = new BigDecimal(0);
/**
* If this AccountEvent is a product in foodwace, this field is a reference
* to that foodwave.
......@@ -239,14 +236,6 @@ public class AccountEvent extends GenericEntity {
this.description = description;
}
public BigDecimal getDeliveredCount() {
return deliveredCount;
}
public void setDeliveredCount(BigDecimal deliveredCount) {
this.deliveredCount = deliveredCount;
}
public boolean isEventDelivered() {
return (delivered != null);
}
......
......@@ -422,6 +422,10 @@ public class Product extends GenericEntity {
return getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT);
}
public boolean isDeliverableProduct() {
return !(isUsershopAutoproduct() || getProductFlags().contains(ProductFlag.PREPAID_CREDIT));
}
public Role getShopRequiredRole() {
return shopRequiredRole;
}
......
......@@ -320,6 +320,54 @@
<br />
<br />
<br />
<h:outputText rendered="#{empty incomingView.}" value="#{i18n['placegroupview.noMemberships']}" />
<h:form rendered="#{!empty incomingView.groupMemberships}" id="placelistform">
<p:fieldset legend="#{i18n['incomingflow.groupmemberships']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}">
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
<p:dataTable value="#{incomingView.groupMemberships}" var="member" rowStyleClass="#{member.enteredEvent != null ? 'success':''}">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.reservationName']}" />
</f:facet>
<h:outputText value="#{member.placeReservation.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.reservationProduct']}" />
</f:facet>
<h:outputText value="#{member.placeReservation.product.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.token']}" />
</f:facet>
<h:outputText rendered="#{empty member.user}" value="#{member.inviteToken}" />
<h:outputText rendered="#{!empty member.user}" value="#{member.user.firstnames} #{member.user.lastname} (#{member.user.nick})" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.groupCreator']}" />
</f:facet>
<h:outputText value="#{member.placeGroup.creator.firstnames} #{member.placeGroup.creator.lastname} (#{member.placeGroup.creator.nick})" />
</p:column>
<p:column>
<p:commandButton update=":placelistform" rendered="#{empty member.enteredEvent}" actionListener="#{incomingView.givePlace}" value="#{i18n['incomingflow.giveplace']}" />
<p:commandButton update=":placelistform" rendered="#{!empty member.enteredEvent}" actionListener="#{incomingView.ungivePlace}" value="#{i18n['incomingflow.ungiveplace']}" />
</p:column>
</p:dataTable>
</p:fieldset>
</h:form>
<br />
<br />
<br />
<h:form id="cardcodeform">
<p:fieldset legend="#{i18n['incomingflow.cardCodes']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}">
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
......
......@@ -19,12 +19,7 @@
package fi.codecrew.moya.web.cdiview.shop;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.*;
import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped;
......@@ -34,6 +29,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject;
import javax.inject.Named;
import fi.codecrew.moya.model.*;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -42,14 +38,6 @@ import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.enums.apps.ShopPermission;
import fi.codecrew.moya.model.Bill;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.LanEvent;
import fi.codecrew.moya.model.LanEventProperty;
import fi.codecrew.moya.model.LanEventPropertyKey;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ProductFlag;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.web.cdiview.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView;
import fi.codecrew.moya.web.cdiview.user.UserView;
......@@ -400,11 +388,15 @@ public class ProductShopView extends GenericCDIView {
for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) {
// retuser = productBean.createAccountEvent(shopitem.getProduct(), shopitem.getCount(), shopitem.getOverriddenUnitPrice(), userView.getSelectedUser()).getUser();
BigDecimal overriddenPrice = (shopitem.isOverrideUnitPrice()) ? shopitem.getOverriddenUnitPrice() : null;
retuser = productBean.createAccountEvent(shopitem.getProduct(), overriddenPrice, shopitem.getCount(), userView.getSelectedUser()).getUser();
AccountEvent ae = productBean.createAccountEvent(shopitem.getProduct(), overriddenPrice, shopitem.getCount(), userView.getSelectedUser());
// buying from shop means that product is delivered already
ae = productBean.markDelivered(ae, Calendar.getInstance());
retuser = ae.getUser();
}
}
......
......@@ -40,6 +40,7 @@ import javax.inject.Inject;
import javax.inject.Named;
import javax.json.JsonObject;
import java.util.ArrayList;
import java.util.List;
@Named
@ConversationScoped
......@@ -92,6 +93,7 @@ public class IncomingView extends GenericCDIView {
// private String searchBarcode = "";
private ListDataModel<GroupMembership> memberlist = null;
private ListDataModel<AccountEvent> deliverableAccountevents = null;
private ListDataModel<CardCode> cardCodes;
public void initView() {
......@@ -111,6 +113,7 @@ public class IncomingView extends GenericCDIView {
public void initPrintCardView() {
memberlist = null;
deliverableAccountevents = null;
if (!super.requirePermissions(UserPermission.MODIFY)) {
super.navihandler.redirectNavigation("index.jsf");
......@@ -216,6 +219,7 @@ public class IncomingView extends GenericCDIView {
EventUser user = event.getUser();
memberlist = null;
deliverableAccountevents = null;
if (user == null) {
logger.debug("got no user from barcode");
......@@ -282,6 +286,28 @@ public class IncomingView extends GenericCDIView {
return memberlist;
}
public ListDataModel<AccountEvent> getDeliverableAccountevents() {
List<AccountEvent> accountEvents = new ArrayList<>();
for(AccountEvent ae : userview.getSelectedUser().getAccountEvents()) {
if(!ae.getProduct().isDeliverableProduct()) {
continue;
}
// places are there already, so don't add them second time
if(ae.getProduct().getPlaces() != null && !ae.getProduct().getPlaces().isEmpty()) {
continue;
}
accountEvents.add(ae);
}
deliverableAccountevents = new ListDataModel<AccountEvent>(accountEvents);
return deliverableAccountevents;
}
public ListDataModel<CardCode> getCardCodes() {
if (userview.getPrintedCard() == null)
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!