Commit e4dce6485810fbc972db49922b5ab337fffa7962
1 parent
c4108ece
Exists in
master
and in
1 other branch
Ajustes na pesquisa de processos, agora ela pesquisa sem restrições a acentos e caracteres especiais
Showing
2 changed files
with
17 additions
and
7 deletions
Show diff stats
controlador_ws.php
| ... | ... | @@ -578,14 +578,14 @@ $app->group('/api/v1',function(){ |
| 578 | 578 | $this->get('/tipo/listar', function($request, $response, $args){ |
| 579 | 579 | /** @var $request Slim\Http\Request */ |
| 580 | 580 | $rn = new MdWsSeiProcedimentoRN(); |
| 581 | - $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO(); | |
| 581 | + $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO(); | |
| 582 | 582 | $objGetMdWsSeiTipoProcedimentoDTO->setNumIdTipoProcedimento($request->getParam('id')); |
| 583 | 583 | $objGetMdWsSeiTipoProcedimentoDTO->setStrNome($request->getParam('filter')); |
| 584 | 584 | // $objGetMdWsSeiTipoProcedimentoDTO->setStrSinInterno($request->getParam('internos')); |
| 585 | 585 | $objGetMdWsSeiTipoProcedimentoDTO->setStrFavoritos($request->getParam('favoritos')); |
| 586 | 586 | $objGetMdWsSeiTipoProcedimentoDTO->setNumStart($request->getParam('start')); |
| 587 | 587 | $objGetMdWsSeiTipoProcedimentoDTO->setNumLimit($request->getParam('limit')); |
| 588 | - | |
| 588 | + | |
| 589 | 589 | return $response->withJSON( |
| 590 | 590 | $rn->listarTipoProcedimento($objGetMdWsSeiTipoProcedimentoDTO) |
| 591 | 591 | ); | ... | ... |
rn/MdWsSeiProcedimentoRN.php
| ... | ... | @@ -90,10 +90,16 @@ class MdWsSeiProcedimentoRN extends InfraRN |
| 90 | 90 | //FILTRA NOME, ID e INTERNO |
| 91 | 91 | if($arrObjTipoProcedimentoDTO){ |
| 92 | 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 | 99 | if( |
| 94 | 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 | 104 | // ($aux->getStrSinInterno() == $interno || !$interno) |
| 99 | 105 | ){ |
| ... | ... | @@ -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 | 136 | $total = 0; |
| 134 | 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 | 146 | return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); |
| 137 | 147 | } catch (Exception $e) { |
| 138 | 148 | return MdWsSeiRest::formataRetornoErroREST($e); | ... | ... |