backend/group-training : improve delete&copy week

This commit is contained in:
Roland Schneider
2021-10-10 23:01:18 +02:00
parent 5fe59ff1d3
commit 50011a4e4f
14 changed files with 226 additions and 131 deletions

View File

@@ -230,11 +230,11 @@ class EventRegistrationManager extends BaseObject
}
if (isset($registration->canceled_at)) {
throw new BadRequestHttpException('The registration is already canceled', self::ALREADY_CANCELLED);
throw new BadRequestHttpException('The registration is already canceled: '.$registration->id, self::ALREADY_CANCELLED);
}
if (isset($registration->deleted_at)) {
throw new BadRequestHttpException('The reservation is already deleted', self::ALREADY_DELETED);
throw new BadRequestHttpException('The reservation is already deleted: '.$registration->id, self::ALREADY_DELETED);
}
$event = Event::findOne($registration->id_event);
@@ -245,10 +245,10 @@ class EventRegistrationManager extends BaseObject
$now = strtotime("now UTC");
if ($reason != EventRegistration::CANCEL_REASON_CUSTOMER) {
if ($reason == EventRegistration::CANCEL_REASON_CUSTOMER) {
$timeUntilEventStart = $event->start - $now;
if ($timeUntilEventStart < Helper::getGroupTrainingRegistrationCancelLimitMinutes() * 60) {
throw new BadRequestHttpException('The reservation is already deleted', self::CANCEL_TIME_LIMIT_REACHED);
throw new BadRequestHttpException('The reservation can\'t be deleted', self::CANCEL_TIME_LIMIT_REACHED);
}
}
@@ -302,9 +302,8 @@ class EventRegistrationManager extends BaseObject
$tx = $db->beginTransaction();
try {
$eventRegistrationManager = new EventRegistrationManager();
$allRegistrations = $eventRegistrationManager->findAllRegistrations($event->id);
$activeRegistrations = $eventRegistrationManager->findActiveRegistrations($event->id);
$allRegistrations = $this->findAllRegistrations($event->id);
$activeRegistrations = $this->findActiveRegistrations($event->id);
// ////////////////////////////////
// if event has no registrations