diff --git a/Controller/SingleTaskController.php b/Controller/SingleTaskController.php index 926235998..bc2254ec9 100644 --- a/Controller/SingleTaskController.php +++ b/Controller/SingleTaskController.php @@ -430,26 +430,27 @@ class SingleTaskController extends AbstractController $viewParams['center'] = null; $params['types'] = null; + // Get parameters from url if (!empty($request->query->get('person_id', NULL))) { - $personId = $request->query->getInt('person_id'); + + $personId = $request->query->getInt('person_id', 0); $person = $personRepository->find($personId); if ($person === null) { throw $this->createNotFoundException("This person ' $personId ' does not exist."); } - $this->denyAccessUnlessGranted(PersonVoter::SEE, $person); $viewParams['person'] = $person; $params['person'] = $person; - } elseif (!empty($request->query->get('center_id', NULL))) { + } + + if (!empty($request->query->get('center_id', NULL))) { $center = $centerRepository->find($request->query->getInt('center_id')); - if ($center === null) { throw $this->createNotFoundException('center not found'); } - $params['center'] = $center; } @@ -459,14 +460,13 @@ class SingleTaskController extends AbstractController $params['types'] = $types; } } - + if (!empty($request->query->get('user_id', null))) { if ($request->query->get('user_id') === '_unassigned') { $params['unassigned'] = true; } else { - $userId = $request->query->getInt('user_id', 0); // sf4 check: - // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` + $userId = $request->query->getInt('user_id', 0); $user = $this->getDoctrine()->getManager() ->getRepository('ChillMainBundle:User') ->find($userId); @@ -482,8 +482,7 @@ class SingleTaskController extends AbstractController if (!empty($request->query->get('scope_id'))) { - $scopeId = $request->query->getInt('scope_id', 0); // sf4 check: - // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` + $scopeId = $request->query->getInt('scope_id', 0); $scope = $this->getDoctrine()->getManager() ->getRepository('ChillMainBundle:Scope') diff --git a/Resources/views/SingleTask/index.html.twig b/Resources/views/SingleTask/index.html.twig index 2caaeceec..da557853f 100644 --- a/Resources/views/SingleTask/index.html.twig +++ b/Resources/views/SingleTask/index.html.twig @@ -15,24 +15,20 @@ * along with this program. If not, see . #} -{% extends "@ChillPerson/layout.html.twig" %} +{% extends layout %} {% set activeRouteKey = 'chill_task_single_task_new' %} {% block title %}{{ 'Task list'|trans }}{% endblock %} {% macro thead() %} - {% endmacro %} {% macro row(task) %} - {% endmacro %} -{# filter tasks #} -{% block filtertasks %}{# - sf4 check: prevent error message: `A block definition cannot be nested under non-capturing nodes.` #} +{% block filtertasks %} {% if person is not null %} {% block personcontent %} {% include 'ChillTaskBundle:SingleTask:_list.html.twig' %}