Commit 2caf33da5b9bd5338ff14f82393d75fe7f838430

Authored by Rafael Ferreira
1 parent 8aa04222
Exists in master

Alteração da resposta do Link ao documento para ao invés de abrir o processo cri…

…ar um acesso externo apenas ao documento
Showing 1 changed file with 41 additions and 1 deletions   Show diff stats
rn/MdWsSeiDocumentoRN.php
... ... @@ -1506,6 +1506,7 @@ class MdWsSeiDocumentoRN extends DocumentoRN {
1506 1506 }
1507 1507 }
1508 1508  
  1509 +
1509 1510 //Busca os interessados, destinatários e remetentes
1510 1511 $objParticipanteDTO = new ParticipanteDTO();
1511 1512 $objParticipanteDTO->setDblIdProtocolo($parNumIdDocumento);
... ... @@ -1590,8 +1591,47 @@ class MdWsSeiDocumentoRN extends DocumentoRN {
1590 1591 $arrDadosDocumento['observacao'] = array();
1591 1592 }
1592 1593  
  1594 + $objUsuarioDTO = new UsuarioDTO();
  1595 + $objUsuarioDTO->retNumIdContato();
  1596 + $objUsuarioDTO->setNumIdUsuario(SessaoSEI::getInstance()->getNumIdUsuario());
  1597 +
  1598 + $objUsuarioRN = new UsuarioRN();
  1599 + $objUsuarioDTO = $objUsuarioRN->consultarRN0489($objUsuarioDTO);
  1600 +
  1601 +
  1602 + //verifica se o usuário já tem acesso ao processo
  1603 + $objAcessoExternoDTO = new AcessoExternoDTO();
  1604 + $objAcessoExternoDTO->retNumIdAcessoExterno();
  1605 + $objAcessoExternoDTO->setDblIdProtocoloAtividade($objDocumentoDTO->getDblIdProcedimento());
  1606 + $objAcessoExternoDTO->setNumIdContatoParticipante($objUsuarioDTO->getNumIdContato());
  1607 + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA);
  1608 +
  1609 + $objAcessoExternoRN = new AcessoExternoRN();
  1610 + $objAcessoExternoDTO = $objAcessoExternoRN->consultar($objAcessoExternoDTO);
  1611 +
  1612 + if ($objAcessoExternoDTO == null) {
  1613 +
  1614 + $objParticipanteDTO = new ParticipanteDTO();
  1615 + $objParticipanteDTO->setDblIdProtocolo($objDocumentoDTO->getDblIdProcedimento());
  1616 + $objParticipanteDTO->setNumIdContato($objUsuarioDTO->getNumIdContato());
  1617 + $objParticipanteDTO->setStrStaParticipacao(ParticipanteRN::$TP_ACESSO_EXTERNO);
  1618 + $objParticipanteDTO->setNumIdUnidade(SessaoSEI::getInstance()->getNumIdUnidadeAtual());
  1619 + $objParticipanteDTO->setNumSequencia(0);
  1620 +
  1621 + $objParticipanteRN = new ParticipanteRN();
  1622 + $objParticipanteDTO = $objParticipanteRN->cadastrarRN0170($objParticipanteDTO);
  1623 +
  1624 + $objAcessoExternoDTO = new AcessoExternoDTO();
  1625 + $objAcessoExternoDTO->setNumIdParticipante($objParticipanteDTO->getNumIdParticipante());
  1626 + $objAcessoExternoDTO->setStrStaTipo(AcessoExternoRN::$TA_SISTEMA);
  1627 +
  1628 + $objAcessoExternoRN = new AcessoExternoRN();
  1629 + $objAcessoExternoDTO = $objAcessoExternoRN->cadastrar($objAcessoExternoDTO);
  1630 + }
  1631 +
1593 1632 $arrDadosDocumento['protocoloAgrupador'] = $objDocumentoDTO->getDblIdProcedimento();
1594   - $arrDadosDocumento['linkProcesso'] = ConfiguracaoSEI::getInstance()->getValor('SEI','URL') . '/controlador.php?acao=procedimento_trabalhar&id_procedimento='.$objDocumentoDTO->getDblIdProcedimento();
  1633 + //$arrDadosDocumento['linkProcesso'] = ConfiguracaoSEI::getInstance()->getValor('SEI','URL') . '/controlador.php?acao=procedimento_trabalhar&id_procedimento='.$objDocumentoDTO->getDblIdProcedimento() . '&id_documento=' . $objDocumentoDTO->getDblIdDocumento();
  1634 + $arrDadosDocumento['linkProcesso'] = SessaoSEIExterna::getInstance($objAcessoExternoDTO->getNumIdAcessoExterno())->assinarLink(ConfiguracaoSEI::getInstance()->getValor('SEI', 'URL') . '/documento_consulta_externa.php?id_acesso_externo=' . $objAcessoExternoDTO->getNumIdAcessoExterno() . '&id_documento=' . $objDocumentoDTO->getDblIdDocumento());
1595 1635  
1596 1636 return MdWsSeiRest::formataRetornoSucessoREST(null, $arrDadosDocumento);
1597 1637 } catch (Exception $e) {
... ...