Commit 20ddb4ed5a15191dd261e1531e019638e62e0e7c
1 parent
e4dce648
Exists in
master
and in
1 other branch
Foi adicionado a possibilidade de pesquisa através de valores de observação nos …
…assuntos, além de um ajuste no totalizador de registros vindo todos da consulta, independente de limites de paginação
Showing
1 changed file
with
25 additions
and
17 deletions
Show diff stats
rn/MdWsSeiProcedimentoRN.php
@@ -251,15 +251,23 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -251,15 +251,23 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
251 | $filter = $objGetMdWsSeiAssuntoDTO->getStrFilter(); | 251 | $filter = $objGetMdWsSeiAssuntoDTO->getStrFilter(); |
252 | $start = $objGetMdWsSeiAssuntoDTO->getNumStart(); | 252 | $start = $objGetMdWsSeiAssuntoDTO->getNumStart(); |
253 | $limit = $objGetMdWsSeiAssuntoDTO->getNumLimit(); | 253 | $limit = $objGetMdWsSeiAssuntoDTO->getNumLimit(); |
254 | - | 254 | + |
255 | $assuntoDTO = new AssuntoDTO(); | 255 | $assuntoDTO = new AssuntoDTO(); |
256 | if($id) | 256 | if($id) |
257 | $assuntoDTO->setNumIdAssunto($id); | 257 | $assuntoDTO->setNumIdAssunto($id); |
258 | - | ||
259 | - if($filter) $assuntoDTO->adicionarCriterio(array('CodigoEstruturado','Descricao'),array(InfraDTO::$OPER_LIKE,InfraDTO::$OPER_LIKE),array('%'.utf8_decode($filter).'%','%'.utf8_decode($filter).'%'),InfraDTO::$OPER_LOGICO_OR); | 258 | + |
259 | + if($filter) $assuntoDTO->adicionarCriterio(array('CodigoEstruturado','Descricao','Observacao'),array(InfraDTO::$OPER_LIKE,InfraDTO::$OPER_LIKE,InfraDTO::$OPER_LIKE),array('%'.utf8_decode($filter).'%','%'.utf8_decode($filter).'%','%'.utf8_decode($filter).'%'), array(InfraDTO::$OPER_LOGICO_OR,InfraDTO::$OPER_LOGICO_OR)); | ||
260 | // $objInfraAgendamentoTarefaDTO->adicionarCriterio(array('SinAtivo','IdInfraAgendamentoTarefa'),array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL),array('S',$strValorItemSelecionado),InfraDTO::$OPER_LOGICO_OR); | 260 | // $objInfraAgendamentoTarefaDTO->adicionarCriterio(array('SinAtivo','IdInfraAgendamentoTarefa'),array(InfraDTO::$OPER_IGUAL,InfraDTO::$OPER_IGUAL),array('S',$strValorItemSelecionado),InfraDTO::$OPER_LOGICO_OR); |
261 | // $assuntoDTO->setStrCodigoEstruturado('%'.$filter.'%',InfraDTO::$OPER_LIKE); | 261 | // $assuntoDTO->setStrCodigoEstruturado('%'.$filter.'%',InfraDTO::$OPER_LIKE); |
262 | 262 | ||
263 | + | ||
264 | + $assuntoRN = new AssuntoRN(); | ||
265 | + | ||
266 | + $assuntoCountDTO = $assuntoDTO; // APENAS PARA TOTALIZAR OS REGISTROS DE RETORNO | ||
267 | + $assuntoCountDTO->retNumIdAssunto(); | ||
268 | + $assuntoCountDTO = $assuntoRN->listarRN0247($assuntoCountDTO); | ||
269 | + | ||
270 | + | ||
263 | if($limit) | 271 | if($limit) |
264 | $assuntoDTO->setNumMaxRegistrosRetorno($limit); | 272 | $assuntoDTO->setNumMaxRegistrosRetorno($limit); |
265 | if($start) | 273 | if($start) |
@@ -270,28 +278,28 @@ class MdWsSeiProcedimentoRN extends InfraRN | @@ -270,28 +278,28 @@ class MdWsSeiProcedimentoRN extends InfraRN | ||
270 | $assuntoDTO->retStrDescricao(); | 278 | $assuntoDTO->retStrDescricao(); |
271 | 279 | ||
272 | // REALIZA A CHAMADA DA DE ASSUNTOS | 280 | // REALIZA A CHAMADA DA DE ASSUNTOS |
273 | - $assuntoRN = new AssuntoRN(); | ||
274 | - $arrAssuntoDTO = $assuntoRN->listarRN0247($assuntoDTO); | ||
275 | - | 281 | + |
282 | + $arrAssuntoDTO = $assuntoRN->listarRN0247($assuntoDTO); | ||
283 | + | ||
276 | $arrayRetorno = array(); | 284 | $arrayRetorno = array(); |
277 | if($arrAssuntoDTO){ | 285 | if($arrAssuntoDTO){ |
278 | foreach ($arrAssuntoDTO as $obj) { | 286 | foreach ($arrAssuntoDTO as $obj) { |
279 | $arrayRetorno[] = array( | 287 | $arrayRetorno[] = array( |
280 | - "id" => $obj->getNumIdAssunto(), | ||
281 | - "codigo" => $obj->getStrCodigoEstruturado(), | ||
282 | - "descricao" => $obj->getStrDescricao(), | ||
283 | - ); | 288 | + "id" => $obj->getNumIdAssunto(), |
289 | + "codigo" => $obj->getStrCodigoEstruturado(), | ||
290 | + "descricao" => $obj->getStrDescricao(), | ||
291 | + ); | ||
284 | } | 292 | } |
285 | } | 293 | } |
286 | - | 294 | + |
287 | // $arrayRetorno = array(); | 295 | // $arrayRetorno = array(); |
288 | -// if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1)); | ||
289 | -// if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit)); | ||
290 | - | 296 | +// if($start) $arrayRetorno = array_slice($arrayRetorno, ($start-1)); |
297 | +// if($limit) $arrayRetorno = array_slice($arrayRetorno, 0,($limit)); | ||
298 | + | ||
291 | $total = 0; | 299 | $total = 0; |
292 | - $total = count($arrayRetorno); | ||
293 | - | ||
294 | - return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | 300 | + $total = count($assuntoCountDTO); |
301 | + | ||
302 | + return MdWsSeiRest::formataRetornoSucessoREST(null, $arrayRetorno, $total); | ||
295 | } catch (Exception $e) { | 303 | } catch (Exception $e) { |
296 | return MdWsSeiRest::formataRetornoErroREST($e); | 304 | return MdWsSeiRest::formataRetornoErroREST($e); |
297 | } | 305 | } |