Feature: [calendar] convert calendar to activity in the context of a person

This commit is contained in:
2023-04-03 19:54:10 +02:00
parent 46e1891386
commit 4cf6721e35
2 changed files with 56 additions and 9 deletions

View File

@@ -526,14 +526,20 @@ class CalendarController extends AbstractController
'comment' => $calendar->getComment()->getComment(),
];
return $this->redirectToRoute(
'chill_activity_activity_new',
[
'accompanying_period_id' => $calendar->getAccompanyingPeriod()->getId(),
'activityData' => $activityData,
'returnPath' => $request->query->get('returnPath', null),
]
);
$routeParams = [
'activityData' => $activityData,
'returnPath' => $request->query->get('returnPath', null),
];
if ($calendar->getContext() === 'accompanying_period'){
$routeParams['accompanying_period_id'] = $calendar->getAccompanyingPeriod()->getId();
} elseif ($calendar->getContext() === 'person') {
$routeParams['person_id'] = $calendar->getPerson()->getId();
} else {
throw new RuntimeException('context not found for this calendar');
}
return $this->redirectToRoute('chill_activity_activity_new', $routeParams);
}
private function buildListFilterOrder(): FilterOrderHelper