Commit e0a26ff6f563250af92dd52cda4f6d001dd6240e
1 parent
d593aa110a
Exists in
master
validando los campos que son obligatorios luego de seleccionar una determinada opcion en el ascenso
Showing
1 changed file
with
37 additions
and
2 deletions
Show diff stats
src/AppBundle/Controller/AscensoController.php
... | ... | @@ -10,6 +10,7 @@ namespace AppBundle\Controller; |
10 | 10 | |
11 | 11 | |
12 | 12 | use AppBundle\Entity\DocumentosVerificados; |
13 | +use Symfony\Component\Form\FormError; | |
13 | 14 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
14 | 15 | use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route; |
15 | 16 | use Symfony\Bundle\FrameworkBundle\Controller\Controller; |
... | ... | @@ -125,7 +126,41 @@ class AscensoController extends Controller |
125 | 126 | $tutoresAsignados = new TutoresAscenso(); |
126 | 127 | $form = $this->createForm('AppBundle\Form\AscensoType'); |
127 | 128 | $tutorForm = $this->createForm('AppBundle\Form\TutoresAscensoType', $tutoresAsignados); |
128 | - $form->handleRequest($request); | |
129 | + $form->handleRequest($request); | |
130 | + | |
131 | + | |
132 | + if ($form->isSubmitted()) { | |
133 | + //var_dump($form->get('tipoTrabajoInvestigacion')->getData()); exit; | |
134 | + if ($form->get('tipoTrabajoInvestigacion')->getData() === "tesis") { | |
135 | + //var_dump($form); | |
136 | + if (!$form->get('aprobacion')->getData()) { | |
137 | + $form->get('aprobacion')->addError(new FormError('Si su trabajo es tesis, debe subir el digital del acta de aprobación de la misma')); | |
138 | + } | |
139 | + | |
140 | + if ($form->get('tesisUbv')->getData()) { | |
141 | + if (!$form->get('tutores_ascenso')->getData()) { | |
142 | + $form->get('tutores_ascenso')->addError(new FormError('La tesis al ser fuera de la UBV debe postular seis(6) posibles jurados')); | |
143 | + } | |
144 | + | |
145 | + if (!$form->get('curriculo')->getData()) { | |
146 | + $form->get('curriculo')->addError(new FormError('Debe subir el digital del resumen curricular de los posibles jurados en fomato PDF')); | |
147 | + } | |
148 | + | |
149 | + if (!$form->get('pertinencia')->getData()) { | |
150 | + $form->get('pertinencia')->addError(new FormError('La tesis al ser fuera de la UBV debe incluir un informe de pertinencia')); | |
151 | + } | |
152 | + } | |
153 | + | |
154 | + }else if ($form->get('tipoTrabajoInvestigacion')->getData() === "investigacion"){ | |
155 | + if (!$form->get('tutores_ascenso')->getData()) { | |
156 | + $form->get('tutores_ascenso')->addError(new FormError('La tesis al ser fuera de la UBV debe postular seis(6) posibles jurados')); | |
157 | + } | |
158 | + | |
159 | + if (!$form->get('curriculo')->getData()) { | |
160 | + $form->get('curriculo')->addError(new FormError('Debe subir el digital del resumen curricular de los posibles jurados en fomato PDF')); | |
161 | + } | |
162 | + } | |
163 | + } | |
129 | 164 | |
130 | 165 | |
131 | 166 | if ($form->isSubmitted() && $form->isValid()) { |
... | ... | @@ -166,7 +201,7 @@ class AscensoController extends Controller |
166 | 201 | $constanciaTrabajo->move( |
167 | 202 | $this->container->getParameter('ascenso_directory'), |
168 | 203 | $nombreTrabajo |
169 | - ); | |
204 | + ); | |
170 | 205 | thumbnail2($nombreTrabajo, $this->container->getParameter('ascenso_directory'), $this->container->getParameter('ascenso_thumb_directory')); |
171 | 206 | |
172 | 207 | ... | ... |