Commit db41d53fcd95f10ae28794bdc423ffa1fa0208e5
1 parent
6069bc10
Exists in
master
and in
1 other branch
Corrige CNT002 apontado pela Life
Showing
4 changed files
with
22 additions
and
14 deletions
Show diff stats
src/Cacic/CommonBundle/Controller/ModuloController.php
... | ... | @@ -50,7 +50,17 @@ class ModuloController extends Controller |
50 | 50 | if ( ! $modulo ) |
51 | 51 | throw $this->createNotFoundException( 'Página não encontrada' ); |
52 | 52 | |
53 | - $local = $this->getUser()->getIdLocal(); /* @todo Em caso de usuário administrativo, escolher o Local */ | |
53 | + | |
54 | + | |
55 | + if($nivel[0]['teGrupoUsuarios'] != "Administração") | |
56 | + { | |
57 | + $local = $this->getUser()->getIdLocal(); /* @todo Em caso de usuário administrativo, escolher o Local */ | |
58 | + $redes = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Rede' )->listarPorLocal( $local ); | |
59 | + }else | |
60 | + { | |
61 | + $local = $this->getDoctrine()->getManager()->getRepository('CacicCommonBundle:Local')->findAll(); | |
62 | + $redes = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Rede' )->listarPorLocalADM(); | |
63 | + } | |
54 | 64 | |
55 | 65 | if ( $request->isMethod('POST') ) |
56 | 66 | { |
... | ... | @@ -73,13 +83,7 @@ class ModuloController extends Controller |
73 | 83 | $this->get('session')->getFlashBag()->add('success', 'Dados salvos com sucesso!'); |
74 | 84 | return $this->redirect( $this->generateUrl( 'cacic_modulo_editar', array('idAcao'=>$idAcao) ) ); |
75 | 85 | } |
76 | - if($nivel[0]['teGrupoUsuarios'] != "Administração") | |
77 | - { | |
78 | - $redes = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Rede' )->listarPorLocal( $local ); | |
79 | - }else | |
80 | - { | |
81 | - $redes = $this->getDoctrine()->getRepository( 'CacicCommonBundle:Rede' )->listarPorLocalADM(); | |
82 | - } | |
86 | + | |
83 | 87 | |
84 | 88 | $so = $this->getDoctrine()->getRepository( 'CacicCommonBundle:So' )->listar(); // Recupera a lista de SOs cadastrados |
85 | 89 | ... | ... |
src/Cacic/CommonBundle/Entity/AcaoExcecaoRepository.php
... | ... | @@ -73,15 +73,19 @@ class AcaoExcecaoRepository extends EntityRepository |
73 | 73 | { |
74 | 74 | foreach ( $novasExcecoes as $teNodeAddress ) |
75 | 75 | { |
76 | - $new = new AcaoExcecao(); | |
76 | + $new = $em->getRepository( 'CacicCommonBundle:AcaoExcecao' )->findOneBy( array('acao' => $acao, 'rede' => $rede) ); | |
77 | + if (empty($new)) { | |
78 | + $new = new AcaoExcecao(); | |
79 | + } | |
77 | 80 | $new->setAcao( $em->getRepository( 'CacicCommonBundle:Acao' )->find( $acao ) ); |
78 | 81 | $new->setRede( $em->getRepository( 'CacicCommonBundle:Rede' )->find( $rede ) ); |
79 | 82 | $new->setTeNodeAddress( $teNodeAddress ); |
80 | 83 | $em->persist( $new ); |
84 | + $em->flush(); | |
81 | 85 | } |
82 | 86 | } |
83 | 87 | |
84 | - $em->flush(); | |
88 | + | |
85 | 89 | } |
86 | 90 | |
87 | 91 | } |
88 | 92 | \ No newline at end of file | ... | ... |
src/Cacic/CommonBundle/Entity/AcaoRedeRepository.php
... | ... | @@ -25,8 +25,8 @@ class AcaoRedeRepository extends EntityRepository |
25 | 25 | $query = $this->createQueryBuilder('ar')->select('r.idRede', 'r.nmRede', 'r.teIpRede') |
26 | 26 | ->innerJoin('ar.acao', 'a') |
27 | 27 | ->innerJoin('ar.rede', 'r') |
28 | - ->where("a.idAcao = :idAcao") | |
29 | - ->setParameter('idAcao', $acao) | |
28 | + ->where("a.idAcao IN (:idAcao)") | |
29 | + ->setParameter('idAcao', array($acao)) | |
30 | 30 | ->orderBy('r.nmRede') |
31 | 31 | ->groupBy('r'); |
32 | 32 | ... | ... |
src/Cacic/CommonBundle/Entity/RedeRepository.php
... | ... | @@ -71,11 +71,11 @@ class RedeRepository extends EntityRepository |
71 | 71 | { |
72 | 72 | $_dql = "SELECT r |
73 | 73 | FROM CacicCommonBundle:Rede r |
74 | - WHERE r.idLocal = :idLocal"; | |
74 | + WHERE r.idLocal IN (:idLocal)"; | |
75 | 75 | |
76 | 76 | return $this->getEntityManager() |
77 | 77 | ->createQuery( $_dql ) |
78 | - ->setParameter( 'idLocal', $idLocal ) | |
78 | + ->setParameter( 'idLocal', array($idLocal) ) | |
79 | 79 | ->getArrayResult(); |
80 | 80 | } |
81 | 81 | public function listarPorLocalADM() | ... | ... |