Commit e4dce6485810fbc972db49922b5ab337fffa7962

Authored by Ezequiel Lafuente
1 parent c4108ece
Exists in master and in 1 other branch desenv

Ajustes na pesquisa de processos, agora ela pesquisa sem restrições a acentos e caracteres especiais

controlador_ws.php
@@ -578,14 +578,14 @@ $app->group('/api/v1',function(){ @@ -578,14 +578,14 @@ $app->group('/api/v1',function(){
578 $this->get('/tipo/listar', function($request, $response, $args){ 578 $this->get('/tipo/listar', function($request, $response, $args){
579 /** @var $request Slim\Http\Request */ 579 /** @var $request Slim\Http\Request */
580 $rn = new MdWsSeiProcedimentoRN(); 580 $rn = new MdWsSeiProcedimentoRN();
581 - $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO(); 581 + $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO();
582 $objGetMdWsSeiTipoProcedimentoDTO->setNumIdTipoProcedimento($request->getParam('id')); 582 $objGetMdWsSeiTipoProcedimentoDTO->setNumIdTipoProcedimento($request->getParam('id'));
583 $objGetMdWsSeiTipoProcedimentoDTO->setStrNome($request->getParam('filter')); 583 $objGetMdWsSeiTipoProcedimentoDTO->setStrNome($request->getParam('filter'));
584 // $objGetMdWsSeiTipoProcedimentoDTO->setStrSinInterno($request->getParam('internos')); 584 // $objGetMdWsSeiTipoProcedimentoDTO->setStrSinInterno($request->getParam('internos'));
585 $objGetMdWsSeiTipoProcedimentoDTO->setStrFavoritos($request->getParam('favoritos')); 585 $objGetMdWsSeiTipoProcedimentoDTO->setStrFavoritos($request->getParam('favoritos'));
586 $objGetMdWsSeiTipoProcedimentoDTO->setNumStart($request->getParam('start')); 586 $objGetMdWsSeiTipoProcedimentoDTO->setNumStart($request->getParam('start'));
587 $objGetMdWsSeiTipoProcedimentoDTO->setNumLimit($request->getParam('limit')); 587 $objGetMdWsSeiTipoProcedimentoDTO->setNumLimit($request->getParam('limit'));
588 - 588 +
589 return $response->withJSON( 589 return $response->withJSON(
590 $rn->listarTipoProcedimento($objGetMdWsSeiTipoProcedimentoDTO) 590 $rn->listarTipoProcedimento($objGetMdWsSeiTipoProcedimentoDTO)
591 ); 591 );
rn/MdWsSeiProcedimentoRN.php
@@ -90,10 +90,16 @@ class MdWsSeiProcedimentoRN extends InfraRN @@ -90,10 +90,16 @@ class MdWsSeiProcedimentoRN extends InfraRN
90 //FILTRA NOME, ID e INTERNO 90 //FILTRA NOME, ID e INTERNO
91 if($arrObjTipoProcedimentoDTO){ 91 if($arrObjTipoProcedimentoDTO){
92 foreach ($arrObjTipoProcedimentoDTO as $aux) { 92 foreach ($arrObjTipoProcedimentoDTO as $aux) {
  93 +
  94 + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br
  95 +
  96 + $objDtoFormatado = strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $aux->getStrNome()));
  97 + $nomeFormatado = str_replace('?','',strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $nome)));
  98 +
93 if( 99 if(
94 ($aux->getNumIdTipoProcedimento() == $id || !$id) 100 ($aux->getNumIdTipoProcedimento() == $id || !$id)
95 && 101 &&
96 - (($nome && strpos($aux->getStrNome(), $nome) !== false) || !$nome) 102 + (($nome && strpos($objDtoFormatado, $nomeFormatado) !== false) || !$nomeFormatado)
97 // && 103 // &&
98 // ($aux->getStrSinInterno() == $interno || !$interno) 104 // ($aux->getStrSinInterno() == $interno || !$interno)
99 ){ 105 ){
@@ -127,12 +133,16 @@ class MdWsSeiProcedimentoRN extends InfraRN @@ -127,12 +133,16 @@ class MdWsSeiProcedimentoRN extends InfraRN
127 } 133 }
128 } 134 }
129 135
130 - if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1));  
131 - if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit));  
132 -  
133 $total = 0; 136 $total = 0;
134 $total = count($arrayRetorno); 137 $total = count($arrayRetorno);
135 - 138 +
  139 + if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1));
  140 + if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit));
  141 +
  142 +
  143 + /*$total = 0;
  144 + $total = count($arrayRetorno);*/
  145 +
136 return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); 146 return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total);
137 } catch (Exception $e) { 147 } catch (Exception $e) {
138 return MdWsSeiRest::formataRetornoErroREST($e); 148 return MdWsSeiRest::formataRetornoErroREST($e);