use of com.axelor.apps.crm.db.Event in project axelor-open-suite by axelor.
the class EventController method computeFromDuration.
public void computeFromDuration(ActionRequest request, ActionResponse response) {
Event event = request.getContext().asType(Event.class);
LOG.debug("event : {}", event);
if (event.getDuration() != null) {
if (event.getStartDateTime() != null) {
response.setValue("endDateTime", DateTool.plusSeconds(event.getStartDateTime(), event.getDuration()));
} else if (event.getEndDateTime() != null) {
response.setValue("startDateTime", DateTool.minusSeconds(event.getEndDateTime(), event.getDuration()));
}
}
}
use of com.axelor.apps.crm.db.Event in project axelor-open-suite by axelor.
the class EventController method saveEventTaskStatusSelect.
public void saveEventTaskStatusSelect(ActionRequest request, ActionResponse response) throws AxelorException {
Event event = request.getContext().asType(Event.class);
Event persistEvent = Beans.get(EventRepository.class).find(event.getId());
persistEvent.setStatusSelect(event.getStatusSelect());
Beans.get(EventService.class).saveEvent(persistEvent);
}
use of com.axelor.apps.crm.db.Event in project axelor-open-suite by axelor.
the class EventController method generateRecurrentEvents.
@Transactional(rollbackOn = { Exception.class })
public void generateRecurrentEvents(ActionRequest request, ActionResponse response) throws AxelorException {
try {
Long eventId = (Long) request.getContext().get("id");
if (eventId == null)
throw new AxelorException(Event.class, TraceBackRepository.CATEGORY_INCONSISTENCY, I18n.get(IExceptionMessage.EVENT_SAVED));
Event event = Beans.get(EventRepository.class).find(eventId);
RecurrenceConfigurationRepository confRepo = Beans.get(RecurrenceConfigurationRepository.class);
RecurrenceConfiguration conf = event.getRecurrenceConfiguration();
if (conf != null) {
conf = confRepo.save(conf);
Beans.get(EventService.class).generateRecurrentEvents(event, conf);
}
} catch (Exception e) {
TraceBackService.trace(response, e);
}
}
use of com.axelor.apps.crm.db.Event in project axelor-open-suite by axelor.
the class TrainingRegisterController method EventFromDateUpdate.
@Transactional
public void EventFromDateUpdate(ActionRequest request, ActionResponse response) {
TrainingRegister trainingRegister = request.getContext().asType(TrainingRegister.class);
if (trainingRegister.getEventList() != null) {
for (Event event : trainingRegister.getEventList()) {
event.setStartDateTime(trainingRegister.getFromDate());
eventRepository.save(event);
}
}
}
use of com.axelor.apps.crm.db.Event in project axelor-open-suite by axelor.
the class TrainingRegisterController method massTrainingRegisterCreation.
@SuppressWarnings("unchecked")
public void massTrainingRegisterCreation(ActionRequest request, ActionResponse response) {
Context context = request.getContext();
ArrayList<LinkedHashMap<String, Object>> employeeList = (ArrayList<LinkedHashMap<String, Object>>) context.get("employeeList");
TrainingSession trainingSession = Beans.get(TrainingSessionRepository.class).find(Long.parseLong(context.get("_trainingSessionId").toString()));
String eventList = Beans.get(TrainingRegisterService.class).massTrainingRegisterCreation(employeeList, trainingSession);
response.setCanClose(true);
if (!eventList.equals("()")) {
response.setView(ActionView.define("Meeting").model(Event.class.getCanonicalName()).add("grid", "event-grid").add("form", "event-form").param("search-filters", "event-filters").domain("self.id in " + eventList).map());
} else {
response.setAlert(IExceptionMessage.NO_EVENT_GENERATED);
}
}
Aggregations