Commit 948cf98e2257bdac21182f13d3a446c498495b71

Authored by Wilmer
1 parent bd47fb5469
Exists in master

corrige el error cuando el docente no ha concursado y debe subir su acta de apro…

…bación luego de concurso, para esto se cambia el orden de las preguntas de validación y se añada primero la de que tiene concurso o no
Showing 1 changed file with 23 additions and 30 deletions   Show diff stats
src/AppBundle/Controller/AscensoController.php
... ... @@ -385,15 +385,7 @@ class AscensoController extends Controller
385 385 'idTipoDocumentos' => 4
386 386 ));
387 387  
388   - if(!$concurso){
389   - return $this->render(
390   - 'solicitudes/reconocimientoEscala.html.twig',
391   - array(
392   - 'form' => $form->createView(),
393   - 'tipo' => 'Concurso de Oposición'
394   - )
395   - );
396   - }
  388 +
397 389  
398 390 //si ya tiene una solicitud en espera, enviarlo a la pagina de los servicios
399 391 $solicitud = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')->findOneBy(
... ... @@ -401,7 +393,7 @@ class AscensoController extends Controller
401 393 );
402 394  
403 395  
404   - if (!$solicitud){
  396 + if ($concurso && !$solicitud){
405 397 $this->addFlash('danger', 'Debe tener una solicitud de Ascenso Activa para poder utilizar este servicio');
406 398 return $this->redirect($this->generateUrl('cea_index'));
407 399 }
... ... @@ -412,7 +404,7 @@ class AscensoController extends Controller
412 404 'idEstatus' => 1
413 405 ));
414 406  
415   - if (!$acta){
  407 + if ($concurso && !$acta){
416 408 $this->addFlash('danger', 'Debe enviar primero su acta de aprobación de jurados para poder defender y subir su nuevo escalafón');
417 409 return $this->redirect($this->generateUrl('cea_index'));
418 410 }
... ... @@ -426,6 +418,12 @@ class AscensoController extends Controller
426 418 'idEstatus' => 1
427 419 )
428 420 );
  421 +
  422 +
  423 + if($concurso && !$solicitudAscenso){
  424 + $this->addFlash('danger', 'Estimado Docente, No posee ninguna solicitud de Ascenso Activa.');
  425 + return $this->redirect($this->generateUrl('cea_index'));
  426 + }
429 427  
430 428  
431 429  
... ... @@ -486,22 +484,17 @@ class AscensoController extends Controller
486 484 $this->addFlash('success', 'Solicitud de Reconocimiento de escala Registrada Satisfactoriamente');
487 485 return $this->redirect($this->generateUrl('cea_index'));
488 486 }
489   -
490   -
491 487  
492   -
493   -
494   -
495   - if(!$solicitudAscenso){
496   - $this->addFlash('danger', 'Estimado Docente, No posee ninguna solicitud de Ascenso Activa.');
497   - return $this->redirect($this->generateUrl('cea_index'));
  488 + if(!$concurso){
  489 + return $this->render(
  490 + 'solicitudes/reconocimientoEscala.html.twig',
  491 + array(
  492 + 'form' => $form->createView(),
  493 + 'tipo' => 'Concurso de Oposición'
  494 + )
  495 + );
498 496 }
499 497  
500   -
501   -
502   -
503   -
504   -
505 498 return $this->render(
506 499 'solicitudes/reconocimientoEscala.html.twig',
507 500 array(
... ... @@ -755,9 +748,9 @@ $ascenso = $this->getDoctrine()->getRepository('AppBundle:Ascenso')->findOneBy(
755 748  
756 749 $servicio->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
757 750  
758   - $servicioDefensa->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
759   - $ServicioAscenso->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
760   - $ascenso->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
  751 + if($servicioDefensa) $servicioDefensa->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
  752 + if($ServicioAscenso) $ServicioAscenso->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
  753 + if($ascenso) $ascenso->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(4));
761 754  
762 755 }else{
763 756 //$mensaje = $request->request->get('message-text');
... ... @@ -773,9 +766,9 @@ $ascenso = $this->getDoctrine()->getRepository('AppBundle:Ascenso')->findOneBy(
773 766  
774 767 }
775 768  
776   - $em->persist($ServicioAscenso);
777   - $em->persist($servicioDefensa);
778   - $em->persist($ascenso);
  769 + if($ServicioAscenso) $em->persist($ServicioAscenso);
  770 + if($servicioDefensa) $em->persist($servicioDefensa);
  771 + if($ascenso) $em->persist($ascenso);
779 772 $em->persist($verificado);
780 773 $em->flush();
781 774 $this->addFlash('success', 'Escala Agregada Satisfactoriamente');
... ...