mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-28 02:23:51 +00:00
front-end/design single tasks
This commit is contained in:
@@ -33,26 +33,29 @@ class SingleTaskController extends Controller
|
||||
public function newAction(Request $request)
|
||||
{
|
||||
|
||||
$personId = $request->query->getInt('person_id', null);
|
||||
$task = (new SingleTask())
|
||||
->setAssignee($this->getUser())
|
||||
->setType('task_default')
|
||||
;
|
||||
|
||||
if ($personId === null) {
|
||||
return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST);
|
||||
if ($request->query->has('person_id')) {
|
||||
$personId = $request->query->getInt('person_id', null);
|
||||
|
||||
if ($personId === null) {
|
||||
return new Response("You must provide a person_id", Response::HTTP_BAD_REQUEST);
|
||||
}
|
||||
|
||||
$person = $this->getDoctrine()->getManager()
|
||||
->getRepository(Person::class)
|
||||
->find($personId);
|
||||
|
||||
if ($person === null) {
|
||||
$this->createNotFoundException("Invalid person id");
|
||||
}
|
||||
|
||||
$task->setPerson($person);
|
||||
}
|
||||
|
||||
$person = $this->getDoctrine()->getManager()
|
||||
->getRepository(Person::class)
|
||||
->find($personId);
|
||||
|
||||
if ($person === null) {
|
||||
$this->createNotFoundException("Invalid person id");
|
||||
}
|
||||
|
||||
$task = (new SingleTask())
|
||||
->setAssignee($this->getUser())
|
||||
->setPerson($person)
|
||||
->setType('task_default')
|
||||
;
|
||||
|
||||
$this->denyAccessUnlessGranted(TaskVoter::CREATE, $task, 'You are not '
|
||||
. 'allowed to create this task');
|
||||
|
||||
@@ -69,7 +72,7 @@ class SingleTaskController extends Controller
|
||||
|
||||
$this->addFlash('success', "The task is created");
|
||||
|
||||
return $this->redirectToRoute('chill_task_task_list_by_person', [
|
||||
return $this->redirectToRoute('chill_task_singletask_list', [
|
||||
'person_id' => $task->getPerson()->getId()
|
||||
]);
|
||||
|
||||
|
Reference in New Issue
Block a user