From 4481b9507d9b6cf98bf4df78f0f0e91d5d09ddec Mon Sep 17 00:00:00 2001 From: Gedeson Wasley Date: Thu, 3 Apr 2014 12:20:22 -0300 Subject: [PATCH] Exclusão de tipo UORG --- src/Cacic/CommonBundle/Controller/UorgTypeController.php | 18 +++++++++--------- src/Cacic/CommonBundle/Resources/config/routing.yml | 6 ++---- src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig | 4 ++-- 3 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/Cacic/CommonBundle/Controller/UorgTypeController.php b/src/Cacic/CommonBundle/Controller/UorgTypeController.php index 9abc832..404cdc1 100644 --- a/src/Cacic/CommonBundle/Controller/UorgTypeController.php +++ b/src/Cacic/CommonBundle/Controller/UorgTypeController.php @@ -73,23 +73,23 @@ class UorgTypeController extends Controller * @param int $idUorg * @param Symfony\Component\HttpFoundation\Request $request */ - public function excluirAction( $idUorg, Request $request ) + public function excluirAction( Request $request ) { + //Debug::dump($request->get('id'));die; +/* if ( ! $request->isXmlHttpRequest() ) // Verifica se se trata de uma requisição AJAX - throw $this->createNotFoundException( 'Página não encontrada' ); + throw $this->createNotFoundException( 'Página não encontrada' );*/ - $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( $request->get('id') ); + $uorg = $this->getDoctrine()->getRepository('CacicCommonBundle:TipoUorg')->find( (int)$request->get('id') ); if ( ! $uorg ) throw $this->createNotFoundException( 'Unidade Organizacional não encontrada' ); $em = $this->getDoctrine()->getManager(); $em->remove( $uorg ); $em->flush(); - - $response = new Response( json_encode( array('status' => 'ok') ) ); - $response->headers->set('Content-Type', 'application/json'); - - return $response; + $this->get('session')->getFlashBag()->add('error', 'Item excluído com sucesso!'); + + return $this->redirect($this->generateUrl('cacic_uorg_type_index') ); + } - } \ No newline at end of file diff --git a/src/Cacic/CommonBundle/Resources/config/routing.yml b/src/Cacic/CommonBundle/Resources/config/routing.yml index a15590c..965e99b 100644 --- a/src/Cacic/CommonBundle/Resources/config/routing.yml +++ b/src/Cacic/CommonBundle/Resources/config/routing.yml @@ -488,10 +488,8 @@ cacic_uorg_type_cadastrar: defaults: { _controller: CacicCommonBundle:UorgType:cadastrar, idUorgType: null} cacic_uorg_type_excluir: - pattern: /uorg/type/excluir/{idUorgType} - defaults: { _controller: CacicCommonBundle:UorgType:excluir, idUorgType: null} - requirements: - idUorgType: \d+ + pattern: /uorg/type/excluir + defaults: { _controller: CacicCommonBundle:UorgType:excluir} cacic_grupo_usuario_index: pattern: /grupousuario/{page} diff --git a/src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig b/src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig index f63da61..c06192d 100755 --- a/src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig +++ b/src/Cacic/CommonBundle/Resources/views/UorgType/index.html.twig @@ -34,7 +34,7 @@ - + @@ -80,7 +80,7 @@ }; $( "#System_Excluir" ).data( 'params', { 'url': url, 'id': uorgId, 'callback': callback } ).dialog( "open" ); } - + {% endblock %} -- libgit2 0.21.2