Commit 350770d65cd3c5c351b3791f50d62c121f1699c6
Committed by
Eduardo Santos
1 parent
3b229ed6
Exists in
master
and in
1 other branch
Conserta pequenos bugs na coleta
Showing
3 changed files
with
20 additions
and
13 deletions
Show diff stats
app/config/config.yml
| ... | ... | @@ -16,11 +16,7 @@ framework: |
| 16 | 16 | default_locale: "%locale%" |
| 17 | 17 | # trusted_proxies: ~ |
| 18 | 18 | session: ~ |
| 19 | -<<<<<<< HEAD | |
| 20 | 19 | # session: |
| 21 | -======= | |
| 22 | -# session: | |
| 23 | ->>>>>>> 3231c12b96a54895b98ca370973d04235b4c924d | |
| 24 | 20 | # handler_id: session.handler.pdo |
| 25 | 21 | |
| 26 | 22 | parameters: | ... | ... |
src/Cacic/WSBundle/Controller/ColetaController.php
| ... | ... | @@ -644,19 +644,30 @@ class ColetaController extends Controller |
| 644 | 644 | $this->getDoctrine()->getManager()->persist($propriedadeSoftware); |
| 645 | 645 | $this->getDoctrine()->getManager()->flush(); |
| 646 | 646 | } else { |
| 647 | - // Adiciona referência à tabela de softwares | |
| 648 | - $softwareObject = $this->getDoctrine()->getRepository('CacicCommonBundle:Software')->find( $propriedadeSoftware->getSoftware()->getIdSoftware() ); | |
| 649 | 647 | |
| 650 | 648 | // Se não tiver nome coloco o ID Software no nome |
| 651 | 649 | if (empty($arrTagsNames['DisplayName'])) { |
| 652 | - $softwareObject->setNmSoftware($softwareName); | |
| 650 | + $nmSoftware = $softwareName; | |
| 653 | 651 | } else { |
| 654 | - $softwareObject->setNmSoftware($arrTagsNames['DisplayName']); | |
| 652 | + $nmSoftware = $arrTagsNames['DisplayName']; | |
| 655 | 653 | } |
| 656 | 654 | |
| 657 | - // Grava software recém inserido | |
| 658 | - $this->getDoctrine()->getManager()->persist($softwareObject); | |
| 659 | - //$this->getDoctrine()->getManager()->flush(); | |
| 655 | + // Adiciona referência à tabela de softwares | |
| 656 | + $softwareObject = $this->getDoctrine()->getRepository('CacicCommonBundle:Software')->findOneBy( array( 'nmSoftware' => $nmSoftware ) ); | |
| 657 | + | |
| 658 | + if (empty($softwareObject)) { | |
| 659 | + $softwareObject = new Software(); | |
| 660 | + // Se não tiver nome coloco o ID Software no nome | |
| 661 | + if (empty($arrTagsNames['DisplayName'])) { | |
| 662 | + $softwareObject->setNmSoftware($softwareName); | |
| 663 | + } else { | |
| 664 | + $softwareObject->setNmSoftware($arrTagsNames['DisplayName']); | |
| 665 | + } | |
| 666 | + | |
| 667 | + // Grava software recém inserido | |
| 668 | + $this->getDoctrine()->getManager()->persist($softwareObject); | |
| 669 | + $this->getDoctrine()->getManager()->flush(); | |
| 670 | + } | |
| 660 | 671 | |
| 661 | 672 | // Ajusta valores coletados |
| 662 | 673 | $propriedadeSoftware->setDisplayName($arrTagsNames['DisplayName']); | ... | ... |
src/Cacic/WSBundle/Controller/DefaultController.php
| ... | ... | @@ -73,7 +73,7 @@ class DefaultController extends Controller |
| 73 | 73 | $te_so = $request->get( 'te_so' ); |
| 74 | 74 | $ultimo_login = TagValueHelper::getValueFromTags( 'UserName' , $strComputerSystem); |
| 75 | 75 | $ip_computador = $request->get('te_ip_computador'); |
| 76 | - $ip_computador = !empty( $ip_computador ) ?: $_SERVER['REMOTE_ADDR']; | |
| 76 | + $ip_computador = !empty( $ip_computador ) ?: TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration ); | |
| 77 | 77 | |
| 78 | 78 | //vefifica se existe SO coletado se não, insere novo SO |
| 79 | 79 | $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->createIfNotExist( $te_so ); |
| ... | ... | @@ -150,7 +150,7 @@ class DefaultController extends Controller |
| 150 | 150 | $strNetworkAdapterConfiguration = OldCacicHelper::deCrypt( $request, $request->get('NetworkAdapterConfiguration') ); |
| 151 | 151 | $netmask = TagValueHelper::getValueFromTags( 'IPSubnet', $strNetworkAdapterConfiguration ); |
| 152 | 152 | $ip_computador = $request->get('te_ip_computador'); |
| 153 | - $ip_computador = !empty( $ip_computador ) ?: $_SERVER['REMOTE_ADDR']; | |
| 153 | + $ip_computador = !empty( $ip_computador ) ?: TagValueHelper::getValueFromTags( 'IPAddress', $strNetworkAdapterConfiguration ); | |
| 154 | 154 | |
| 155 | 155 | $te_node_adress = TagValueHelper::getValueFromTags( 'MACAddress', OldCacicHelper::deCrypt( $request, $request->get('NetworkAdapterConfiguration'))); |
| 156 | 156 | $so = $this->getDoctrine()->getRepository('CacicCommonBundle:So')->findOneBy( array('teSo'=>$request->get( 'te_so' ))); | ... | ... |