/** * Handles expired registrations. If the $delete parameter is set, then * registrations are deleted, else just hidden * * @param bool $delete Delete * * @return void */ public function handleExpiredRegistrations($delete = FALSE) { $registrations = $this->registrationRepository->findExpiredRegistrations(new \DateTime()); if ($registrations->count() > 0) { foreach ($registrations as $registration) { /** @var \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration */ if ($delete) { $this->registrationRepository->remove($registration); } else { $registration->setHidden(TRUE); $this->registrationRepository->update($registration); } } } }
/** * Cancels all depending registrations based on the given main registration * * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration Registration * * @return void */ public function cancelDependingRegistrations($registration) { $registrations = $this->registrationRepository->findByMainRegistration($registration); foreach ($registrations as $foundRegistration) { $this->registrationRepository->remove($foundRegistration); } }
/** * 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); }
/** * @param \DERHANSEN\SfEventMgt\Domain\Model\Registration $registration * @param string $hmac */ public function cancelAction($registration, $hmac) { $this->validateHmacForAction($registration, $hmac, $this->actionMethodName); $this->proceedWithAction($registration, $this->actionMethodName); $values = ['html' => '']; $paymentMethod = $registration->getPaymentmethod(); /** * Update- and remove flags */ $updateRegistration = false; $removeRegistration = false; $this->signalSlotDispatcher->dispatch(__CLASS__, __FUNCTION__ . 'ProcessCancel' . ucfirst($paymentMethod), [&$values, &$updateRegistration, &$removeRegistration, $registration, GeneralUtility::_GET(), $this]); if ($updateRegistration) { $this->registrationRepository->update($registration); } if ($removeRegistration) { // First cancel depending registrations if ($registration->getAmountOfRegistrations() > 1) { $this->registrationService->cancelDependingRegistrations($registration); } $this->registrationRepository->remove($registration); } $this->view->assign('result', $values); }