Commit ea927f39755b74ed19811f47b6a8a7f2a1b21964
Committed by
Eduardo Santos
Exists in
master
and in
1 other branch
Várias mudanças no relatório e coleta de software, otimizando consultas e remove…
…ndo entradas repetidas
Showing
13 changed files
with
398 additions
and
13 deletions
Show diff stats
src/Cacic/CommonBundle/DoctrineMigrations/Version20140424143235.php
0 → 100644
... | ... | @@ -0,0 +1,53 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace Cacic\CommonBundle\Migrations; | |
4 | + | |
5 | +use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |
6 | +use Symfony\Component\DependencyInjection\ContainerInterface; | |
7 | +use Doctrine\DBAL\Migrations\AbstractMigration; | |
8 | +use Doctrine\DBAL\Schema\Schema; | |
9 | + | |
10 | +/** | |
11 | + * Auto-generated Migration: Please modify to your needs! | |
12 | + */ | |
13 | +class Version20140424143235 extends AbstractMigration implements ContainerAwareInterface | |
14 | +{ | |
15 | + private $container; | |
16 | + | |
17 | + public function setContainer(ContainerInterface $container = null) | |
18 | + { | |
19 | + $this->container = $container; | |
20 | + } | |
21 | + | |
22 | + public function up(Schema $schema) | |
23 | + { | |
24 | + // this up() migration is auto-generated, please modify it to your needs | |
25 | + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql", "Migration can only be executed safely on 'postgresql'."); | |
26 | + | |
27 | + $logger = $this->container->get('logger'); | |
28 | + $rootDir = $this->container->get('kernel')->getRootDir(); | |
29 | + $upgrade1 = $rootDir."/../src/Cacic/CommonBundle/Resources/data/upgrade-3.0b4.sql"; | |
30 | + $upgradeSQL1 = file_get_contents($upgrade1); | |
31 | + $upgrade2 = $rootDir."/../src/Cacic/CommonBundle/Resources/data/upgrade-3.0b4-2.sql"; | |
32 | + $upgradeSQL2 = file_get_contents($upgrade2); | |
33 | + | |
34 | + $logger->debug("Arquivo de atualização: $upgrade1"); | |
35 | + | |
36 | + // Chama o container para executar o arquivo de atualização | |
37 | + // FIXME: Só funciona no PostgreSQL | |
38 | + $this->addSql($upgradeSQL1); | |
39 | + $this->addSql("SELECT upgrade()"); | |
40 | + | |
41 | + $logger->debug("Arquivo de atualização: $upgrade2"); | |
42 | + | |
43 | + $this->addSql($upgradeSQL2); | |
44 | + $this->addSql("SELECT upgrade()"); | |
45 | + | |
46 | + } | |
47 | + | |
48 | + public function down(Schema $schema) | |
49 | + { | |
50 | + // this down() migration is auto-generated, please modify it to your needs | |
51 | + | |
52 | + } | |
53 | +} | ... | ... |
src/Cacic/CommonBundle/DoctrineMigrations/Version20140424182701.php
0 → 100644
... | ... | @@ -0,0 +1,52 @@ |
1 | +<?php | |
2 | + | |
3 | +namespace Cacic\CommonBundle\Migrations; | |
4 | + | |
5 | +use Symfony\Component\DependencyInjection\ContainerAwareInterface; | |
6 | +use Symfony\Component\DependencyInjection\ContainerInterface; | |
7 | +use Doctrine\DBAL\Migrations\AbstractMigration; | |
8 | +use Doctrine\DBAL\Schema\Schema; | |
9 | + | |
10 | +/** | |
11 | + * Auto-generated Migration: Please modify to your needs! | |
12 | + */ | |
13 | +class Version20140424182701 extends AbstractMigration implements ContainerAwareInterface | |
14 | +{ | |
15 | + private $container; | |
16 | + | |
17 | + public function setContainer(ContainerInterface $container = null) | |
18 | + { | |
19 | + $this->container = $container; | |
20 | + } | |
21 | + | |
22 | + public function up(Schema $schema) | |
23 | + { | |
24 | + // this up() migration is auto-generated, please modify it to your needs | |
25 | + $this->abortIf($this->connection->getDatabasePlatform()->getName() != "postgresql", "Migration can only be executed safely on 'postgresql'."); | |
26 | + | |
27 | + $logger = $this->container->get('logger'); | |
28 | + $rootDir = $this->container->get('kernel')->getRootDir(); | |
29 | + $upgrade1 = $rootDir."/../src/Cacic/CommonBundle/Resources/data/upgrade-3.0b4-3.sql"; | |
30 | + $upgradeSQL1 = file_get_contents($upgrade1); | |
31 | + | |
32 | + // Altera o modelo de dados | |
33 | + $this->addSql("ALTER TABLE computador_coleta ADD dt_hr_inclusao TIMESTAMP(0) WITHOUT TIME ZONE"); | |
34 | + | |
35 | + $logger->debug("Arquivo de atualização: $upgrade1"); | |
36 | + | |
37 | + // Chama o container para executar o arquivo de atualização | |
38 | + // FIXME: Só funciona no PostgreSQL | |
39 | + $this->addSql($upgradeSQL1); | |
40 | + $this->addSql("SELECT upgrade()"); | |
41 | + | |
42 | + // Impede que o campo seja nulO | |
43 | + $this->addSql("ALTER TABLE computador_coleta ALTER COLUMN dt_hr_inclusao SET NOT NULL"); | |
44 | + | |
45 | + } | |
46 | + | |
47 | + public function down(Schema $schema) | |
48 | + { | |
49 | + // this down() migration is auto-generated, please modify it to your needs | |
50 | + | |
51 | + } | |
52 | +} | ... | ... |
src/Cacic/CommonBundle/Entity/ComputadorColeta.php
... | ... | @@ -135,4 +135,55 @@ class ComputadorColeta |
135 | 135 | { |
136 | 136 | return $this->classe; |
137 | 137 | } |
138 | + /** | |
139 | + * @var \DateTime | |
140 | + */ | |
141 | + private $dtHrInclusao; | |
142 | + | |
143 | + | |
144 | + /** | |
145 | + * Set dtHrInclusao | |
146 | + * | |
147 | + * @param \DateTime $dtHrInclusao | |
148 | + * @return ComputadorColeta | |
149 | + */ | |
150 | + public function setDtHrInclusao($dtHrInclusao) | |
151 | + { | |
152 | + $this->dtHrInclusao = $dtHrInclusao; | |
153 | + | |
154 | + return $this; | |
155 | + } | |
156 | + | |
157 | + /** | |
158 | + * Get dtHrInclusao | |
159 | + * | |
160 | + * @return \DateTime | |
161 | + */ | |
162 | + public function getDtHrInclusao() | |
163 | + { | |
164 | + return $this->dtHrInclusao; | |
165 | + } | |
166 | + | |
167 | + /** | |
168 | + * Set idClass | |
169 | + * | |
170 | + * @param \Cacic\CommonBundle\Entity\Classe $idClass | |
171 | + * @return ComputadorColeta | |
172 | + */ | |
173 | + public function setIdClass(\Cacic\CommonBundle\Entity\Classe $idClass = null) | |
174 | + { | |
175 | + $this->idClass = $idClass; | |
176 | + | |
177 | + return $this; | |
178 | + } | |
179 | + | |
180 | + /** | |
181 | + * Get idClass | |
182 | + * | |
183 | + * @return \Cacic\CommonBundle\Entity\Classe | |
184 | + */ | |
185 | + public function getIdClass() | |
186 | + { | |
187 | + return $this->idClass; | |
188 | + } | |
138 | 189 | } |
139 | 190 | \ No newline at end of file | ... | ... |
src/Cacic/CommonBundle/Entity/ComputadorColetaRepository.php
... | ... | @@ -147,14 +147,21 @@ class ComputadorColetaRepository extends EntityRepository |
147 | 147 | return $qb->getQuery()->execute(); |
148 | 148 | } |
149 | 149 | |
150 | - public function gerarRelatorioSoftware( $filtros, $software, $local ) | |
150 | + /** | |
151 | + * Relatório geral de softwares inventariados | |
152 | + * | |
153 | + * @param $filtros | |
154 | + * @param $software | |
155 | + * @param $local | |
156 | + * @return mixed | |
157 | + */ | |
158 | + | |
159 | + public function gerarRelatorioSoftware( $filtros, $software) | |
151 | 160 | { |
152 | 161 | $qb = $this->createQueryBuilder('coleta') |
153 | 162 | ->select('DISTINCT IDENTITY(coleta.computador), comp.nmComputador, comp.teNodeAddress, |
154 | - comp.teIpComputador, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal, max(hist.dtHrInclusao) as dtHrInclusao') | |
155 | - ->innerJoin('CacicCommonBundle:ComputadorColetaHistorico','hist', 'WITH', 'coleta.idComputadorColeta = hist.computadorColeta') | |
163 | + comp.teIpComputador, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal, max(coleta.dtHrInclusao) as dtHrInclusao') | |
156 | 164 | ->innerJoin('coleta.classProperty', 'property') |
157 | - ->innerJoin('property.idClass', 'classe') | |
158 | 165 | ->innerJoin('coleta.computador', 'comp') |
159 | 166 | ->innerJoin('comp.idSo', 'so') |
160 | 167 | ->innerJoin('comp.idRede', 'rede') |
... | ... | @@ -164,14 +171,15 @@ class ComputadorColetaRepository extends EntityRepository |
164 | 171 | ->andWhere('soft.nmSoftware = :software') |
165 | 172 | ->groupBy('coleta.computador, comp.nmComputador, comp.teNodeAddress, |
166 | 173 | comp.teIpComputador, so.inMswindows, so.sgSo, rede.idRede, rede.nmRede, rede.teIpRede, local.nmLocal') |
174 | + ->orderBy('coleta.computador, local.nmLocal, rede.teIpRede') | |
167 | 175 | ->setParameter('software', $software); |
168 | 176 | |
169 | 177 | /** |
170 | 178 | * Verifica os filtros |
171 | 179 | */ |
172 | 180 | |
173 | - if ( array_key_exists('local', $filtros) && !empty($filtros['local']) ) | |
174 | - $qb->andWhere('local.idLocal IN (:locais)')->setParameter('locais', explode( ',', $filtros['locais'] )); | |
181 | + if ( array_key_exists('locais', $filtros) && !empty($filtros['locais']) ) | |
182 | + $qb->andWhere('local.nmLocal IN (:locais)')->setParameter('locais', explode( ',', $filtros['locais'] )); | |
175 | 183 | |
176 | 184 | if ( array_key_exists('redes', $filtros) && !empty($filtros['redes']) ) |
177 | 185 | $qb->andWhere('rede.idRede IN (:redes)')->setParameter('redes', explode( ',', $filtros['redes'] )); |
... | ... | @@ -180,13 +188,53 @@ class ComputadorColetaRepository extends EntityRepository |
180 | 188 | $qb->andWhere('comp.idSo IN (:so)')->setParameter('so', explode( ',', $filtros['so'] )); |
181 | 189 | |
182 | 190 | if ( array_key_exists('conf', $filtros) && !empty($filtros['conf']) ) |
183 | - $qb->andWhere('property.idClassProperty IN (:conf)')->setParameter('conf', explode( ',', $filtros['conf'] )); | |
191 | + $qb->andWhere('soft.idSoftware IN (:conf)')->setParameter('conf', explode( ',', $filtros['conf'] )); | |
184 | 192 | |
185 | 193 | |
186 | 194 | return $qb->getQuery()->execute(); |
187 | 195 | } |
188 | 196 | |
189 | 197 | /** |
198 | + * Gera relatório de softwares inventariados | |
199 | + * | |
200 | + * @param $filtros | |
201 | + * @return mixed | |
202 | + */ | |
203 | + | |
204 | + public function gerarRelatorioSoftwaresInventariados( $filtros) | |
205 | + { | |
206 | + $qb = $this->createQueryBuilder('coleta') | |
207 | + ->select('soft.nmSoftware', 'rede.idRede', 'rede.nmRede', 'rede.teIpRede', 'local.nmLocal','COUNT(DISTINCT coleta.computador) AS numComp') | |
208 | + ->innerJoin('coleta.classProperty', 'property') | |
209 | + ->innerJoin('property.idClass', 'classe') | |
210 | + ->innerJoin('coleta.computador', 'comp') | |
211 | + ->innerJoin('comp.idSo', 'so') | |
212 | + ->innerJoin('comp.idRede', 'rede') | |
213 | + ->innerJoin('rede.idLocal', 'local') | |
214 | + ->innerJoin('CacicCommonBundle:PropriedadeSoftware', 'prop', 'WITH', 'prop.classProperty = coleta.classProperty') | |
215 | + ->innerJoin('prop.software', 'soft') | |
216 | + ->groupBy('soft.nmSoftware', 'rede.idRede', 'rede.nmRede', 'rede.teIpRede', 'local.nmLocal'); | |
217 | + | |
218 | + /** | |
219 | + * Verifica os filtros | |
220 | + */ | |
221 | + | |
222 | + if ( array_key_exists('softwares', $filtros) && !empty($filtros['softwares']) ) | |
223 | + $qb->andWhere('soft.idSoftware IN (:softwares)')->setParameter('softwares', explode( ',', $filtros['softwares'] )); | |
224 | + | |
225 | + if ( array_key_exists('local', $filtros) && !empty($filtros['local']) ) | |
226 | + $qb->andWhere('local.idLocal IN (:locais)')->setParameter('locais', explode( ',', $filtros['locais'] )); | |
227 | + | |
228 | + if ( array_key_exists('redes', $filtros) && !empty($filtros['redes']) ) | |
229 | + $qb->andWhere('rede.idRede IN (:redes)')->setParameter('redes', explode( ',', $filtros['redes'] )); | |
230 | + | |
231 | + if ( array_key_exists('so', $filtros) && !empty($filtros['so']) ) | |
232 | + $qb->andWhere('comp.idSo IN (:so)')->setParameter('so', explode( ',', $filtros['so'] )); | |
233 | + | |
234 | + return $qb->getQuery()->execute(); | |
235 | + } | |
236 | + | |
237 | + /** | |
190 | 238 | * |
191 | 239 | * Gera relatório de propriedades WMI coletadas dos computadores detalhado |
192 | 240 | * | ... | ... |
src/Cacic/CommonBundle/Entity/SoftwareRepository.php
... | ... | @@ -42,11 +42,11 @@ class SoftwareRepository extends EntityRepository |
42 | 42 | public function listarSoftware() |
43 | 43 | { |
44 | 44 | $qb = $this->createQueryBuilder('sw') |
45 | - ->select('sw.nmSoftware','class.idClassProperty') | |
45 | + ->select('sw.nmSoftware','sw.idSoftware') | |
46 | 46 | ->innerJoin('CacicCommonBundle:PropriedadeSoftware', 'prop', 'WITH', 'sw.idSoftware = prop.software') |
47 | 47 | ->innerJoin('CacicCommonBundle:ClassProperty', 'class','WITH', 'prop.classProperty = class.idClassProperty') |
48 | - ->groupBy('sw.nmSoftware,class.idClassProperty, class.nmPropertyName') | |
49 | - ->orderBy(' sw.nmSoftware'); | |
48 | + ->groupBy('sw.nmSoftware, sw.idSoftware') | |
49 | + ->orderBy('sw.nmSoftware'); | |
50 | 50 | |
51 | 51 | return $qb->getQuery()->execute(); |
52 | 52 | } |
... | ... | @@ -108,7 +108,7 @@ class SoftwareRepository extends EntityRepository |
108 | 108 | ->innerJoin('CacicCommonBundle:ComputadorColeta', 'col', 'WITH', 'col.computador = prop.computador') |
109 | 109 | ->innerJoin('CacicCommonBundle:Computador', 'comp', 'WITH', 'col.computador = comp.idComputador') |
110 | 110 | ->innerJoin('comp.idRede','r') |
111 | - ->leftJoin('r.idLocal', 'l') | |
111 | + ->innerJoin('r.idLocal', 'l') | |
112 | 112 | ->groupBy('sw.nmSoftware, r.idRede, r.nmRede, r.teIpRede, l.nmLocal') |
113 | 113 | ->orderBy('sw.nmSoftware, l.nmLocal'); |
114 | 114 | ... | ... |
src/Cacic/CommonBundle/Resources/config/doctrine/ComputadorColeta.orm.yml
... | ... | @@ -15,6 +15,10 @@ Cacic\CommonBundle\Entity\ComputadorColeta: |
15 | 15 | type: text |
16 | 16 | nullable: false |
17 | 17 | column: te_class_property_value |
18 | + dtHrInclusao: | |
19 | + type: datetime | |
20 | + nullable: false | |
21 | + column: dt_hr_inclusao | |
18 | 22 | manyToOne: |
19 | 23 | computador: |
20 | 24 | targetEntity: Computador | ... | ... |
src/Cacic/CommonBundle/Resources/config/doctrine/Software.orm.yml
src/Cacic/CommonBundle/Resources/data/upgrade-3.0b4-2.sql
0 → 100644
... | ... | @@ -0,0 +1,66 @@ |
1 | +CREATE OR REPLACE FUNCTION upgrade() RETURNS VOID AS $$ | |
2 | + DECLARE | |
3 | + | |
4 | + soft record; | |
5 | + nm integer; | |
6 | + atualiza record; | |
7 | + comp integer; | |
8 | + | |
9 | + BEGIN | |
10 | + | |
11 | + FOR soft IN select sw.nm_software, count(distinct sw.id_software) as n_repeticoes | |
12 | + from software sw | |
13 | + group by sw.nm_software | |
14 | + having count(distinct sw.id_software) > 1 | |
15 | + order by count(distinct sw.id_software) desc LOOP | |
16 | + | |
17 | + RAISE NOTICE 'O seguinte software possui entradas repetidas: %',soft.nm_software; | |
18 | + | |
19 | + -- Escolhe um software para colocar em todos | |
20 | + SELECT DISTINCT id_software INTO nm | |
21 | + FROM software | |
22 | + WHERE nm_software = soft.nm_software | |
23 | + ORDER BY id_software asc | |
24 | + LIMIT 1; | |
25 | + | |
26 | + -- Atualiza o valor de todas as entradas na tabela para o primeiro valor | |
27 | + FOR atualiza IN select distinct pr.id_propriedade_software, pr.id_class_property, pr.id_software, aq.id_software | |
28 | + from software st | |
29 | + inner join proriedade_software pr on st.id_software = pr.id_software | |
30 | + left join aquisicao_item aq on st.id_software = aq.id_software | |
31 | + where st.nm_software = soft.nm_software | |
32 | + and st.id_software <> nm LOOP | |
33 | + | |
34 | + RAISE NOTICE 'Removendo propriedade = % com o software = %',atualiza.id_class_property,nm; | |
35 | + | |
36 | + DELETE FROM proriedade_software | |
37 | + WHERE id_class_property = atualiza.id_class_property; | |
38 | + | |
39 | + DELETE FROM computador_coleta_historico | |
40 | + WHERE id_class_property = atualiza.id_class_property; | |
41 | + | |
42 | + DELETE FROM computador_coleta | |
43 | + WHERE id_class_property = atualiza.id_class_property; | |
44 | + | |
45 | + DELETE FROM class_property | |
46 | + WHERE id_class_property = atualiza.id_class_property; | |
47 | + | |
48 | + IF atualiza.id_software IS NOT NULL THEN | |
49 | + DELETE FROM aquisicao_item | |
50 | + WHERE id_software = atualiza.id_software; | |
51 | + END IF; | |
52 | + | |
53 | + DELETE FROM software | |
54 | + WHERE id_software = atualiza.id_software; | |
55 | + | |
56 | + RAISE NOTICE 'Software = % com o nome = % foi removido com sucesso',atualiza.id_software,soft.nm_software; | |
57 | + | |
58 | + END LOOP; | |
59 | + | |
60 | + END LOOP; | |
61 | + | |
62 | + RETURN; | |
63 | + | |
64 | + END; | |
65 | + | |
66 | +$$ LANGUAGE 'plpgsql'; | |
0 | 67 | \ No newline at end of file | ... | ... |
src/Cacic/CommonBundle/Resources/data/upgrade-3.0b4-3.sql
0 → 100644
... | ... | @@ -0,0 +1,25 @@ |
1 | +CREATE OR REPLACE FUNCTION upgrade() RETURNS VOID AS $$ | |
2 | + DECLARE | |
3 | + | |
4 | + comp record; | |
5 | + | |
6 | + BEGIN | |
7 | + | |
8 | + FOR comp IN select c.id_computador_coleta, max(h.dt_hr_inclusao) as dt_hr_inclusao | |
9 | + from computador_coleta c | |
10 | + inner join computador_coleta_historico h on (c.id_computador_coleta = h.id_computador_coleta) | |
11 | + group by c.id_computador_coleta LOOP | |
12 | + | |
13 | + RAISE NOTICE 'Atualizando computador coleta id = %',comp.id_computador_coleta; | |
14 | + | |
15 | + UPDATE computador_coleta | |
16 | + SET dt_hr_inclusao = comp.dt_hr_inclusao | |
17 | + WHERE id_computador_coleta = comp.id_computador_coleta; | |
18 | + | |
19 | + END LOOP; | |
20 | + | |
21 | + RETURN; | |
22 | + | |
23 | + END; | |
24 | + | |
25 | +$$ LANGUAGE 'plpgsql'; | |
0 | 26 | \ No newline at end of file | ... | ... |
... | ... | @@ -0,0 +1,81 @@ |
1 | +CREATE OR REPLACE FUNCTION upgrade() RETURNS VOID AS $$ | |
2 | + DECLARE | |
3 | + | |
4 | + soft record; | |
5 | + nm integer; | |
6 | + atualiza record; | |
7 | + comp integer; | |
8 | + | |
9 | + BEGIN | |
10 | + | |
11 | + FOR soft IN select sw.nm_software, count(distinct prop.id_software) as n_repeticoes | |
12 | + from software sw | |
13 | + inner join proriedade_software prop on sw.id_software = prop.id_software | |
14 | + group by sw.nm_software | |
15 | + having count(distinct prop.id_software) > 1 | |
16 | + order by count(distinct prop.id_software) desc LOOP | |
17 | + | |
18 | + RAISE NOTICE 'O seguinte software possui entradas repetidas: %',soft.nm_software; | |
19 | + | |
20 | + -- Escolhe um software para colocar em todos | |
21 | + SELECT DISTINCT id_software INTO nm | |
22 | + FROM software | |
23 | + WHERE nm_software = soft.nm_software | |
24 | + ORDER BY id_software asc | |
25 | + LIMIT 1; | |
26 | + | |
27 | + -- Atualiza o valor de todas as entradas na tabela para o primeiro valor | |
28 | + FOR atualiza IN select distinct pr.id_propriedade_software | |
29 | + from software st | |
30 | + inner join proriedade_software pr on st.id_software = pr.id_software | |
31 | + where st.nm_software = soft.nm_software LOOP | |
32 | + | |
33 | + | |
34 | + RAISE NOTICE 'Atualizando o valor da propriedade = % com o software = %',atualiza.id_propriedade_software,nm; | |
35 | + | |
36 | + BEGIN | |
37 | + | |
38 | + UPDATE proriedade_software | |
39 | + SET id_software = nm | |
40 | + WHERE id_propriedade_software = atualiza.id_propriedade_software; | |
41 | + | |
42 | + EXCEPTION WHEN OTHERS THEN | |
43 | + | |
44 | + RAISE NOTICE 'ERRO!!!! Provavelmente a coleta estava repetida'; | |
45 | + | |
46 | + END; | |
47 | + | |
48 | + END LOOP ; | |
49 | + | |
50 | + END LOOP; | |
51 | + | |
52 | + -- Finalmente limpa todos os softwares sem coleta | |
53 | + | |
54 | + FOR soft IN select distinct sw.id_software | |
55 | + from software sw | |
56 | + left join proriedade_software prop on sw.id_software = prop.id_software | |
57 | + left join aquisicao_item aq on sw.id_software = aq.id_software | |
58 | + where prop.id_software is null | |
59 | + and aq.id_software is null LOOP | |
60 | + | |
61 | + RAISE NOTICE 'Removendo software = %',soft.id_software; | |
62 | + | |
63 | + BEGIN | |
64 | + | |
65 | + DELETE FROM software | |
66 | + WHERE id_software = soft.id_software; | |
67 | + | |
68 | + EXCEPTION WHEN OTHERS THEN | |
69 | + | |
70 | + RAISE NOTICE 'Erro na exclusão do software %',soft.id_software; | |
71 | + | |
72 | + END ; | |
73 | + | |
74 | + END LOOP ; | |
75 | + | |
76 | + | |
77 | + RETURN; | |
78 | + | |
79 | + END; | |
80 | + | |
81 | +$$ LANGUAGE 'plpgsql'; | |
0 | 82 | \ No newline at end of file | ... | ... |
src/Cacic/RelatorioBundle/Controller/SoftwareController.php
... | ... | @@ -39,7 +39,7 @@ class SoftwareController extends Controller |
39 | 39 | { |
40 | 40 | $locale = $request->getLocale(); |
41 | 41 | $dados = $this->getDoctrine() |
42 | - ->getRepository('CacicCommonBundle:Software') | |
42 | + ->getRepository('CacicCommonBundle:ComputadorColeta') | |
43 | 43 | ->gerarRelatorioSoftwaresInventariados( $request->get('rel_filtro_software') ); |
44 | 44 | |
45 | 45 | return $this->render( | ... | ... |
src/Cacic/RelatorioBundle/Resources/views/Software/inventariados_filtro.html.twig
... | ... | @@ -21,7 +21,7 @@ |
21 | 21 | |
22 | 22 | tSW.populate([ // Popula o TRANSFER com Softwares |
23 | 23 | {% for sw in softwares %} |
24 | - {value: "{{ sw['idClassProperty'] }}", content:"{{ sw['nmSoftware'] }}"}{% if loop.last != true %},{% endif %} | |
24 | + {value: "{{ sw['idSoftware'] }}", content:"{{ sw['nmSoftware'] }}"}{% if loop.last != true %},{% endif %} | |
25 | 25 | |
26 | 26 | {% endfor %} |
27 | 27 | ]); | ... | ... |
src/Cacic/WSBundle/Controller/ColetaController.php
... | ... | @@ -197,6 +197,7 @@ class ColetaController extends Controller |
197 | 197 | // Armazena no banco o objeto |
198 | 198 | $computadorColeta->setClassProperty($classPropertyObject); |
199 | 199 | $computadorColeta->setTeClassPropertyValue($classProperty); |
200 | + $computadorColeta->setDtHrInclusao( new \DateTime() ); | |
200 | 201 | |
201 | 202 | // Mando salvar os dados do computador |
202 | 203 | $this->getDoctrine()->getManager()->persist( $computadorColeta ); |
... | ... | @@ -226,6 +227,7 @@ class ColetaController extends Controller |
226 | 227 | // Armazena no banco o objeto |
227 | 228 | $computadorColeta->setClassProperty($classPropertyObject); |
228 | 229 | $computadorColeta->setTeClassPropertyValue($classProperty); |
230 | + $computadorColeta->setDtHrInclusao( new \DateTime() ); | |
229 | 231 | |
230 | 232 | // Mando salvar os dados do computador |
231 | 233 | $this->getDoctrine()->getManager()->persist( $computadorColeta ); | ... | ... |