Commit 08f813635826efba6747e94e7b5ef856f9fe807a
1 parent
0011061d9c
Exists in
master
mejora la selección del estatus del avance de la actividad del PIDA
Showing
1 changed file
with
14 additions
and
9 deletions
Show diff stats
src/AppBundle/Controller/AdscripcionController.php
| ... | ... | @@ -13,6 +13,7 @@ use AppBundle\Entity\PidaCaducidad; |
| 13 | 13 | use AppBundle\Entity\PidaEstatus; |
| 14 | 14 | use AppBundle\Entity\PidaTareaEspecifico; |
| 15 | 15 | use AppBundle\Form\PidaTareaEspecificoType; |
| 16 | +use Doctrine\ORM\EntityRepository; | |
| 16 | 17 | use Symfony\Bridge\Doctrine\Form\Type\EntityType; |
| 17 | 18 | use Symfony\Component\Form\FormError; |
| 18 | 19 | use Symfony\Component\HttpFoundation\File\UploadedFile; |
| ... | ... | @@ -483,7 +484,13 @@ class AdscripcionController extends Controller |
| 483 | 484 | $estatusPida = new PidaEstatus(); |
| 484 | 485 | $Estatusform = $this->createFormBuilder($estatusPida) |
| 485 | 486 | ->add('nombre', EntityType::class, array( |
| 486 | - 'class' => 'AppBundle\Entity\PidaEstatus' | |
| 487 | + 'class' => 'AppBundle\Entity\PidaEstatus', | |
| 488 | + 'expanded' => true, | |
| 489 | + 'multiple' => false, | |
| 490 | + 'query_builder' => function (EntityRepository $er) { | |
| 491 | + return $er->createQueryBuilder('u') | |
| 492 | + ->orderBy('u.nombre', 'ASC'); | |
| 493 | + }, | |
| 487 | 494 | )) |
| 488 | 495 | ->getForm(); |
| 489 | 496 | |
| ... | ... | @@ -502,7 +509,7 @@ class AdscripcionController extends Controller |
| 502 | 509 | $em->persist($serv); |
| 503 | 510 | } |
| 504 | 511 | |
| 505 | - | |
| 512 | + | |
| 506 | 513 | |
| 507 | 514 | $pida->setIdRolInstitucion($this->getUser()->getIdRolInstitucion()); |
| 508 | 515 | $pida->setIdEstatus($this->getDoctrine()->getRepository('AppBundle:Estatus')->findOneById(2)); |
| ... | ... | @@ -518,7 +525,7 @@ class AdscripcionController extends Controller |
| 518 | 525 | |
| 519 | 526 | $em->flush(); |
| 520 | 527 | |
| 521 | - return $this->redirectToRoute('solicitud_pida'); | |
| 528 | + return $this->redirectToRoute('solicitud_pida', array('id' => $servicio->getId())); | |
| 522 | 529 | |
| 523 | 530 | } |
| 524 | 531 | |
| ... | ... | @@ -533,7 +540,7 @@ class AdscripcionController extends Controller |
| 533 | 540 | |
| 534 | 541 | $em->flush(); |
| 535 | 542 | |
| 536 | - return $this->redirectToRoute('solicitud_pida'); | |
| 543 | + return $this->redirectToRoute('solicitud_pida', array('id' => $servicio->getId())); | |
| 537 | 544 | } |
| 538 | 545 | |
| 539 | 546 | } |
| ... | ... | @@ -550,7 +557,7 @@ class AdscripcionController extends Controller |
| 550 | 557 | |
| 551 | 558 | $em->flush(); |
| 552 | 559 | |
| 553 | - return $this->redirectToRoute('solicitud_pida'); | |
| 560 | + return $this->redirectToRoute('solicitud_pida', array('id' => $servicio->getId())); | |
| 554 | 561 | } |
| 555 | 562 | |
| 556 | 563 | } |
| ... | ... | @@ -559,10 +566,8 @@ class AdscripcionController extends Controller |
| 559 | 566 | $caducidadForm = $this->createForm('AppBundle\Form\PidaCaducidadType', $caducidad); |
| 560 | 567 | $caducidadForm->handleRequest($request); |
| 561 | 568 | $days = $months = $years = 0; |
| 562 | - if(!$this->getDoctrine()->getRepository("AppBundle:PidaCaducidad")->findOneByidDocenteServicio($servicio)) { | |
| 563 | - $caduca = false; | |
| 564 | - }else{ | |
| 565 | - $caduca = $this->getDoctrine()->getRepository("AppBundle:PidaCaducidad")->findOneByidDocenteServicio($servicio); | |
| 569 | + $caduca = $this->getDoctrine()->getRepository("AppBundle:PidaCaducidad")->findOneByidDocenteServicio($servicio); | |
| 570 | + if($caduca) { | |
| 566 | 571 | $interval = $caduca->getFechaInicio()->diff($caduca->getFechaFinal()); |
| 567 | 572 | $years = $interval->format('%y'); |
| 568 | 573 | $months = $interval->format('%m'); | ... | ... |