/**
  * Sends an email about expired reservations and lessons.
  * Expired are lessons where the reservation deadline is
  * before yesterday 0:00:00 h.
  * A MS Excel file with the results will be attached to the email
  *
  * @param string $email Recipients email address
  * @throws Exception
  */
 public function reportExpiredCommand($email)
 {
     $lessons = $this->getLessonsWithExpiredDeadline();
     $reservationDemand = $this->createReservationDemandByLessonDeadline('yesterday');
     $reservations = $this->reservationRepository->findDemanded($reservationDemand);
     if (!empty($email) and (count($lessons) or count($reservations))) {
         try {
             $this->notificationService->notify($email, '*****@*****.**', 'Abgelaufene Termine und Reservierungen in ihrem Veranstaltungssystem', 'Email', NULL, 'ReportExpired', ['lessons' => $lessons, 'reservations' => $reservations], [['variables' => ['lessons' => $lessons, 'reservations' => $reservations], 'templateName' => 'Download', 'folderName' => 'CloseBooking', 'fileName' => 'anhang.xls', 'mimeType' => 'application/vnd.ms-excel']]);
         } catch (Exception $e) {
             throw new Exception($e->getMessage());
         }
     }
 }
 /**
  * Download action
  *
  * @param array $reservations
  * @param string $fileExtension
  */
 public function downloadAction($reservations = null, $fileExtension = 'csv')
 {
     if (is_null($reservations)) {
         $demand = $this->createDemandFromSettings($this->settings);
         $reservationResult = $this->reservationRepository->findDemanded($demand);
     } else {
         $reservationIdList = implode(',', $reservations);
         $reservationResult = $this->reservationRepository->findMultipleByUid($reservationIdList);
     }
     $this->view->assign('reservations', $reservationResult);
     $objectForFileName = $reservationResult->getFirst();
     echo $this->getContentForDownload($fileExtension, $objectForFileName);
     return;
 }
 /**
  * updates the reservation
  *
  * @param Reservation $reservation
  * @throws \TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
  * @throws \TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException
  */
 public function updateAction(Reservation $reservation)
 {
     $this->addFlashMessage($this->translate('message.reservation.update.success'));
     $this->reservationRepository->update($reservation);
     $this->redirect('edit', null, null, ['reservation' => $reservation]);
 }