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,11 +253,21 @@ class AdscripcionController extends Controller | ||
| 253 | 253 | ||
| 254 | if ($form->isSubmitted() && $form->isValid()) { | 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 | $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); | 265 | $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
| 257 | $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); | 266 | $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); |
| 258 | 267 | ||
| 259 | $em = $this->getDoctrine()->getManager(); | 268 | $em = $this->getDoctrine()->getManager(); |
| 260 | $em->persist($pida); | 269 | $em->persist($pida); |
| 270 | + $em->persist($servicios); | ||
| 261 | $em->flush(); | 271 | $em->flush(); |
| 262 | 272 | ||
| 263 | return $this->redirectToRoute('cea_index'); | 273 | return $this->redirectToRoute('cea_index'); |
| @@ -372,28 +382,37 @@ class AdscripcionController extends Controller | @@ -372,28 +382,37 @@ class AdscripcionController extends Controller | ||
| 372 | { | 382 | { |
| 373 | 383 | ||
| 374 | //$adscripciones = $this->getDoctrine()->getRepository('AppBundle:Adscripcion')->findOneById($adscripcion->getId()); | 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 | 'idRolInstitucion' => $adscripcion->getIdRolInstitucion(), | 386 | 'idRolInstitucion' => $adscripcion->getIdRolInstitucion(), |
| 377 | 'idServicioCe' => 2 | 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 | $pida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); | 396 | $pida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
| 381 | 397 | ||
| 382 | if($estatus == "true") { | 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 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); | 401 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
| 385 | $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); | 402 | $user->addRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); |
| 386 | - $pida->setIdEstatus($servicios->getIdEstatus()); | 403 | + $pida->setIdEstatus($serviciosAdscripcion->getIdEstatus()); |
| 387 | 404 | ||
| 388 | }else{ | 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 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); | 408 | $user = $this->getDoctrine()->getRepository('AppBundle:Usuarios')->findOneByIdRolInstitucion($adscripcion->getIdRolInstitucion()); |
| 391 | $user->removeRol($this->getDoctrine()->getRepository('AppBundle:Role')->findOneByName("ROLE_ADSCRITO")); | 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 | $em = $this->getDoctrine()->getManager(); | 413 | $em = $this->getDoctrine()->getManager(); |
| 396 | - $em->persist($servicios); | 414 | + $em->persist($serviciosAdscripcion); |
| 415 | + $em->persist($serviciosPida); | ||
| 397 | $em->persist($user); | 416 | $em->persist($user); |
| 398 | $em->persist($pida); | 417 | $em->persist($pida); |
| 399 | $em->flush(); | 418 | $em->flush(); |
| @@ -408,7 +427,7 @@ class AdscripcionController extends Controller | @@ -408,7 +427,7 @@ class AdscripcionController extends Controller | ||
| 408 | array( | 427 | array( |
| 409 | 'nombres' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre(), | 428 | 'nombres' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerNombre(), |
| 410 | 'apellidos' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerApellido(), | 429 | 'apellidos' => $user->getIdRolInstitucion()->getIdRol()->getIdPersona()->getPrimerApellido(), |
| 411 | - 'estatus' => $servicios->getIdEstatus() | 430 | + 'estatus' => $serviciosAdscripcion->getIdEstatus() |
| 412 | ) | 431 | ) |
| 413 | ), | 432 | ), |
| 414 | 'text/html' | 433 | 'text/html' |
| @@ -423,7 +442,7 @@ class AdscripcionController extends Controller | @@ -423,7 +442,7 @@ class AdscripcionController extends Controller | ||
| 423 | )); | 442 | )); |
| 424 | 443 | ||
| 425 | return $this->render('cea/solicitudes_mostar.html.twig', array( | 444 | return $this->render('cea/solicitudes_mostar.html.twig', array( |
| 426 | - 'servicio' => $servicios, | 445 | + 'servicio' => $serviciosAdscripcion, |
| 427 | 'adscripcion' => $adscripcion, | 446 | 'adscripcion' => $adscripcion, |
| 428 | 'escalas' => $escala, | 447 | 'escalas' => $escala, |
| 429 | 'pida' => $pida | 448 | 'pida' => $pida |