Commit 00dd00b6 by Tuomas Riihimäki

Merge branch 'deliverable-products' into 'master'

Deliverable products

See merge request !384
2 parents dbdee32e 622299db
...@@ -86,6 +86,10 @@ public interface ProductBeanLocal { ...@@ -86,6 +86,10 @@ public interface ProductBeanLocal {
AccountEvent markDelivered(AccountEvent e, Calendar c); AccountEvent markDelivered(AccountEvent e, Calendar c);
AccountEvent markUndelivered(AccountEvent e);
List<AccountEvent> getDeliverableAccountEvents(EventUser user );
List<Product> getPlaceProducts(); List<Product> getPlaceProducts();
ProductOption findOptionById(Integer id); ProductOption findOptionById(Integer id);
......
...@@ -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());
......
...@@ -45,22 +45,22 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -45,22 +45,22 @@ public class BootstrapBean implements BootstrapBeanLocal {
static { static {
// {"Query1","Query2",...} // {"Query1","Query2",...}
dbUpdates.add(new String[] { "" }); // first version, no changes 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 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 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 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[]{"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[]{"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 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 products ALTER COLUMN vat TYPE NUMERIC(4,3)"});
dbUpdates.add(new String[] { "ALTER TABLE actionlog_messages DROP COLUMN crew" }); 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[]{"delete from application_permissions where application ilike '%terminal%'"});
dbUpdates.add(new String[] { dbUpdates.add(new String[]{
"ALTER TABLE org_roles ADD ldap_role boolean not null default false", "ALTER TABLE org_roles ADD ldap_role boolean not null default false",
"ALTER TABLE org_roles ADD ldap_weight integer NOT NULL default 100" "ALTER TABLE org_roles ADD ldap_weight integer NOT NULL default 100"
}); });
// barcodefuckup // barcodefuckup
dbUpdates.add(new String[] { dbUpdates.add(new String[]{
"DROP TABLE card_barcode", "DROP TABLE card_barcode",
"ALTER TABLE printed_cards DROP COLUMN barcode;", "ALTER TABLE printed_cards DROP COLUMN barcode;",
"ALTER TABLE printed_cards DROP COLUMN rfid_uid;", "ALTER TABLE printed_cards DROP COLUMN rfid_uid;",
...@@ -72,11 +72,11 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -72,11 +72,11 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE reader_events ALTER COLUMN type DROP DEFAULT;", "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 menu_navigation where item_id in (select id from menuitem where url in ( '/actionlog/messagelist'))",
"delete 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" "alter table compos add hidden boolean default false not null"
}); });
...@@ -151,16 +151,16 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -151,16 +151,16 @@ public class BootstrapBean implements BootstrapBeanLocal {
"user_notes", "user_notes",
"users")); "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));" "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));" "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_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;" "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 { ...@@ -168,29 +168,29 @@ public class BootstrapBean implements BootstrapBeanLocal {
dbUpdates.add(alterTables("ADD COLUMN meta json", dbUpdates.add(alterTables("ADD COLUMN meta json",
"card_text_data", "card_text_data",
"card_object_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_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_g integer DEFAULT 0;",
"ALTER TABLE card_text_data ADD COLUMN font_color_b 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_text_data ALTER COLUMN size TYPE numeric(5,2);",
"ALTER TABLE card_object_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 DROP COLUMN font_style;",
"ALTER TABLE card_text_data ADD COLUMN font_style TEXT NOT NULL DEFAULT 'PLAIN';" "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;" "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);" "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 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_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))", "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 { ...@@ -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_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_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_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 COLUMN place_product INTEGER",
"ALTER TABLE group_memberships ADD CONSTRAINT FK_group_memberships_place_product FOREIGN KEY (place_product) REFERENCES products (id)" "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;", "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;", "ALTER TABLE events ADD COLUMN theme varchar(255) DEFAULT null;",
}); });
// Deprekoidaan ko. enum, jolloin se pitää myös poistaa tietokannasta // Deprekoidaan ko. enum, jolloin se pitää myös poistaa tietokannasta
// tai saadaan poikkeuksia nyrkillä kurkusta . // tai saadaan poikkeuksia nyrkillä kurkusta .
dbUpdates.add(new String[] { dbUpdates.add(new String[]{
"DELETE FROM product_productflags where productflags = 'PREPAID_INSTANT_CREATE'" "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;", "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 width integer",
"ALTER TABLE maps ADD COLUMN height 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))", "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_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_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)" "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'", "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 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)", "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", "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 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 products_product_limitations where productlimits_id in (SELECT id FROM product_limitations WHERE TYPE = 'PLACE')",
"DELETE 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") new DDLBuilder().createTable("vips")
.serialPK("id") .serialPK("id")
.text("description", false) .text("description", false)
...@@ -270,7 +270,7 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -270,7 +270,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
.toString() .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_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))", "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)", "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 { ...@@ -280,24 +280,24 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE vips ADD shortdescr TEXT" "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 shop_required_role INTEGER",
"ALTER TABLE products ADD CONSTRAINT FK_products_shop_required_role FOREIGN KEY (shop_required_role) REFERENCES roles (id)", "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 user_requestable BOOLEAN NOT NULL DEFAULT FALSE",
"ALTER TABLE org_roles ADD notes TEXT", "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))", "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_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_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)", "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 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 CONSTRAINT FK_events_codecrew_responsible_users FOREIGN KEY (codecrew_responsible_user_id) REFERENCES users (id)",
"ALTER TABLE events ADD organiser_responsible_user_id INTEGER", "ALTER TABLE events ADD organiser_responsible_user_id INTEGER",
...@@ -305,12 +305,12 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -305,12 +305,12 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE events ADD codecrew_notes TEXT", "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" "update events set end_time = '2010-01-01 00:00:00' where end_time is null"
}); });
// ... jepjep.. Lefu // ... jepjep.. Lefu
dbUpdates.add(new String[] { dbUpdates.add(new String[]{
"DROP TABLE org_role_requests", "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))", "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)", "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 { ...@@ -319,7 +319,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
}); });
// Run some profiling against local database. These were few of the low hanging fruits. // 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) // User searching in admin view (seq scan to index scan)
"CREATE INDEX idx_eventuser_event ON event_users (event_id)", "CREATE INDEX idx_eventuser_event ON event_users (event_id)",
// Menu subpage parent search. // Menu subpage parent search.
...@@ -333,17 +333,17 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -333,17 +333,17 @@ public class BootstrapBean implements BootstrapBeanLocal {
"CREATE INDEX idx_place_slots_products ON place_slots (product_id, place_id)", "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" "ALTER TABLE event_users ADD tokencode text"
}); });
dbUpdates.add(new String[] { dbUpdates.add(new String[]{
"ALTER TABLE event_users ADD UNIQUE (tokencode)" "ALTER TABLE event_users ADD UNIQUE (tokencode)"
}); });
deleteMenu("/useradmin/changePassword"); 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 helps (id SERIAL NOT NULL, path TEXT, meta json, PRIMARY KEY (id))",
"CREATE TABLE help_texts (id SERIAL NOT NULL, " + "CREATE TABLE help_texts (id SERIAL NOT NULL, " +
...@@ -376,7 +376,7 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -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 DROP COLUMN users_id;",
"ALTER TABLE help_texts ADD COLUMN event_users_id INTEGER NOT NULL;", "ALTER TABLE help_texts ADD COLUMN event_users_id INTEGER NOT NULL;",
"ALTER TABLE help_text_histories DROP COLUMN users_id;", "ALTER TABLE help_text_histories DROP COLUMN users_id;",
...@@ -391,23 +391,19 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -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 // 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;" "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))", "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_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)", "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_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))", "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)", "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 { ...@@ -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;" "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;" "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))", "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)", "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", "ALTER TABLE map_queue_rules ADD COLUMN biggest_first BOOLEAN default false",
}); });
...@@ -441,13 +437,18 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -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)", "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() { public BootstrapBean() {
} }
private static void deleteMenu(String menupath) { 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 menu_navigation where item_id in (select id from menuitem where url in ( '" + menupath + "'))",
"delete from menuitem where url in ('" + menupath + "')", "delete from menuitem where url in ('" + menupath + "')",
}); });
...@@ -458,10 +459,8 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -458,10 +459,8 @@ public class BootstrapBean implements BootstrapBeanLocal {
* <table> * <table>
* <statement>" for each of tables. * <statement>" for each of tables.
* *
* @param alterStatement * @param alterStatement e.g. "ADD meta json"
* e.g. "ADD meta json" * @param tables table name strings
* @param tables
* table name strings
* @return1 * @return1
*/ */
private static final String[] alterTables(String alterStatement, String... tables) { private static final String[] alterTables(String alterStatement, String... tables) {
...@@ -489,7 +488,7 @@ public class BootstrapBean implements BootstrapBeanLocal { ...@@ -489,7 +488,7 @@ public class BootstrapBean implements BootstrapBeanLocal {
this.executeUpdates(revId, upIdx); this.executeUpdates(revId, upIdx);
} else if (upIdx < revId) { } else if (upIdx < revId) {
throw new RuntimeException("Sanity check failed! DB is newer than the codebase!"); throw new RuntimeException("Sanity check failed! DB is newer than the codebase!, should be: "+ revId);
} }
} else { } else {
// DB is up to date by default! We need to mark the current version // DB is up to date by default! We need to mark the current version
......
...@@ -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;
} }
...@@ -547,73 +547,54 @@ public class ProductBean implements ProductBeanLocal { ...@@ -547,73 +547,54 @@ public class ProductBean implements ProductBeanLocal {
return accounteventfacade.findProvidedRoles(eventBean.getCurrentEvent(), u); return accounteventfacade.findProvidedRoles(eventBean.getCurrentEvent(), u);
} }
// /**
// * Create accountevents for the products in the parameter shopMap @Override
// */ public List<AccountEvent> getDeliverableAccountEvents(EventUser user ) {
// @Override
// @RolesAllowed(ShopPermission.S_SHOP_PRODUCTS) List<AccountEvent> retlist = new ArrayList<>();
// public void shopCash(EventUser shoppingUser, Map<Product, BigDecimal> for(AccountEvent ae : accounteventfacade.getAccountEvents(user)) {
// shopMap, boolean buyInstant) { if(!ae.getProduct().isDeliverableProduct()) {
// logger.debug("Shoping cash. buyinstant {}", buyInstant); continue;
// EventUser seller = permbean.getCurrentUser(); }
// shoppingUser = userbean.findByEventUserId(shoppingUser.getId());
// // places are there already, so don't add them second time
// BigDecimal tot = BigDecimal.ZERO; if(ae.getProduct().getPlaces() != null && !ae.getProduct().getPlaces().isEmpty()) {
// continue;
// for (Entry<Product, BigDecimal> prodentry : shopMap.entrySet()) { }
//
// // Create account event for the product. // foods are handled from different view, remove them from here
// AccountEvent ac = new AccountEvent(shoppingUser, prodentry.getKey(), if(ae.getProduct().getFoodWaveTemplates() != null && !ae.getProduct().getFoodWaveTemplates().isEmpty()) {
// prodentry.getKey().getPrice(), prodentry.getValue(), continue;
// Calendar.getInstance()); }
// ac.setSeller(seller);
// accounteventfacade.create(ac); retlist.add(ae);
// }
// if (buyInstant &&
// prodentry.getKey().getPrice().compareTo(BigDecimal.ZERO) > 0) { return retlist;
// tot = }
// tot.add(prodentry.getValue().multiply(prodentry.getKey().getPrice()));
// }
//
// if
// (prodentry.getKey().getProductFlags().contains(ProductFlag.RESERVE_PLACE_WHEN_BOUGHT)
// ||
// prodentry.getKey().getProductFlags().contains(ProductFlag.CREATE_NEW_PLACE_WHEN_BOUGHT))
// {
// logger.debug("Prepaidplace");
//
// placebean.lockPlaceProduct(shoppingUser, prodentry.getKey(),
// BigDecimal.ONE);
//
// }
//
// }
//
// logger.debug("ShopCash price {}", tot);
// if (buyInstant && tot.compareTo(BigDecimal.ZERO) > 0) {
// logger.debug("Creating buy instant product!");
// Product creditProd = findCreditProduct();
// AccountEvent ac = new AccountEvent(shoppingUser, creditProd,
// creditProd.getPrice(), tot, Calendar.getInstance());
// accounteventfacade.create(ac);
// }
//
// userbean.mergeEventUserChanges(shoppingUser);
//
// }
@Override @Override
public AccountEvent markDelivered(AccountEvent e, Calendar c) { public AccountEvent markDelivered(AccountEvent e, Calendar c) {
e = accounteventfacade.reload(e); e = accounteventfacade.reload(e);
if (e.getDelivered() != null) if (e.getDelivered() != null)
{ {
throw new EJBException("AccountEvent " + e + " already marked paid!"); throw new EJBException("AccountEvent " + e + " already marked delivered!");
} }
e.setDelivered(c); e.setDelivered(c);
return e; return e;
} }
@Override
public AccountEvent markUndelivered(AccountEvent e) {
e = accounteventfacade.reload(e);
e.setDelivered(null);
return e;
}
@Override @Override
public List<Product> getPlaceProducts() { public List<Product> getPlaceProducts() {
......
...@@ -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);
......
...@@ -74,9 +74,6 @@ public class AccountEvent extends GenericEntity { ...@@ -74,9 +74,6 @@ public class AccountEvent extends GenericEntity {
@Temporal(TemporalType.TIMESTAMP) @Temporal(TemporalType.TIMESTAMP)
private Calendar delivered; 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 * If this AccountEvent is a product in foodwace, this field is a reference
* to that foodwave. * to that foodwave.
...@@ -239,14 +236,6 @@ public class AccountEvent extends GenericEntity { ...@@ -239,14 +236,6 @@ public class AccountEvent extends GenericEntity {
this.description = description; this.description = description;
} }
public BigDecimal getDeliveredCount() {
return deliveredCount;
}
public void setDeliveredCount(BigDecimal deliveredCount) {
this.deliveredCount = deliveredCount;
}
public boolean isEventDelivered() { public boolean isEventDelivered() {
return (delivered != null); return (delivered != null);
} }
......
...@@ -422,6 +422,10 @@ public class Product extends GenericEntity { ...@@ -422,6 +422,10 @@ public class Product extends GenericEntity {
return getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT); return getProductFlags().contains(ProductFlag.USERSHOP_AUTOPRODUCT);
} }
public boolean isDeliverableProduct() {
return !(isUsershopAutoproduct() || getProductFlags().contains(ProductFlag.PREPAID_CREDIT));
}
public Role getShopRequiredRole() { public Role getShopRequiredRole() {
return shopRequiredRole; return shopRequiredRole;
} }
......
...@@ -57,9 +57,19 @@ ...@@ -57,9 +57,19 @@
</p:dataTable> </p:dataTable>
</p:fieldset> </p:fieldset>
<br /><br /><br /> <br /><br />
<p:commandButton value="#{i18n['incomingflow.markEverythingGiven']}" update="membershipForm" disabled="#{cardlessIncomingView.allGiven}" actionListener="#{cardlessIncomingView.giveEverything}" />
<br /><br /><br /> <br />
<p:commandButton value="#{i18n['incomingflow.markEverythingGiven']}" update="membershipForm accounteventlistform" disabled="#{cardlessIncomingView.allGiven}" actionListener="#{cardlessIncomingView.giveEverything}" />
<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}" />
...@@ -101,6 +111,40 @@ ...@@ -101,6 +111,40 @@
</p:fieldset> </p:fieldset>
</h:form> </h:form>
<br /><br /><br />
<h:form id="accounteventlistform">
<p:fieldset legend="#{i18n['incomingflow.deliverableProducts']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}" >
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
<p:dataTable value="#{cardlessIncomingView.deliverableAccountevents}" var="prod" rowStyleClass="#{prod.delivered != null ? 'greenBackground':''}">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.productName']}" />
</f:facet>
<h:outputText value="#{prod.product.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.accountEventDescription']}" />
</f:facet>
<h:outputText value="#{prod.description}" />
</p:column>
<p:column>
<p:commandButton update=":accounteventlistform :membershipForm:ungivenFragment" rendered="#{empty prod.delivered}" actionListener="#{cardlessIncomingView.giveAccountEvent}" value="#{i18n['incomingflow.giveAccountEvent']}" />
<p:commandButton update=":accounteventlistform :membershipForm:ungivenFragment" rendered="#{!empty prod.delivered}" actionListener="#{cardlessIncomingView.ungiveAccountEvent}" value="#{i18n['incomingflow.ungiveAccountEvent']}" />
</p:column>
</p:dataTable>
</p:fieldset>
</h:form>
<br />
<br />
<br />
</ui:define> </ui:define>
......
...@@ -30,7 +30,7 @@ ...@@ -30,7 +30,7 @@
<h1>#{i18n['incomingView.attachDialogTitle']}</h1> <h1>#{i18n['incomingView.attachDialogTitle']}</h1>
<!-- napin painaminen aiheuttaa aina NullPOinterExceptionin, mutta tekee siitä huolimatta tarvittavat asiat --> <!-- napin painaminen aiheuttaa aina NullPOinterExceptionin, mutta tekee siitä huolimatta tarvittavat asiat -->
<!-- tarjoan oluen sille ketä ratkasee ton exceptionin -TKjne --> <!-- tarjoan oluen sille ketä ratkasee ton exceptionin -TKjne -->
<p:commandButton styleClass="attachbuttonidclass" value="#{i18n['incomingView.attach']}" actionListener="#{incomingView.attachCodeToCard}" update=":cardcodeform :placelistform :imgCropperForm :cardsetform:" onerror="location.reload(true);" /> <p:commandButton styleClass="attachbuttonidclass" value="#{i18n['incomingView.attach']}" actionListener="#{incomingView.attachCodeToCard}" update=":cardcodeform :placelistform :accounteventlistform :imgCropperForm :cardsetform:" onerror="location.reload(true);" />
<p:commandButton value="#{i18n['incomingView.cancel']}" actionListener="#{incomingView.hideAttachDialog}" update=":attachform:attachBarcode" /> <p:commandButton value="#{i18n['incomingView.cancel']}" actionListener="#{incomingView.hideAttachDialog}" update=":attachform:attachBarcode" />
</div> </div>
</h:panelGroup> </h:panelGroup>
...@@ -275,13 +275,14 @@ ...@@ -275,13 +275,14 @@
</h:form> </h:form>
<br /><br /> <br /><br />
<h:outputText rendered="#{empty incomingView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" /> <h:outputText rendered="#{empty incomingView.groupMemberships}" value="#{i18n['placegroupview.noMemberships']}" />
<h:form rendered="#{!empty incomingView.groupMemberships}" id="placelistform"> <h:form rendered="#{!empty incomingView.groupMemberships}" id="placelistform">
<p:fieldset legend="#{i18n['incomingflow.groupmemberships']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}"> <p:fieldset 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}" />
<p:dataTable value="#{incomingView.groupMemberships}" var="member" rowStyleClass="#{member.enteredEvent != null ? 'success':''}"> <p:dataTable value="#{incomingView.groupMemberships}" var="member" rowStyleClass="#{member.enteredEvent != null ? 'greenBackground':''}">
<p:column> <p:column>
<f:facet name="header"> <f:facet name="header">
...@@ -320,6 +321,45 @@ ...@@ -320,6 +321,45 @@
<br /> <br />
<br /> <br />
<br /> <br />
<h:outputText rendered="#{empty incomingView.deliverableAccountevents}" value="#{i18n['placegroupview.noProductsToDeliver']}" />
<h:form rendered="#{!empty incomingView.deliverableAccountevents}" id="accounteventlistform">
<p:fieldset legend="#{i18n['incomingflow.deliverableProducts']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}" id="accountEventList">
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
<p:dataTable value="#{incomingView.deliverableAccountevents}" var="prod" rowStyleClass="#{prod.delivered != null ? 'greenBackground':''}">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.productName']}" />
</f:facet>
<h:outputText value="#{prod.product.name}" />
</p:column>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['placegroupview.accountEventDescription']}" />
</f:facet>
<h:outputText value="#{prod.description}" />
</p:column>
<p:column>
<p:commandButton update=":accounteventlistform" rendered="#{empty prod.delivered}" actionListener="#{incomingView.giveAccountEvent}" value="#{i18n['incomingflow.giveAccountEvent']}" />
<p:commandButton update=":accounteventlistform" rendered="#{!empty prod.delivered}" actionListener="#{incomingView.ungiveAccountEvent}" value="#{i18n['incomingflow.ungiveAccountEvent']}" />
</p:column>
</p:dataTable>
</p:fieldset>
</h:form>
<br />
<br />
<br />
<h:form id="cardcodeform"> <h:form id="cardcodeform">
<p:fieldset legend="#{i18n['incomingflow.cardCodes']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}"> <p:fieldset legend="#{i18n['incomingflow.cardCodes']}" toggleable="true" collapsed="#{fieldsetView.isCollapsed(component.id)}">
<p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" /> <p:ajax event="toggle" listener="#{fieldsetView.handleToggle}" />
......
...@@ -19,7 +19,6 @@ import javax.ws.rs.core.Response; ...@@ -19,7 +19,6 @@ import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder; import javax.ws.rs.core.Response.ResponseBuilder;
import fi.codecrew.moya.rest.ArrayListWrapper; import fi.codecrew.moya.rest.ArrayListWrapper;
import fi.codecrew.moya.rest.SimpleCodelistRoot;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -281,7 +280,6 @@ public class PlacemapRestViewV1 { ...@@ -281,7 +280,6 @@ public class PlacemapRestViewV1 {
ArrayList<PlaceCodePojo> ret = makePlaceCodePojos(map.getPlaces()); ArrayList<PlaceCodePojo> ret = makePlaceCodePojos(map.getPlaces());
return Response.ok(new ArrayListWrapper<>(ret)).build(); return Response.ok(new ArrayListWrapper<>(ret)).build();
} }
private ArrayList<PlaceCodePojo> makePlaceCodePojos(List<Place> places) { private ArrayList<PlaceCodePojo> makePlaceCodePojos(List<Place> places) {
......
/*
* Copyright Codecrew Ry
*
* All rights reserved.
*
* This license applies to any software containing a notice placed by the
* copyright holder. Such software is herein referred to as the Software.
* This license covers modification, distribution and use of the Software.
*
* Any distribution and use in source and binary forms, with or without
* modification is not permitted without explicit written permission from the
* copyright owner.
*
* A non-exclusive royalty-free right is granted to the copyright owner of the
* Software to use, modify and distribute all modifications to the Software in
* future versions of the Software.
*
*/
package fi.codecrew.moya.servlet;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import javax.ejb.EJB;
import javax.servlet.Servlet;
import javax.servlet.ServletConfig;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.sshd.SshServer;
import org.apache.sshd.common.Factory;
import org.apache.sshd.server.Command;
import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.clientutils.BortalLocalContextHolder;
import fi.codecrew.moya.cmdline.Hello;
import fi.codecrew.moya.model.LanEvent;
/**
* Servlet implementation class SshServlet
*/
@WebServlet(urlPatterns = "/ssh", loadOnStartup = 10)
public class SshServlet extends HttpServlet {
private static final long serialVersionUID = 1L;
private static final Logger logger = LoggerFactory.getLogger(SshServlet.class);
private Map<Integer, SshServer> servers = new HashMap<Integer, SshServer>();
// Timeout 30 min
private static final String TIMEOUT = Integer.toString(1000 * 60 * 30);
@EJB
private EventBeanLocal eventbean;
@EJB
private PermissionBeanLocal permBean;
/**
* @see HttpServlet#HttpServlet()
*/
public SshServlet() {
super();
// TODO Auto-generated constructor stub
}
private class SshShellFactor implements Factory<Command> {
private BortalLocalContextHolder context;
public SshShellFactor(BortalLocalContextHolder instance) {
context = instance;
}
@Override
public Command create() {
logger.info("creating new bortal command");
BortalCommand bc = new BortalCommand(context);
bc
.addCommandlineCommand("hello", new Hello(permBean))
.addCommandlineCommand("hallo", new Hello(permBean));
return bc;
}
}
/**
* @see Servlet#init(ServletConfig)
*/
public void init(ServletConfig config) throws ServletException {
}
private SshServer initSsh(Integer id) {
logger.info("Initializing ssh servlet");
SshServer sshd = SshServer.setUpDefaultServer();
sshd.setPort(8022);
sshd.getProperties().put(SshServer.IDLE_TIMEOUT, TIMEOUT);
sshd.setShellFactory(new SshShellFactor(BortalLocalContextHolder.getInstance()));
BortalPasswordAuthenticator pswdAuth = new BortalPasswordAuthenticator(BortalLocalContextHolder.getInstance());
sshd.setPasswordAuthenticator(pswdAuth);
sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider("hostkey.ser"));
try {
sshd.start();
return sshd;
} catch (IOException e) {
logger.warn("sshd start failed! ", e);
}
return null;
}
/**
* @see Servlet#destroy()
*/
public void destroy() {
logger.info("Destroying ssh servlet");
for (Entry<Integer, SshServer> entry : servers.entrySet())
{
try {
entry.getValue().stop();
} catch (InterruptedException e) {
logger.warn("Error stopping ssh", e);
}
}
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
LanEvent event = eventbean.getCurrentEvent();
if (!servers.containsKey(event.getId())) {
SshServer ssh = initSsh(event.getId());
if (ssh != null) {
servers.put(event.getId(), ssh);
}
}
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse
* response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
}
}
...@@ -19,12 +19,7 @@ ...@@ -19,12 +19,7 @@
package fi.codecrew.moya.web.cdiview.shop; package fi.codecrew.moya.web.cdiview.shop;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.ArrayList; import java.util.*;
import java.util.Date;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.ejb.EJB; import javax.ejb.EJB;
import javax.enterprise.context.ConversationScoped; import javax.enterprise.context.ConversationScoped;
...@@ -34,6 +29,7 @@ import javax.faces.model.ListDataModel; ...@@ -34,6 +29,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import fi.codecrew.moya.model.*;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
...@@ -42,14 +38,6 @@ import fi.codecrew.moya.beans.EventBeanLocal; ...@@ -42,14 +38,6 @@ import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.ProductBeanLocal; import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal; import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.enums.apps.ShopPermission; 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.GenericCDIView;
import fi.codecrew.moya.web.cdiview.reader.ReaderView; import fi.codecrew.moya.web.cdiview.reader.ReaderView;
import fi.codecrew.moya.web.cdiview.user.UserView; import fi.codecrew.moya.web.cdiview.user.UserView;
...@@ -400,11 +388,15 @@ public class ProductShopView extends GenericCDIView { ...@@ -400,11 +388,15 @@ public class ProductShopView extends GenericCDIView {
for (ProductShopItem shopitem : shoppingcart) { for (ProductShopItem shopitem : shoppingcart) {
if (shopitem.getCount().compareTo(BigDecimal.ZERO) > 0) { 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; 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();
} }
} }
......
...@@ -23,10 +23,7 @@ import fi.codecrew.moya.beans.PlaceGroupBeanLocal; ...@@ -23,10 +23,7 @@ import fi.codecrew.moya.beans.PlaceGroupBeanLocal;
import fi.codecrew.moya.beans.ProductBeanLocal; import fi.codecrew.moya.beans.ProductBeanLocal;
import fi.codecrew.moya.beans.TicketBeanLocal; import fi.codecrew.moya.beans.TicketBeanLocal;
import fi.codecrew.moya.enums.apps.UserPermission; import fi.codecrew.moya.enums.apps.UserPermission;
import fi.codecrew.moya.model.EventUser; import fi.codecrew.moya.model.*;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.Product;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.utilities.I18n; import fi.codecrew.moya.utilities.I18n;
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;
...@@ -44,6 +41,7 @@ import javax.faces.model.ListDataModel; ...@@ -44,6 +41,7 @@ import javax.faces.model.ListDataModel;
import javax.inject.Inject; import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List; import java.util.List;
@Named @Named
...@@ -79,6 +77,8 @@ public class CardlessIncomingView extends GenericCDIView { ...@@ -79,6 +77,8 @@ public class CardlessIncomingView extends GenericCDIView {
private ListDataModel<GroupMembership> memberlist = null; private ListDataModel<GroupMembership> memberlist = null;
private ListDataModel<AccountEvent> deliverableAccountevents = null;
public void initView() { public void initView() {
if (super.requirePermissions(UserPermission.MODIFY)) { if (super.requirePermissions(UserPermission.MODIFY)) {
...@@ -182,11 +182,61 @@ public class CardlessIncomingView extends GenericCDIView { ...@@ -182,11 +182,61 @@ public class CardlessIncomingView extends GenericCDIView {
addFaceMessage("incomingflow.allGiven",count); addFaceMessage("incomingflow.allGiven",count);
memberlist = null; memberlist = null;
deliverableAccountevents = null;
} }
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;
} }
public ListDataModel<AccountEvent> getDeliverableAccountevents() {
deliverableAccountevents = new ListDataModel<>(productBean.getDeliverableAccountEvents(userview.getSelectedUser()));
return deliverableAccountevents;
}
public String giveAccountEvent() {
AccountEvent row = deliverableAccountevents.getRowData();
if (row != null) {
try {
productBean.markDelivered(row, Calendar.getInstance());
} catch (RuntimeException x) { }
deliverableAccountevents = null;
}
return null;
}
public String ungiveAccountEvent() {
AccountEvent row = deliverableAccountevents.getRowData();
if (row != null) {
productBean.markUndelivered(row);
deliverableAccountevents = null;
}
return null;
}
} }
...@@ -40,6 +40,8 @@ import javax.inject.Inject; ...@@ -40,6 +40,8 @@ import javax.inject.Inject;
import javax.inject.Named; import javax.inject.Named;
import javax.json.JsonObject; import javax.json.JsonObject;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@Named @Named
@ConversationScoped @ConversationScoped
...@@ -84,6 +86,9 @@ public class IncomingView extends GenericCDIView { ...@@ -84,6 +86,9 @@ public class IncomingView extends GenericCDIView {
private PlaceGroupBeanLocal placegroupBean; private PlaceGroupBeanLocal placegroupBean;
@EJB @EJB
private ProductBeanLocal productBean;
@EJB
private CardTemplateBeanLocal cardTemplateBean; private CardTemplateBeanLocal cardTemplateBean;
@EJB @EJB
...@@ -92,6 +97,7 @@ public class IncomingView extends GenericCDIView { ...@@ -92,6 +97,7 @@ public class IncomingView extends GenericCDIView {
// private String searchBarcode = ""; // private String searchBarcode = "";
private ListDataModel<GroupMembership> memberlist = null; private ListDataModel<GroupMembership> memberlist = null;
private ListDataModel<AccountEvent> deliverableAccountevents = null;
private ListDataModel<CardCode> cardCodes; private ListDataModel<CardCode> cardCodes;
public void initView() { public void initView() {
...@@ -111,6 +117,7 @@ public class IncomingView extends GenericCDIView { ...@@ -111,6 +117,7 @@ public class IncomingView extends GenericCDIView {
public void initPrintCardView() { public void initPrintCardView() {
memberlist = null; memberlist = null;
deliverableAccountevents = null;
if (!super.requirePermissions(UserPermission.MODIFY)) { if (!super.requirePermissions(UserPermission.MODIFY)) {
super.navihandler.redirectNavigation("index.jsf"); super.navihandler.redirectNavigation("index.jsf");
...@@ -216,6 +223,7 @@ public class IncomingView extends GenericCDIView { ...@@ -216,6 +223,7 @@ public class IncomingView extends GenericCDIView {
EventUser user = event.getUser(); EventUser user = event.getUser();
memberlist = null; memberlist = null;
deliverableAccountevents = null;
if (user == null) { if (user == null) {
logger.debug("got no user from barcode"); logger.debug("got no user from barcode");
...@@ -282,6 +290,33 @@ public class IncomingView extends GenericCDIView { ...@@ -282,6 +290,33 @@ public class IncomingView extends GenericCDIView {
return memberlist; return memberlist;
} }
public ListDataModel<AccountEvent> getDeliverableAccountevents() {
deliverableAccountevents = new ListDataModel<>(productBean.getDeliverableAccountEvents(userview.getSelectedUser()));
return deliverableAccountevents;
}
public String giveAccountEvent() {
AccountEvent row = deliverableAccountevents.getRowData();
if (row != null) {
try {
productBean.markDelivered(row, Calendar.getInstance());
} catch (RuntimeException x) { }
deliverableAccountevents = null;
}
return null;
}
public String ungiveAccountEvent() {
AccountEvent row = deliverableAccountevents.getRowData();
if (row != null) {
productBean.markUndelivered(row);
deliverableAccountevents = null;
}
return null;
}
public ListDataModel<CardCode> getCardCodes() { public ListDataModel<CardCode> getCardCodes() {
if (userview.getPrintedCard() == null) if (userview.getPrintedCard() == null)
......
...@@ -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
...@@ -1613,3 +1613,10 @@ bortalApplication.map.MOVE_PLACES =Selfservice place moving ...@@ -1613,3 +1613,10 @@ bortalApplication.map.MOVE_PLACES =Selfservice place moving
bill.list.header =Orders bill.list.header =Orders
placemove.noMovablePlaces =No movable places placemove.noMovablePlaces =No movable places
deliver=Toimita deliver=Toimita
placegroupview.noProductsToDeliver=No deliverable products
placegroupview.productName=Product name
incomingflow.giveAccountEvent=Mark given
incomingflow.ungiveAccountEvent=Mark not given
incomingflow.deliverableProducts=Products to deliver
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
...@@ -1894,3 +1894,10 @@ bortalApplication.map.MOVE_PLACES = Selfservice place moving ...@@ -1894,3 +1894,10 @@ bortalApplication.map.MOVE_PLACES = Selfservice place moving
bill.list.header = Orders bill.list.header = Orders
placemove.noMovablePlaces = No movable places placemove.noMovablePlaces = No movable places
deliver=Deliver deliver=Deliver
placegroupview.noProductsToDeliver=No deliverable products
placegroupview.productName=Product name
incomingflow.giveAccountEvent=Mark given
incomingflow.ungiveAccountEvent=Mark not given
incomingflow.deliverableProducts=Products to deliver
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
...@@ -1881,3 +1881,10 @@ bortalApplication.map.MOVE_PLACES = Paikkojen ...@@ -1881,3 +1881,10 @@ bortalApplication.map.MOVE_PLACES = Paikkojen
bill.list.header = Tilaukset bill.list.header = Tilaukset
placemove.noMovablePlaces = Ei siirrett\u00E4vi\u00E4 paikkoja placemove.noMovablePlaces = Ei siirrett\u00E4vi\u00E4 paikkoja
deliver=Toimita deliver=Toimita
placegroupview.noProductsToDeliver=Ei toimitettavia tuotteita
placegroupview.productName=Tuotteen nimi
incomingflow.giveAccountEvent=Merkitse annetuksi
incomingflow.ungiveAccountEvent=Ei olekkaan annettu
incomingflow.deliverableProducts=Toimitettavat tuotteet
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!