Commit 71bb5e7836caf8ffdd8bd91b746fc2810639b805
1 parent
20ddb4ed
Exists in
master
and in
1 other branch
Correções feitas no retorno da pesquisa de documentos
Showing
3 changed files
with
22 additions
and
29 deletions
Show diff stats
controlador_ws.php
... | ... | @@ -293,8 +293,7 @@ $app->group('/api/v1',function(){ |
293 | 293 | $request->getParam('usuario') |
294 | 294 | )); |
295 | 295 | }); |
296 | - | |
297 | - $this->post('/externo/alterar', function($request, $response, $args){ | |
296 | + $this->post('/externo/alterar', function($request, $response, $args){ | |
298 | 297 | /** @var $request Slim\Http\Request */ |
299 | 298 | $dados["documento"] = $request->getParam('documento'); |
300 | 299 | $dados["numero"] = $request->getParam('numero'); |
... | ... | @@ -325,8 +324,7 @@ $app->group('/api/v1',function(){ |
325 | 324 | $rn->alterarDocumentoExterno($dados) |
326 | 325 | ); |
327 | 326 | }); |
328 | - | |
329 | - $this->post('/interno/alterar', function($request, $response, $args){ | |
327 | + $this->post('/interno/alterar', function($request, $response, $args){ | |
330 | 328 | /** @var $request Slim\Http\Request */ |
331 | 329 | $dados["documento"] = $request->getParam('documento'); |
332 | 330 | $dados["assuntos"] = json_decode($request->getParam('assuntos'), TRUE); |
... | ... | @@ -344,7 +342,6 @@ $app->group('/api/v1',function(){ |
344 | 342 | $rn->alterarDocumentoInterno($dados) |
345 | 343 | ); |
346 | 344 | }); |
347 | - | |
348 | 345 | $this->post('/secao/alterar', function($request, $response, $args){ |
349 | 346 | /** @var $request Slim\Http\Request */ |
350 | 347 | $dados["documento"] = $request->getParam('documento'); |
... | ... | @@ -356,8 +353,6 @@ $app->group('/api/v1',function(){ |
356 | 353 | $rn->alterarSecaoDocumento($dados) |
357 | 354 | ); |
358 | 355 | }); |
359 | - | |
360 | - | |
361 | 356 | $this->post('/ciencia', function($request, $response, $args){ |
362 | 357 | /** @var $request Slim\Http\Request */ |
363 | 358 | $rn = new MdWsSeiDocumentoRN(); |
... | ... | @@ -394,8 +389,6 @@ $app->group('/api/v1',function(){ |
394 | 389 | } |
395 | 390 | return $response->withJSON($rn->listarDocumentosProcesso($dto)); |
396 | 391 | }); |
397 | - | |
398 | - | |
399 | 392 | $this->get('/secao/listar', function($request, $response, $args){ |
400 | 393 | /** @var $request Slim\Http\Request */ |
401 | 394 | $rn = new MdWsSeiDocumentoRN(); |
... | ... | @@ -404,16 +397,15 @@ $app->group('/api/v1',function(){ |
404 | 397 | |
405 | 398 | return $response->withJSON($rn->listarSecaoDocumento($dto)); |
406 | 399 | }); |
407 | - | |
408 | 400 | $this->get('/tipo/pesquisar', function($request, $response, $args){ |
409 | 401 | /** @var $request Slim\Http\Request */ |
410 | 402 | $rn = new MdWsSeiDocumentoRN(); |
411 | - | |
412 | 403 | $dto = new MdWsSeiDocumentoDTO(); |
404 | + | |
413 | 405 | $dto->setNumIdTipoDocumento($request->getParam('id')); |
414 | 406 | $dto->setStrNomeTipoDocumento($request->getParam('filter')); |
415 | 407 | $dto->setStrFavoritos($request->getParam('favoritos')); |
416 | - | |
408 | + | |
417 | 409 | $arrAplicabilidade = explode(",",$request->getParam('aplicabilidade')); |
418 | 410 | |
419 | 411 | $dto->setArrAplicabilidade($arrAplicabilidade); |
... | ... | @@ -422,9 +414,7 @@ $app->group('/api/v1',function(){ |
422 | 414 | |
423 | 415 | return $response->withJSON($rn->pesquisarTipoDocumento($dto)); |
424 | 416 | }); |
425 | - | |
426 | - | |
427 | - $this->get('/tipo/template', function($request, $response, $args){ | |
417 | + $this->get('/tipo/template', function($request, $response, $args){ | |
428 | 418 | /** @var $request Slim\Http\Request */ |
429 | 419 | $rn = new MdWsSeiDocumentoRN(); |
430 | 420 | $dto = new MdWsSeiDocumentoDTO(); |
... | ... | @@ -433,8 +423,6 @@ $app->group('/api/v1',function(){ |
433 | 423 | |
434 | 424 | return $response->withJSON($rn->pesquisarTemplateDocumento($dto)); |
435 | 425 | }); |
436 | - | |
437 | - | |
438 | 426 | $this->get('/baixar/anexo/{protocolo}', function($request, $response, $args){ |
439 | 427 | /** @var $request Slim\Http\Request */ |
440 | 428 | $rn = new MdWsSeiDocumentoRN(); |
... | ... | @@ -444,8 +432,6 @@ $app->group('/api/v1',function(){ |
444 | 432 | } |
445 | 433 | return $response->withJSON($rn->downloadAnexo($dto)); |
446 | 434 | }); |
447 | - | |
448 | - | |
449 | 435 | $this->post('/interno/criar', function($request, $response, $args){ |
450 | 436 | |
451 | 437 | /** @var $request Slim\Http\Request */ |
... | ... | @@ -466,8 +452,7 @@ $app->group('/api/v1',function(){ |
466 | 452 | return $response->withJSON( |
467 | 453 | $rn->documentoInternoCriar($dto) |
468 | 454 | ); |
469 | - }); | |
470 | - | |
455 | + }); | |
471 | 456 | $this->post('/externo/criar', function($request, $response, $args){ |
472 | 457 | |
473 | 458 | /** @var $request Slim\Http\Request */ |
... | ... | @@ -497,8 +482,7 @@ $app->group('/api/v1',function(){ |
497 | 482 | return $response->withJSON( |
498 | 483 | $rn->documentoExternoCriar($dto) |
499 | 484 | ); |
500 | - }); | |
501 | - | |
485 | + }); | |
502 | 486 | $this->post('/incluir', function($request, $response, $args){ |
503 | 487 | try{ |
504 | 488 | /** @var $request Slim\Http\Request */ |
... | ... | @@ -578,6 +562,7 @@ $app->group('/api/v1',function(){ |
578 | 562 | $this->get('/tipo/listar', function($request, $response, $args){ |
579 | 563 | /** @var $request Slim\Http\Request */ |
580 | 564 | $rn = new MdWsSeiProcedimentoRN(); |
565 | + | |
581 | 566 | $objGetMdWsSeiTipoProcedimentoDTO = new MdWsSeiTipoProcedimentoDTO(); |
582 | 567 | $objGetMdWsSeiTipoProcedimentoDTO->setNumIdTipoProcedimento($request->getParam('id')); |
583 | 568 | $objGetMdWsSeiTipoProcedimentoDTO->setStrNome($request->getParam('filter')); | ... | ... |
rn/MdWsSeiDocumentoRN.php
... | ... | @@ -156,9 +156,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
156 | 156 | //FILTRA NOME, ID e APLICABILIDADE |
157 | 157 | if ($arrObjSerieDTO) { |
158 | 158 | foreach ($arrObjSerieDTO as $aux) { |
159 | + | |
160 | + setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br | |
161 | + | |
162 | + $objDtoFormatado = str_replace('?','',strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $aux->getStrNome()))); | |
163 | + $nomeFormatado = str_replace('?','',strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $nome))); | |
164 | + | |
159 | 165 | if ( |
160 | 166 | ($aux->getNumIdSerie() == $id || !$id) && |
161 | - (($nome && strpos(utf8_encode($aux->getStrNome()), $nome) !== false) || !$nome) && | |
167 | + (($nomeFormatado && strpos(utf8_encode($objDtoFormatado), $nomeFormatado) !== false) || !$nomeFormatado) && | |
162 | 168 | (in_array($aux->getStrStaAplicabilidade(), $aplicabilidade) == $aplicabilidade || !$aplicabilidade) |
163 | 169 | ) { |
164 | 170 | $arrayRetorno[] = array( |
... | ... | @@ -169,14 +175,15 @@ class MdWsSeiDocumentoRN extends DocumentoRN { |
169 | 175 | } |
170 | 176 | } |
171 | 177 | |
178 | + $total = 0; | |
179 | + $total = count($arrayRetorno); | |
180 | + | |
181 | + | |
172 | 182 | if ($start) |
173 | 183 | $arrayRetorno = array_slice($arrayRetorno, ($start - 1)); |
174 | 184 | if ($limit) |
175 | 185 | $arrayRetorno = array_slice($arrayRetorno, 0, ($limit)); |
176 | 186 | |
177 | - $total = 0; | |
178 | - $total = count($arrayRetorno); | |
179 | - | |
180 | 187 | return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); |
181 | 188 | } catch (Exception $e) { |
182 | 189 | return MdWsSeiRest::formataRetornoErroREST($e); | ... | ... |
rn/MdWsSeiProcedimentoRN.php
... | ... | @@ -72,7 +72,8 @@ class MdWsSeiProcedimentoRN extends InfraRN |
72 | 72 | $favoritos = $objGetMdWsSeiTipoProcedimentoDTO->getStrFavoritos(); |
73 | 73 | $start = $objGetMdWsSeiTipoProcedimentoDTO->getNumStart(); |
74 | 74 | $limit = $objGetMdWsSeiTipoProcedimentoDTO->getNumLimit(); |
75 | - | |
75 | + | |
76 | + | |
76 | 77 | // DTO QUE REPRESENTA OS TIPOS DE PROCESSO. |
77 | 78 | $objTipoProcedimentoDTO = new TipoProcedimentoDTO(); |
78 | 79 | $objTipoProcedimentoDTO->setStrSinSomenteUtilizados($favoritos); //Flag de FAVORITOS S (true) / N (false) |
... | ... | @@ -94,7 +95,7 @@ class MdWsSeiProcedimentoRN extends InfraRN |
94 | 95 | setlocale(LC_CTYPE, 'pt_BR'); // Defines para pt-br |
95 | 96 | |
96 | 97 | $objDtoFormatado = strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $aux->getStrNome())); |
97 | - $nomeFormatado = str_replace('?','',strtolower(iconv('ISO-8859-1', 'ASCII//TRANSLIT', $nome))); | |
98 | + $nomeFormatado = str_replace('?','',strtolower(iconv('UTF-8', 'ASCII//TRANSLIT', $nome))); | |
98 | 99 | |
99 | 100 | if( |
100 | 101 | ($aux->getNumIdTipoProcedimento() == $id || !$id) | ... | ... |