/**
  * Obtén dados da pessoa de interesse de uma minuta
  * @param type $dto
  * @return null
  */
 public function getPessoaArtefatoInteressado($dto)
 {
     $query = $this->_em->createQueryBuilder()->select('pf.sqPessoaFuncao, pf.noPessoaFuncao, p.sqPessoa, p.noPessoa, p.noProfissao,
                             t.noTratamento, tv.deEnderecamento, v.noVocativo, cid.noMunicipio, est.noEstado,
                             p.coCep, a.txEmenta')->from($this->_enName, 'p')->innerJoin('p.sqPessoaFuncao', 'pf')->leftJoin('p.sqTratamentoVocativo', 'tv')->leftJoin('tv.sqTratamento', 't')->leftJoin('tv.sqVocativo', 'v')->leftJoin('p.sqMunicipioEndereco', 'cid')->leftJoin('cid.sqEstado', 'est')->innerJoin('p.sqArtefato', 'a')->andWhere('p.sqArtefato = :sqArtefato')->setParameter('sqArtefato', $dto->getSqArtefato())->andWhere('p.sqPessoaFuncao = :sqPessoaFuncao')->setParameter('sqPessoaFuncao', \Core_Configuration::getSgdocePessoaFuncaoInteressado())->getQuery()->execute();
     if (empty($query)) {
         return NULL;
     }
     return $query;
 }
示例#2
0
 /**
  * @return boolean
  */
 public function listInteressados($sqArtefato)
 {
     $dto = \Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato, 'sqPessoaFuncao' => \Core_Configuration::getSgdocePessoaFuncaoInteressado()), 'search');
     return $this->getServiceLocator()->getService('Pessoa')->listInteressados($dto);
 }
示例#3
0
 /**
  * Deleta Destinatario
  * @param \Core_Dto_Search $dto
  * @return array
  */
 public function deleteInteressadoSemSqCorporativo($dto)
 {
     $sqPessoaFuncaoInteressado = \Core_Configuration::getSgdocePessoaFuncaoInteressado();
     $sql = "SELECT ps.sq_pessoa_sgdoce\n                 FROM pessoa_artefato pa\n                 JOIN pessoa_sgdoce ps using(sq_pessoa_sgdoce)\n                WHERE pa.sq_artefato = :sqArtefato\n                  AND pa.sq_pessoa_funcao = :sqPessoaFuncaoInteressado\n                  AND ps.sq_pessoa_corporativo IS NULL";
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping();
     $rsm->addScalarResult('sq_pessoa_sgdoce', 'sqPessoaSgdoce', 'integer');
     $nq = $this->_em->createNativeQuery($sql, $rsm);
     $nq->setParameter('sqArtefato', $dto->getSqArtefato());
     $nq->setParameter('sqPessoaFuncaoInteressado', $sqPessoaFuncaoInteressado);
     $result = $nq->getArrayResult();
     if (!$result) {
         return 0;
     }
     $aux = array();
     foreach ($result as $value) {
         $aux[] = $value['sqPessoaSgdoce'];
     }
     $queryBuilder = $this->_em->createQueryBuilder();
     $delete = $queryBuilder->delete($this->_entityName, 'pa')->setParameter('sqArtefato', $dto->getSqArtefato())->setParameter('sqPessoaFuncao', \Core_Configuration::getSgdocePessoaFuncaoInteressado())->andWhere('pa.sqArtefato = :sqArtefato')->andWhere('pa.sqPessoaFuncao = :sqPessoaFuncao')->andWhere($queryBuilder->expr()->in('pa.sqPessoaSgdoce', $aux));
     return $delete->getQuery()->execute();
 }
 public function listVincularDocumentoAction()
 {
     $this->getHelper('layout')->disableLayout();
     $params = $this->_getAllParams();
     $params['sqPessoaFuncao'] = \Core_Configuration::getSgdocePessoaFuncaoInteressado();
     $configArray = array('columns' => array(array('alias' => 'p.noPessoa', 'alias' => 'a.sqArtefato')));
     $this->view->grid = new Core_Grid($configArray);
     $params = $this->view->grid->mapper($params);
     $this->view->dto = Core_Dto::factoryFromData($params, 'search');
     $this->view->result = $this->getService('Pessoa')->listGridDocumento($this->view->dto);
 }