/**
  * Shows a list of all registration of the current frontend user
  *
  * @return void
  */
 public function listAction()
 {
     $demand = $this->createUserRegistrationDemandObjectFromSettings($this->settings);
     $demand->setUser($this->registrationService->getCurrentFeUserObject());
     $registrations = $this->registrationRepository->findRegistrationsByUserRegistrationDemand($demand);
     $this->view->assign('registrations', $registrations);
 }
 /**
  * Checks if the registration can be cancelled and returns an array of variables
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return array
  */
 public function checkCancelRegistration($reguid, $hmac)
 {
     /* @var $registration Registration */
     $registration = NULL;
     $failed = FALSE;
     $messageKey = 'event.message.cancel_successful';
     $titleKey = 'cancelRegistration.title.successful';
     if (!$this->hashService->validateHmac('reg-' . $reguid, $hmac)) {
         $failed = TRUE;
         $messageKey = 'event.message.cancel_failed_wrong_hmac';
         $titleKey = 'cancelRegistration.title.failed';
     } else {
         $registration = $this->registrationRepository->findByUid($reguid);
     }
     if (!$failed && is_null($registration)) {
         $failed = TRUE;
         $messageKey = 'event.message.cancel_failed_registration_not_found_or_cancelled';
         $titleKey = 'cancelRegistration.title.failed';
     }
     if (!$failed && $registration->getEvent()->getEnableCancel() === FALSE) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_cancel_disabled';
         $titleKey = 'cancelRegistration.title.failed';
     }
     if (!$failed && $registration->getEvent()->getCancelDeadline() > 0 && $registration->getEvent()->getCancelDeadline() < new \DateTime()) {
         $failed = TRUE;
         $messageKey = 'event.message.cancel_failed_deadline_expired';
         $titleKey = 'cancelRegistration.title.failed';
     }
     return array($failed, $registration, $messageKey, $titleKey);
 }
 /**
  * Test if ignoreNotifications is respected
  *
  * @test
  */
 public function findNotificationRegistrationsRespectsIgnoreNotificationsForEventUid3()
 {
     $event = $this->getMock('DERHANSEN\\SfEventMgt\\Domain\\Model\\Event', array(), array(), '', FALSE);
     $event->expects($this->once())->method('getUid')->will($this->returnValue(3));
     $registrations = $this->registrationRepository->findNotificationRegistrations($event, NULL);
     $this->assertEquals(1, $registrations->count());
 }
Пример #4
0
 /**
  * Returns all Registrations for the given eventUid as a CSV string
  *
  * @param int $eventUid EventUid
  * @param array $settings Settings
  *
  * @throws \RuntimeException RuntimeException
  * @return string
  */
 public function exportRegistrationsCsv($eventUid, $settings = array())
 {
     $fieldsArray = array_map('trim', explode(',', $settings['fields']));
     $registrations = $this->registrationRepository->findByEvent($eventUid);
     $exportedRegistrations = Utility\GeneralUtility::csvValues($fieldsArray, $settings['fieldDelimiter'], $settings['fieldQuoteCharacter']) . chr(10);
     foreach ($registrations as $registration) {
         $exportedRegistration = array();
         foreach ($fieldsArray as $field) {
             if ($registration->_hasProperty($field)) {
                 $exportedRegistration[] = $registration->_getCleanProperty($field);
             } else {
                 throw new RuntimeException('Field ' . $field . ' is not a Property of Model Registration, please check your TS configuration', 1475590002);
             }
         }
         $exportedRegistrations .= Utility\GeneralUtility::csvValues($exportedRegistration, $settings['fieldDelimiter'], $settings['fieldQuoteCharacter']) . chr(10);
     }
     return $exportedRegistrations;
 }
 /**
  * Confirms all depending registrations based on the given main registration
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration
  *
  * @return void
  */
 public function confirmDependingRegistrations($registration)
 {
     $registrations = $this->registrationRepository->findByMainRegistration($registration);
     foreach ($registrations as $foundRegistration) {
         /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $foundRegistration */
         $foundRegistration->setConfirmed(TRUE);
         $this->registrationRepository->update($foundRegistration);
     }
 }
 /**
  * Sends a custom notification defined by the given customNotification key
  * to all confirmed users of the event
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event Event
  * @param string $customNotification CustomNotification
  * @param array $settings Settings
  *
  * @return int Number of notifications sent
  */
 public function sendCustomNotification($event, $customNotification, $settings)
 {
     if (is_null($event) || $customNotification == '' || $settings == '' || !is_array($settings)) {
         return 0;
     }
     $count = 0;
     $constraints = $settings['notification']['customNotifications'][$customNotification]['constraints'];
     $registrations = $this->registrationRepository->findNotificationRegistrations($event, $constraints);
     foreach ($registrations as $registration) {
         /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration */
         if ($registration->isConfirmed() && !$registration->isIgnoreNotifications()) {
             $result = $this->sendUserMessage($event, $registration, $settings, MessageType::CUSTOM_NOTIFICATION, $customNotification);
             if ($result) {
                 $count += 1;
             }
         }
     }
     return $count;
 }
 /**
  * Test if findRegistrationsByUserRegistrationDemand respects order direction constraint
  *
  * @test
  */
 public function findRegistrationsByUserRegistrationDemandRespectsOrderDirection()
 {
     /** @var \TYPO3\CMS\Extbase\Domain\Repository\frontendUserRepository $feUserRepository */
     $feUserRepository = $this->objectManager->get('TYPO3\\CMS\\Extbase\\Domain\\Repository\\FrontendUserRepository');
     $feUser = $feUserRepository->findByUid(1);
     /** @var \DERHANSEN\SfEventMgt\Domain\Model\Dto\UserRegistrationDemand $demand */
     $demand = $this->objectManager->get('DERHANSEN\\SfEventMgt\\Domain\\Model\\Dto\\UserRegistrationDemand');
     $demand->setDisplayMode('all');
     $demand->setStoragePage(7);
     $demand->setUser($feUser);
     $demand->setOrderField('event.startdate');
     $demand->setOrderDirection('desc');
     $registrations = $this->registrationRepository->findRegistrationsByUserRegistrationDemand($demand);
     $this->assertEquals(32, $registrations->getFirst()->getUid());
 }
