Commit 901bbe6e0a5598d10bb76c971e87613e1f3b0f2a
1 parent
6d0261f2bd
Exists in
master
añadida la solicitud del PIDA a la tabla de solicitudes
Showing
1 changed file
with
27 additions
and
8 deletions
Show diff stats
src/AppBundle/Controller/AdscripcionController.php
... | ... | @@ -253,11 +253,21 @@ class AdscripcionController extends Controller |
253 | 253 | |
254 | 254 | if ($form->isSubmitted() && $form->isValid()) { |
255 | 255 | |
256 | + //Crear la solicitud de Servicio | |
257 | + $servicios = new DocenteServicio(); | |
258 | + | |
259 | + $servicios->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | |
260 | + $servicios->setIdServicioCe($this->getDoctrine()->getRepository('AppBundle:ServiciosCe')->findOneById(4)); | |
261 | + $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:estatus')->findOneById(2)); | |
262 | + | |
263 | + | |
264 | + | |
256 | 265 | $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
257 | 266 | $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); |
258 | 267 | |
259 | 268 | $em = $this->getDoctrine()->getManager(); |
260 | 269 | $em->persist($pida); |
270 | + $em->persist($servicios); | |
261 | 271 | $em->flush(); |
262 | 272 | |
263 | 273 | return $this->redirectToRoute('cea_index'); |
... | ... | @@ -372,28 +382,37 @@ class AdscripcionController extends Controller |
372 | 382 | { |
373 | 383 | |
374 | 384 | //$adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneById($adscripcion->getId()); |
375 | - $servicios = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->findOneBy(array( | |
385 | + $serviciosAdscripcion = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->findOneBy(array( | |
376 | 386 | 'idRolInstitucion' => $adscripcion->getIdRolInstitucion(), |
377 | 387 | 'idServicioCe' => 2 |
378 | 388 | )); |
379 | 389 | |
390 | + | |
391 | + $serviciosPida = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->findOneBy(array( | |
392 | + 'idRolInstitucion' => $adscripcion->getIdRolInstitucion(), | |
393 | + 'idServicioCe' => 4 | |
394 | + )); | |
395 | + | |
380 | 396 | $pida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
381 | 397 | |
382 | 398 | if($estatus == "true") { |
383 | - $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); | |
399 | + $serviciosAdscripcion->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(1)); | |
400 | + $serviciosPida->setIdEstatus($serviciosAdscripcion->getIdEstatus()); | |
384 | 401 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
385 | 402 | $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); |
386 | - $pida->setIdEstatus($servicios->getIdEstatus()); | |
403 | + $pida->setIdEstatus($serviciosAdscripcion->getIdEstatus()); | |
387 | 404 | |
388 | 405 | }else{ |
389 | - $servicios->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); | |
406 | + $serviciosAdscripcion->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(3)); | |
407 | + $serviciosPida->setIdEstatus($serviciosAdscripcion->getIdEstatus()); | |
390 | 408 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
391 | 409 | $user->removeRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); |
392 | - $pida->setIdEstatus($servicios->getIdEstatus()); | |
410 | + $pida->setIdEstatus($serviciosAdscripcion->getIdEstatus()); | |
393 | 411 | } |
394 | 412 | |
395 | 413 | $em = $this->getDoctrine()->getManager(); |
396 | - $em->persist($servicios); | |
414 | + $em->persist($serviciosAdscripcion); | |
415 | + $em->persist($serviciosPida); | |
397 | 416 | $em->persist($user); |
398 | 417 | $em->persist($pida); |
399 | 418 | $em->flush(); |
... | ... | @@ -408,7 +427,7 @@ class AdscripcionController extends Controller |
408 | 427 | array( |
409 | 428 | 'nombres' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre(), |
410 | 429 | 'apellidos' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerApellido(), |
411 | - 'estatus' => $servicios->getIdEstatus() | |
430 | + 'estatus' => $serviciosAdscripcion->getIdEstatus() | |
412 | 431 | ) |
413 | 432 | ), |
414 | 433 | 'text/html' |
... | ... | @@ -423,7 +442,7 @@ class AdscripcionController extends Controller |
423 | 442 | )); |
424 | 443 | |
425 | 444 | return $this->render('cea/solicitudes_mostar.html.twig', array( |
426 | - 'servicio' => $servicios, | |
445 | + 'servicio' => $serviciosAdscripcion, | |
427 | 446 | 'adscripcion' => $adscripcion, |
428 | 447 | 'escalas' => $escala, |
429 | 448 | 'pida' => $pida | ... | ... |