From 22c295b51b53cbb8870a957525bf265907ef1311 Mon Sep 17 00:00:00 2001 From: Marc Ducobu Date: Fri, 14 Nov 2014 16:49:26 +0100 Subject: [PATCH] close#326 - When clicking on add a report, we should directly go to the report form if we have only one possible report --- Controller/ReportController.php | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/Controller/ReportController.php b/Controller/ReportController.php index b09fa416e..f788dd09e 100644 --- a/Controller/ReportController.php +++ b/Controller/ReportController.php @@ -73,6 +73,14 @@ class ReportController extends Controller $cFGroups = $em->getRepository('ChillCustomFieldsBundle:CustomFieldsGroup') ->findByEntity('Chill\ReportBundle\Entity\Report'); + + if(count($cFGroups) === 1 ){ + return $this->redirect( + $this->generateUrl('report_new', + array('person_id' => $person_id, 'cf_group_id' => $cFGroups[0]->getId()))); + } + + $cFGroupsChoice = array(); foreach ($cFGroups as $cFGroup) {