Пример #8
0
 /**
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration
  * @param string $hmac
  */
 public function notifyAction($registration, $hmac)
 {
     $this->validateHmacForAction($registration, $hmac, $this->actionMethodName);
     $this->proceedWithAction($registration, $this->actionMethodName);
     $values = ['html' => ''];
     $paymentMethod = $registration->getPaymentmethod();
     /**
      * Initialize update-flag
      *
      * If true, the externally called ProcessNotify method requested, that the registration should be updated
      */
     $updateRegistration = false;
     $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ProcessNotify' . ucfirst($paymentMethod), [&$values, &$updateRegistration, $registration, GeneralUtility::_GET(), $this]);
     if ($updateRegistration) {
         $this->registrationRepository->update($registration);
     }
     $this->view->assign('result', $values);
 }
Пример #9
0
 /**
  * Confirms the registration if possible and sends e-mails to admin and user
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return void
  */
 public function confirmRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     $registration = NULL;
     $failed = FALSE;
     $messageKey = 'event.message.confirmation_successful';
     $titleKey = 'confirmRegistration.title.successful';
     if (!$this->hashService->validateHmac('reg-' . $reguid, $hmac)) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_wrong_hmac';
         $titleKey = 'confirmRegistration.title.failed';
     } else {
         $registration = $this->registrationRepository->findByUid($reguid);
     }
     if (!$failed && is_null($registration)) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_registration_not_found';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if (!$failed && $registration->getConfirmationUntil() < new \DateTime()) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_confirmation_until_expired';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if (!$failed && $registration->getConfirmed() === TRUE) {
         $failed = TRUE;
         $messageKey = 'event.message.confirmation_failed_already_confirmed';
         $titleKey = 'confirmRegistration.title.failed';
     }
     if ($failed === FALSE) {
         $registration->setConfirmed(TRUE);
         $this->registrationRepository->update($registration);
         // Send notifications to user and admin
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CONFIRMED);
         // Confirm registrations depending on main registration if necessary
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->confirmDependingRegistrations($registration);
         }
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }
Пример #10
0
 /**
  * Cancels the registration if possible and sends e-mails to admin and user
  *
  * @param int $reguid UID of registration
  * @param string $hmac HMAC for parameters
  *
  * @return void
  */
 public function cancelRegistrationAction($reguid, $hmac)
 {
     /* @var $registration Registration */
     list($failed, $registration, $messageKey, $titleKey) = $this->registrationService->checkCancelRegistration($reguid, $hmac);
     if ($failed === false) {
         // Send notifications (must run before cancelling the registration)
         $this->notificationService->sendUserMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CANCELLED);
         $this->notificationService->sendAdminMessage($registration->getEvent(), $registration, $this->settings, MessageType::REGISTRATION_CANCELLED);
         // First cancel depending registrations
         if ($registration->getAmountOfRegistrations() > 1) {
             $this->registrationService->cancelDependingRegistrations($registration);
         }
         // Finally cancel registration
         $this->registrationRepository->remove($registration);
         // Clear cache for configured pages
         $this->utilityService->clearCacheForConfiguredUids($this->settings);
     }
     $this->view->assign('messageKey', $messageKey);
     $this->view->assign('titleKey', $titleKey);
 }
Пример #11
0
 /**
  * Returns if the given e-mail is registered to the given event
  *
  * @param \DERHANSEN\SfEventMgt\Domain\Model\Event $event
  * @param string $email
  * @return bool
  */
 protected function emailNotUnique($event, $email)
 {
     $registrations = $this->registrationRepository->findEventRegistrationsByEmail($event, $email);
     return $registrations->count() >= 1;
 }