Commit bf218899c736da4576c1539b136563e9cd95db27
1 parent
2fc2914529
Exists in
master
verificar si el pida esta vigente o vencido y si esta vencido, solicitar que registre uno nuevo
Showing
1 changed file
with
35 additions
and
7 deletions
Show diff stats
src/AppBundle/Controller/AppController.php
... | ... | @@ -53,21 +53,49 @@ class AppController extends Controller { |
53 | 53 | |
54 | 54 | //si no ha solicitado adscripción regresa a la pagina de adscripcion |
55 | 55 | if(!$servicioAdscripcion){ return $this->redirect($this->generateUrl('solicitud_adscripcion')); } |
56 | - | |
57 | - | |
58 | - | |
59 | - $pida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')-> | |
60 | - findOneBy(array( | |
56 | + | |
57 | + | |
58 | + | |
59 | + $pida = $this->getDoctrine()->getRepository('AppBundle:DocenteServicio')-> | |
60 | + findOneBy(array( | |
61 | + 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId(), | |
62 | + 'idServicioCe' => 4), | |
63 | + array('id' => 'DESC') | |
64 | + ); | |
65 | + $em = $this->getDoctrine()->getManager(); | |
66 | + if(!$pida){ | |
67 | + return $this->redirect($this->generateUrl('solicitud_pida')); | |
68 | + }else{ | |
69 | + $caducidad = $this->getDoctrine()->getRepository("AppBundle:PidaCaducidad")->findOneByIdDocenteServicio($pida); | |
70 | + if($caducidad){ | |
71 | + //saber si el pida actual caducó | |
72 | + $hoy = new \DateTime("now"); | |
73 | + $vencido = (($hoy->diff($caducidad->getFechaFinal())->invert ? true : false)); | |
74 | + if($vencido){ | |
75 | + $pida->setIdEstatus($this->getDoctrine()->getRepository("AppBundle:Estatus")->findOneById(5)); | |
76 | + $em->persist($pida); | |
77 | + $em->flush(); | |
78 | + $this->addFlash('danger', 'Su pida Actual venció, por favor registre un nuevo PIDA.'); | |
79 | + return $this->redirect($this->generateUrl('solicitud_pida')); | |
80 | + | |
81 | + } | |
82 | + } | |
83 | + | |
84 | + } | |
85 | + | |
86 | + $adscripcionPida = $this->getDoctrine()->getRepository('AppBundle:AdscripcionPida')-> | |
87 | + findBy(array( | |
61 | 88 | 'idRolInstitucion' => $this->getUser()->getIdRolInstitucion()->getId() |
62 | 89 | )); |
63 | 90 | |
64 | 91 | |
65 | - if(!$pida){ return $this->redirect($this->generateUrl('solicitud_pida')); } | |
92 | + | |
66 | 93 | |
67 | 94 | $escalafon = $this->getDoctrine()->getRepository('AppBundle:DocenteEscala')->findOneBy( |
68 | 95 | array('idRolInstitucion' => $this->getUser()->getIdRolInstitucion()), |
69 | 96 | array('id' => 'DESC') |
70 | - ); | |
97 | + ); | |
98 | + | |
71 | 99 | $tiempoTranscurrido = -1; |
72 | 100 | $suffix = ""; |
73 | 101 | if ($escalafon){ | ... | ... |