Search in sources :

Example 1 with Organization

use of alfio.model.user.Organization in project alf.io by alfio-event.

the class ReservationController method sendReservationCompleteEmailToOrganizer.

private void sendReservationCompleteEmailToOrganizer(HttpServletRequest request, Event event, TicketReservation reservation) {
    Organization organization = organizationRepository.getById(event.getOrganizationId());
    List<String> cc = notificationManager.getCCForEventOrganizer(event);
    notificationManager.sendSimpleEmail(event, organization.getEmail(), cc, "Reservation complete " + reservation.getId(), () -> templateManager.renderTemplate(event, TemplateResource.CONFIRMATION_EMAIL_FOR_ORGANIZER, ticketReservationManager.prepareModelForReservationEmail(event, reservation), RequestContextUtils.getLocale(request)));
}
Also used : Organization(alfio.model.user.Organization)

Example 2 with Organization

use of alfio.model.user.Organization in project alf.io by alfio-event.

the class TicketController method preparePdfTicket.

private PartialTicketPDFGenerator preparePdfTicket(HttpServletRequest request, Event event, TicketReservation ticketReservation, Ticket ticket) throws WriterException, IOException {
    TicketCategory ticketCategory = ticketCategoryRepository.getByIdAndActive(ticket.getCategoryId(), event.getId());
    Organization organization = organizationRepository.getById(event.getOrganizationId());
    String reservationID = ticketReservationManager.getShortReservationID(event, ticketReservation.getId());
    return TemplateProcessor.buildPartialPDFTicket(LocaleUtil.getTicketLanguage(ticket, request), event, ticketReservation, ticketCategory, organization, templateManager, fileUploadManager, reservationID);
}
Also used : Organization(alfio.model.user.Organization) TicketCategory(alfio.model.TicketCategory)

Example 3 with Organization

use of alfio.model.user.Organization in project alf.io by alfio-event.

the class TicketController method internalSendTicketByEmail.

private Ticket internalSendTicketByEmail(HttpServletRequest request, Triple<Event, TicketReservation, Ticket> data) throws IOException {
    Ticket ticket = data.getRight();
    Event event = data.getLeft();
    Locale locale = LocaleUtil.getTicketLanguage(ticket, request);
    TicketReservation reservation = data.getMiddle();
    Organization organization = organizationRepository.getById(event.getOrganizationId());
    TicketCategory category = ticketCategoryRepository.getById(ticket.getCategoryId());
    notificationManager.sendTicketByEmail(ticket, event, locale, TemplateProcessor.buildPartialEmail(event, organization, reservation, category, templateManager, ticketReservationManager.ticketUpdateUrl(event, ticket.getUuid()), request), reservation, ticketCategoryRepository.getByIdAndActive(ticket.getCategoryId(), event.getId()));
    return ticket;
}
Also used : Locale(java.util.Locale) Ticket(alfio.model.Ticket) Organization(alfio.model.user.Organization) Event(alfio.model.Event) TicketCategory(alfio.model.TicketCategory) TicketReservation(alfio.model.TicketReservation)

Example 4 with Organization

use of alfio.model.user.Organization in project alf.io by alfio-event.

the class ConfigurationManagerIntegrationTest method prepareEnv.

@Before
public void prepareEnv() {
    // setup...
    organizationRepository.create("org", "org", "email@example.com");
    Organization organization = organizationRepository.findByName("org").get();
    userManager.insertUser(organization.getId(), USERNAME, "test", "test", "test@example.com", Role.OWNER, User.Type.INTERNAL);
    Map<String, String> desc = new HashMap<>();
    desc.put("en", "muh description");
    desc.put("it", "muh description");
    desc.put("de", "muh description");
    List<TicketCategoryModification> ticketsCategory = Collections.singletonList(new TicketCategoryModification(null, "default", 20, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), Collections.singletonMap("en", "desc"), BigDecimal.TEN, false, "", false, null, null, null, null, null));
    EventModification em = new EventModification(null, Event.EventType.INTERNAL, "url", "url", "url", null, null, "eventShortName", "displayName", organization.getId(), "muh location", "0.0", "0.0", ZoneId.systemDefault().getId(), desc, new DateTimeModification(LocalDate.now(), LocalTime.now()), new DateTimeModification(LocalDate.now(), LocalTime.now()), BigDecimal.TEN, "CHF", 20, BigDecimal.ONE, true, null, ticketsCategory, false, new LocationDescriptor("", "", "", ""), 7, null, null);
    eventManager.createEvent(em);
    event = eventManager.getSingleEvent("eventShortName", "test");
    ticketCategory = ticketCategoryRepository.findAllTicketCategories(event.getId()).get(0);
}
Also used : Organization(alfio.model.user.Organization) DateTimeModification(alfio.model.modification.DateTimeModification) LocationDescriptor(alfio.model.modification.support.LocationDescriptor) TicketCategoryModification(alfio.model.modification.TicketCategoryModification) EventModification(alfio.model.modification.EventModification) Before(org.junit.Before)

Example 5 with Organization

use of alfio.model.user.Organization in project alf.io by alfio-event.

the class ConfigurationManagerIntegrationTest method testOverrideMechanism.

@Test
public void testOverrideMechanism() {
    Organization organization = organizationRepository.findByName("org").get();
    Event event = eventManager.getSingleEvent("eventShortName", "test");
    TicketCategory tc = eventManager.loadTicketCategories(event).get(0);
    // 
    // check override level up to event level
    assertEquals(5, configurationManager.getIntConfigValue(Configuration.from(event.getOrganizationId(), event.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION), -1));
    configurationRepository.insertOrganizationLevel(organization.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION.getValue(), "6", "desc");
    assertEquals(6, configurationManager.getIntConfigValue(Configuration.from(event.getOrganizationId(), event.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION), -1));
    configurationRepository.insertEventLevel(organization.getId(), event.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION.getValue(), "7", "desc");
    assertEquals(7, configurationManager.getIntConfigValue(Configuration.from(event.getOrganizationId(), event.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION), -1));
    configurationRepository.insertTicketCategoryLevel(organization.getId(), event.getId(), tc.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION.getValue(), "8", "desc");
    assertEquals(7, configurationManager.getIntConfigValue(Configuration.from(event.getOrganizationId(), event.getId(), MAX_AMOUNT_OF_TICKETS_BY_RESERVATION), -1));
}
Also used : Organization(alfio.model.user.Organization) Event(alfio.model.Event) TicketCategory(alfio.model.TicketCategory) Test(org.junit.Test)

Aggregations

Organization (alfio.model.user.Organization)30 Event (alfio.model.Event)13 TicketCategory (alfio.model.TicketCategory)7 Ticket (alfio.model.Ticket)6 Triple (org.apache.commons.lang3.tuple.Triple)6 TicketReservation (alfio.model.TicketReservation)4 java.util (java.util)4 Collectors (java.util.stream.Collectors)4 Log4j2 (lombok.extern.log4j.Log4j2)4 Component (org.springframework.stereotype.Component)4 DateTimeModification (alfio.model.modification.DateTimeModification)3 LocationDescriptor (alfio.model.modification.support.LocationDescriptor)3 ZonedDateTime (java.time.ZonedDateTime)3 Collections.singletonList (java.util.Collections.singletonList)3 Transactional (org.springframework.transaction.annotation.Transactional)3 EventManager (alfio.manager.EventManager)2 NotificationManager (alfio.manager.NotificationManager)2 TicketReservationManager (alfio.manager.TicketReservationManager)2 Mailer (alfio.manager.system.Mailer)2 alfio.model (alfio.model)2