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