Exemplo n.º 1
0
 public function findDocumentoSemImagem($limit = 100)
 {
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping($this->_em);
     $rsm->addScalarResult('sq_artefato', 'sqArtefato', 'integer');
     /**
      * somente documento que não possua vinculo com ninguem
      */
     $strQuery = sprintf('SELECT DISTINCT t.*
                            FROM(SELECT a.sq_artefato
                                   FROM artefato AS a
                              LEFT JOIN (
                                         SELECT DISTINCT ON (ai.sq_artefato)
                                                ai.sq_artefato,
                                                ai.sq_artefato_imagem
                                           FROM artefato_imagem ai
                                          ORDER BY ai.sq_artefato, ai.dt_operacao DESC, ai.sq_artefato_imagem DESC
                              ) uia ON a.sq_artefato = uia.sq_artefato
                              LEFT JOIN tipo_artefato_assunto     AS taa USING(sq_tipo_artefato_assunto)
                              LEFT JOIN artefato_processo         AS ap  ON a.sq_artefato = ap.sq_artefato
                              LEFT JOIN tmp_artefato_migration    as tmp ON a.sq_artefato = tmp.sq_artefato
                                  WHERE taa.sq_tipo_artefato = %1$d
                                    AND ap.sq_artefato         IS NULL
                                    AND uia.sq_artefato_imagem IS NULL
                                    AND tmp.sq_artefato        IS NULL
                                ) t
                            JOIN vw_imagem_sgdoc_fisico AS isf USING(sq_artefato)
                        ORDER BY sq_artefato DESC
                        LIMIT %2$d', \Core_Configuration::getSgdoceTipoArtefatoDocumento(), $limit);
     return $this->_em->createNativeQuery($strQuery, $rsm)->useResultCache(false)->getArrayResult();
 }
Exemplo n.º 2
0
 public function listItemsVinculoArtefatoAction(array $tipos = NULL)
 {
     $tipoDocumento = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     $tipoProcesso = \Core_Configuration::getSgdoceTipoArtefatoProcesso();
     $queryBuilder = $this->_em->createQueryBuilder()->select('ta.sqTipoArtefato,ta.noTipoArtefato')->from('app:TipoArtefato', 'ta')->orderBy('ta.noTipoArtefato', 'ASC');
     $queryBuilder->andWhere('ta.sqTipoArtefato in(:tipoDocumento,:tipoProcesso)')->setParameters(array('tipoDocumento' => $tipoDocumento, 'tipoProcesso' => $tipoProcesso));
     $out = array();
     $res = $queryBuilder->getQuery()->getArrayResult();
     foreach ($res as $item) {
         $out[$item['sqTipoArtefato']] = $item['noTipoArtefato'];
     }
     return $out;
 }
 public function indexAction()
 {
     $this->view->tipoArtefato = $this->getRequest()->getParam('tipoArtefato', null);
     $this->view->caixa = $this->getRequest()->getParam('caixa', null);
     $this->view->currentProfile = \Core_Integration_Sica_User::getUserProfile();
     if (!$this->view->tipoArtefato) {
         $this->_redirect('/artefato/area-trabalho/index/tipoArtefato/' . \Core_Configuration::getSgdoceTipoArtefatoDocumento() . '/caixa/minhaCaixa');
     }
     //parametro enviado pela tela de tramite em casos de
     //tramite externo com impressão de "guia de tramite externo"
     $this->view->printGuia = $this->getRequest()->getParam('guia', false);
     $this->view->enderecoGuia = $this->getRequest()->getParam('endereco', '');
     $this->view->unit_box = 1;
     $this->view->my_box = 2;
     $this->view->external_box = 3;
     $this->view->archive_box = 4;
 }
 public function listItemsVinculoArtefatoAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $data = array();
     # filtra o tipo de retorno conforme o tipo do documento base
     # Atentar para o tipo do documento base
     #          BASE -> Recupera
     # Regra-1: DOC  +  DOC
     # Regra-2: PROC +  PROC
     # Regra-3: PROC +  DOC
     $tipoArtefatoFiltro = array(\Core_Configuration::getSgdoceTipoArtefatoDocumento() => array(\Core_Configuration::getSgdoceTipoArtefatoDocumento()), \Core_Configuration::getSgdoceTipoArtefatoProcesso() => array(\Core_Configuration::getSgdoceTipoArtefatoDocumento(), \Core_Configuration::getSgdoceTipoArtefatoProcesso()));
     $arrTipoArtefatoAceito = $tipoArtefatoFiltro[$this->getRequest()->getParam('sqTipoArtefatoParent')];
     foreach ($this->getService()->listItemsVinculoArtefatoAction() as $key => $value) {
         if (in_array($key, $arrTipoArtefatoAceito)) {
             $data[] = array('value' => $key, 'text' => $value);
         }
     }
     $this->_helper->json($data);
 }
Exemplo n.º 5
0
 /**
  * Cria um novo sequencial quando nao existe e direciona o fluxo para editar
  */
 public function createAction()
 {
     $data = array('sqUnidadeOrg' => $this->getRequest()->getParam('unidade'), 'sqPessoa' => $this->getRequest()->getParam('unidade'), 'nuAno' => $this->getRequest()->getParam('ano'), 'sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoDocumento(), 'nuSequencial' => 0, 'sqTipoDocumento' => $this->getRequest()->getParam('tipo'), 'coUorg' => $this->getRequest()->getParam('unidade'));
     $id = $this->getService()->create($data)->getSqSequencialArtefato();
     $this->_redirect("/auxiliar/sequnidorg/edit/id/{$id}/unidade/{$data['sqUnidadeOrg']}");
 }
Exemplo n.º 6
0
 /**
  * @return redireciona para createAction
  */
 public function indexAction()
 {
     $sqArtefato = $this->_getParam('id');
     $url = $this->getRequest()->getParam('back', false);
     if ($url) {
         $url = str_replace(".", "/", $url);
         $this->view->urlBack = $url;
         $url = substr($url, 1);
         $params = explode("/", $url);
         $this->view->controllerBack = next($params);
         $this->view->caixa = end($params);
     }
     $dto = \Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato), 'search');
     $arResult = $this->getService()->getChilds($dto);
     if ($arResult) {
         $this->view->listVinculos = $arResult['list'];
         $isProcesso = $this->getService('ArtefatoProcesso')->isProcesso($sqArtefato, false);
         $this->view->tipoArtefato = $isProcesso ? \Core_Configuration::getSgdoceTipoArtefatoProcesso() : \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     } else {
         $this->_redirect($this->view->urlBack);
     }
     if ($arResult['isOk']) {
         $sqArtefatoPai = $arResult['sqArtefatoPai'];
         $this->getService()->setMigracaoConcluida($sqArtefatoPai);
         $dtox = Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefatoPai), 'search');
         $areaTrabalho = $this->getService('AreaTrabalho')->findArtefato($dtox);
         $msg = 'Migração concluída com sucesso';
         $caixa = "minhaCaixa";
         if ($areaTrabalho) {
             $this->getMessaging()->addSuccessMessage($msg, 'User');
             $this->getMessaging()->dispatchPackets();
             $this->_redirect('artefato/area-trabalho/index/tipoArtefato/' . $this->view->tipoArtefato . '/caixa/' . $caixa);
         } else {
             $sucesso = FALSE;
             if ($this->getService('CaixaArtefato')->isArquivado($dtox)) {
                 $caixa = "caixaArquivo";
                 $msg .= ", o artefato se encontra arquivado.";
                 $sucesso = TRUE;
             }
             if ($this->getService('VwUltimoTramiteArtefato')->isTramiteExterno($dtox)) {
                 $caixa = "caixaExterna";
                 $sucesso = TRUE;
             }
             if ($sucesso) {
                 $this->getMessaging()->addSuccessMessage($msg, 'User');
                 $this->getMessaging()->dispatchPackets();
                 $this->_redirect('artefato/area-trabalho/index/tipoArtefato/' . $this->view->tipoArtefato . '/caixa/' . $caixa);
             } else {
                 $this->getMessaging()->addErrorMessage(\Core_Registry::getMessage()->translate('MN178'), 'User');
                 $this->getMessaging()->dispatchPackets();
             }
         }
         //@TODO: procurar por getArquivado e getIsTramiteExterno pois usuando a função essas informações não vem
         //ANTES ERA FEITO ASSIM quando fazia find na vw_area_trablaho
         //            if ($entArtefato) {
         //
         //                if( $entArtefato->getArquivado() ) {
         //                    $caixa = "caixaArquivo";
         //                    $msg .= ", o artefato se encontra arquivado.";
         //                }
         //
         //                if( $entArtefato->getIsTramiteExterno() ){
         //                    $caixa = "caixaExterna";
         //                }
         //
         //                $this->getMessaging()->addSuccessMessage($msg, 'User');
         //                $this->getMessaging()->dispatchPackets();
         //
         //                $this->_redirect( 'artefato/area-trabalho/index/tipoArtefato/' . $this->view->tipoArtefato . '/caixa/' . $caixa );
         //            } else {
         //                $this->getMessaging()->addErrorMessage(\Core_Registry::getMessage()->translate('MN178'), 'User');
         //                $this->getMessaging()->dispatchPackets();
         //            }
     }
     $this->view->urlBack = false;
     $this->view->controllerBack = null;
     $this->view->caixa = null;
     $this->view->id = $sqArtefato;
     $this->view->maskNumber = new Core_Filter_MaskNumber();
 }
Exemplo n.º 7
0
 public function transformarMinutaDocumentoEletronico(\Core_Dto_Abstract $dto)
 {
     $artefato = $this->findArtefato($dto);
     $assunto = $artefato->getSqTipoArtefatoAssunto()->getSqAssunto()->getSqAssunto();
     $tipoArtefatoAssunto = $this->_getRepository('app:TipoArtefatoAssunto')->findOneBy(array('sqAssunto' => $assunto, 'sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoDocumento()));
     $artefato->setSqTipoArtefatoAssunto($tipoArtefatoAssunto);
     $artefato->setNuArtefato($dto->getNuArtefato());
     $artefato->setNuDigital($dto->getNuDigital());
     $this->getEntityManager()->persist($artefato);
     $this->getEntityManager()->flush($artefato);
 }
 /**
  * Método que assina a minuta
  */
 public function assinarMinutaAction()
 {
     $artefato = $this->getService('Artefato')->find($this->getRequest()->getParam('sqArtefato'));
     //O artefato deve continuar com o mesmo status
     $ultimNumeroArtefato = $this->getService('HistoricoArtefato')->findBy(array('sqArtefato' => $artefato->getSqArtefato()), array('sqHistoricoArtefato' => 'DESC'));
     $params['sqStatusArtefato'] = $ultimNumeroArtefato[0]->getSqStatusArtefato()->getSqStatusArtefato();
     $params['sqUnidadeOrg'] = \Core_Integration_Sica_User::getUserUnit();
     $params['sqArtefato'] = $this->_getParam('sqArtefato');
     $params['sqPessoa'] = \Core_Integration_Sica_User::getPersonId();
     $params['sqOcorrencia'] = \Core_Configuration::getSqOcorrenciaAssinarMinuta();
     $params['nuDigital'] = '';
     $params['sqTipoArtefato'] = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     $params['sqTipoDocumento'] = $artefato->getSqTipoDocumento()->getSqTipoDocumento();
     //registra assinatura
     $this->getService('Artefato')->registrarAssinatura($artefato, $params);
     $assinado = $this->getService('Artefato')->verificaArtefatoAssinado($artefato);
     if ($assinado) {
         $this->gerarDocumento($params);
     }
     $result = $this->alteraHistoricoArtefato($params);
     switch ($result) {
         case TRUE:
             if ($assinado) {
                 $params['sqOcorrencia'] = \Core_Configuration::getSgdoceSqOcorrenciaCadastrar();
                 $this->alteraHistoricoArtefato($params);
                 //Gera as vias do documento
                 $sqModeloDocumento = $artefato->getSqArtefatoMinuta()->getSqModeloDocumento()->getSqModeloDocumento();
                 if ($this->isVariasVias($sqModeloDocumento)) {
                     $this->getService('Artefato')->gerarVias($artefato, $params);
                 }
                 $this->getMessaging()->addSuccessMessage('MN085');
                 return $this->_redirect("/artefato/area-trabalho/index/view/{$this->_getParam('view')}");
             } else {
                 return $this->_redirect("/artefato/visualizar-caixa-minuta/index/view/{$this->_getParam('view')}");
             }
     }
     return NULL;
 }
Exemplo n.º 9
0
 /**
  * @param array $treeView
  */
 public function handleTreeviewImage($treeView)
 {
     try {
         foreach ($treeView as $item) {
             $hasImage = null;
             $item['sqArtefato'] = $item['sqArtefatoFilho'];
             if (is_null($item['sqArtefato'])) {
                 $item['sqArtefato'] = $item['sqArtefatoPai'];
             }
             if ($item['sqTipoArtefato'] == \Core_Configuration::getSgdoceTipoArtefatoDocumento()) {
                 $hasImage = $this->getServiceLocator()->getService('ArtefatoImagem')->hasImage($item['sqArtefato']);
                 if (!$hasImage) {
                     $dtoSearch = \Core_Dto::factoryFromData(array('sqPessoa' => \Core_Integration_Sica_User::getPersonId(), 'sqUnidadeOrg' => \Core_Integration_Sica_User::getUserUnit(), 'sqArtefato' => $item['sqArtefato']), 'search');
                     $this->addSolicitacaoMigracao($dtoSearch);
                 }
             }
             if (count($item['filhos'])) {
                 $this->handleTreeviewImage($item['filhos']);
             }
         }
         return true;
     } catch (\Exception $e) {
         return $e->getCode();
     }
 }
Exemplo n.º 10
0
 /**
  * Verifica a existencia do proximo sequencial para o artefato
  * @param  $params
  * @return array
  */
 public function hasSequencialArtefato($params)
 {
     $params['sqUnidadeOrg'] = $params['sqUnidadeOrg']->getSqUnidadeOrg();
     $params['sqTipoArtefato'] = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     if (!empty($params['sqTipoDocumento'])) {
         $params['sqTipoDocumento'] = $params['sqTipoDocumento']->getSqTipoDocumento();
     }
     $params['action'] = 'alterar-sequencial';
     $sequencial = $this->getServiceLocator()->getService('Artefato')->recuperaProximoNumeroArtefato($params);
     //se for igual o proximo numero do sequencial esta liberado
     if ((int) $params['nuSequencial'] == $sequencial->getNuSequencial()) {
         return FALSE;
     }
     return $sequencial;
 }
Exemplo n.º 11
0
 /**
  * @return
  */
 public function listPesquisaDocumento($dto)
 {
     $listCondition = array('getNuArtefato' => array("ilike" => array("AND" => 'art.nu_artefato')), 'getSqAssunto' => array("=" => array("AND" => 'ass.sq_assunto')), 'getTxAssuntoComplementar' => array("ilike" => array("AND" => 'art.tx_assunto_complementar')), 'getInteressado' => array("ilike" => array("OR" => array("trim(pse.no_pessoa)", "trim(vue.sg_unidade_org || ' - ' || pse.no_pessoa)"), 'tlp' => array('trim(%s)', 'trim(%s)'))), 'getOrigem' => array("ilike" => array("OR" => array("trim(pfo.no_pessoa)", "trim(vuo.sg_unidade_org || ' - ' || pfo.no_pessoa)"), 'tlp' => array('trim(%s)', 'trim(%s)'))), 'getNuDigital' => array("ilike" => array("AND" => 'formata_numero_digital(art.nu_digital)')), 'getDestino' => array("ilike" => array("OR" => array("trim(pfd.no_pessoa)", "trim(vud.sg_unidade_org || ' - ' || pfd.no_pessoa)"), 'tlp' => array('trim(%s)', 'trim(%s)'))), 'getAssinatura' => array("ilike" => array("OR" => array("trim(pfa.no_pessoa)", "trim(vua.sg_unidade_org || ' - ' || pfa.no_pessoa)"), 'tlp' => array('trim(%s)', 'trim(%s)'))), 'getNoTipoDocumento' => array("ilike" => array("AND" => 'tad.no_tipo_documento')));
     // criteria
     $listPeriodo = array('dtCadastro' => 'art.dt_cadastro', 'dtAutuacao' => 'art.dt_artefato', 'dtPrazo' => 'art.dt_prazo');
     $sqPeriodo = $dto->getSqPeriodo();
     $periodoColumn = null;
     if (isset($listPeriodo[$sqPeriodo])) {
         $periodoColumn = $listPeriodo[$sqPeriodo];
     }
     $where = $this->getCriteriaText($listCondition, $dto, $periodoColumn);
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping($this->_em);
     $rsm->addScalarResult('total_record', 'totalRecord', 'integer');
     $rsm->addScalarResult('sq_artefato', 'sqArtefato', 'integer');
     $rsm->addScalarResult('nu_digital', 'nuDigital', 'string');
     $rsm->addScalarResult('tx_assunto', 'txAssunto', 'string');
     $rsm->addScalarResult('nu_artefato', 'nuArtefato', 'string');
     $rsm->addScalarResult('no_tipo_documento', 'noTipoDocumento', 'string');
     $rsm->addScalarResult('origem', 'noPessoaOrigem', 'string');
     $rsm->addScalarResult('dt_artefato', 'dtArtefato', 'string');
     $rsm->addScalarResult('interessados', 'noPessoaInteressados', 'string');
     $rsm->addScalarResult('tx_movimentacao', 'txMovimentacao', 'string');
     $sql = "SELECT  COUNT(art.sq_artefato) OVER() AS total_record,\n                         art.sq_artefato,\n                         formata_numero_digital(art.nu_digital) AS nu_digital,\n                         ass.tx_assunto,\n                         art.nu_artefato,\n                         tad.no_tipo_documento,\n                         pfo.no_pessoa as origem,\n                         art.dt_artefato,\n                         string_agg(pse.no_pessoa, ', ') AS interessados,\n                         pfd.no_pessoa as destino,\n                         pfa.no_pessoa as assinatura,\n                         sgdoce.ultima_movimentacao_artefato(art.sq_artefato) as tx_movimentacao\n                    FROM sgdoce.artefato art\n                    JOIN sgdoce.tipo_artefato_assunto taa ON art.sq_tipo_artefato_assunto = taa.sq_tipo_artefato_assunto\n                    JOIN sgdoce.assunto ass ON taa.sq_assunto = ass.sq_assunto\n                    JOIN sgdoce.tipo_documento tad ON art.sq_tipo_documento = tad.sq_tipo_documento\n                    JOIN sgdoce.pessoa_artefato pao ON art.sq_artefato = pao.sq_artefato AND pao.sq_pessoa_funcao  = " . \Core_Configuration::getSgdocePessoaFuncaoOrigem() . "\n                    JOIN sgdoce.pessoa_sgdoce pfo ON pao.sq_pessoa_sgdoce = pfo.sq_pessoa_sgdoce\n               LEFT JOIN corporativo.vw_unidade_org vuo ON pfo.sq_pessoa_corporativo = vuo.sq_pessoa\n               LEFT JOIN sgdoce.pessoa_interessada_artefato pai ON art.sq_artefato = pai.sq_artefato\n               LEFT JOIN sgdoce.pessoa_sgdoce pse ON pai.sq_pessoa_sgdoce = pse.sq_pessoa_sgdoce\n               LEFT JOIN corporativo.vw_unidade_org vue ON pse.sq_pessoa_corporativo = vue.sq_pessoa\n               LEFT JOIN sgdoce.pessoa_artefato pad ON art.sq_artefato = pad.sq_artefato AND pad.sq_pessoa_funcao = " . \Core_Configuration::getSgdocePessoaFuncaoDestinatario() . "\n               LEFT JOIN sgdoce.pessoa_sgdoce pfd ON pad.sq_pessoa_sgdoce = pfd.sq_pessoa_sgdoce\n               LEFT JOIN corporativo.vw_unidade_org vud ON pfd.sq_pessoa_corporativo = vud.sq_pessoa\n               LEFT JOIN sgdoce.pessoa_artefato paa ON art.sq_artefato = paa.sq_artefato AND paa.sq_pessoa_funcao = " . \Core_Configuration::getSgdocePessoaFuncaoAssinatura() . "\n               LEFT JOIN sgdoce.pessoa_sgdoce pfa ON paa.sq_pessoa_sgdoce = pfa.sq_pessoa_sgdoce\n               LEFT JOIN corporativo.vw_unidade_org vua ON pfa.sq_pessoa_corporativo = vua.sq_pessoa\n                    %s\n                GROUP BY art.sq_artefato,\n                         art.nu_digital,\n                         ass.tx_assunto,\n                         art.nu_artefato,\n                         tad.no_tipo_documento,\n                         pfo.no_pessoa,\n                         art.dt_artefato,\n                         pfd.no_pessoa,\n                         pfa.no_pessoa,\n                         tx_movimentacao";
     if ($where != "") {
         $where = "WHERE " . $where;
     } else {
         $where = "WHERE 1 <> 1";
     }
     $where .= " AND taa.sq_tipo_artefato = " . \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     $sql = sprintf($sql, $where);
     return $this->_em->createNativeQuery($sql, $rsm);
 }
Exemplo n.º 12
0
 public function processDownloadFileRequest($sqArtefato)
 {
     try {
         $dto = \Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato), 'search');
         $arrNotVinculo = array(\Core_Configuration::getSgdoceTipoVinculoArtefatoReferencia(), \Core_Configuration::getSgdoceTipoVinculoArtefatoApoio(), \Core_Configuration::getSgdoceTipoVinculoArtefatoDespacho());
         $arrVinculo = $this->getServiceLocator()->getService('ArtefatoVinculo')->findVinculoArtefato($dto, $arrNotVinculo);
         $entArtefato = $this->_getRepository($this->_entityArtefato)->find($sqArtefato);
         $sqTipoArtefato = $entArtefato->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getSqTipoArtefato();
         if ($sqTipoArtefato == \Core_Configuration::getSgdoceTipoArtefatoDocumento() && count($arrVinculo) == 0) {
             //Documento sem Vinculo
             $arrRetorno = $this->_processDownloadUniqueFile($sqArtefato);
         } else {
             //Processo com vinculo além da 1ª Peça
             //Documento com vinculo
             $sqPessoa = \Core_Integration_Sica_User::getPersonId();
             $configs = \Core_Registry::get('configs');
             $mergePdfOptions = $configs['merge_pdf'];
             $robotMode = (bool) $mergePdfOptions['robotMode'];
             if (!$robotMode) {
                 $arrRetorno = $this->_processMergeFiles($sqArtefato, $sqPessoa);
             } else {
                 $txEmailCorporativo = $this->_getEmailCorporativo($sqPessoa);
                 if (!$txEmailCorporativo) {
                     throw new \Core_Exception_ServiceLayer('Email corporativo não localizado. Impossível prosseguir.');
                 }
                 $entSolicitacaoDownloadImagem = $this->_newEntity('app:SolicitacaoDownloadImagem');
                 $entSolicitacaoDownloadImagem->setSqArtefato($entArtefato)->setSqPessoa($this->getEntityManager()->getPartialReference('app:VwPessoa', $sqPessoa))->setSqUnidadeOrg($this->getEntityManager()->getPartialReference('app:VwUnidadeOrg', \Core_Integration_Sica_User::getUserUnit()))->setDtSolicitacao(\Zend_Date::now())->setStProcessado(FALSE)->setInTentativa(0)->setTxEmail($txEmailCorporativo);
                 $this->getEntityManager()->persist($entSolicitacaoDownloadImagem);
                 $this->getEntityManager()->flush();
                 $arrRetorno['success'] = true;
                 $arrRetorno['msg'] = sprintf(\Core_Registry::getMessage()->translate('MN169'), $txEmailCorporativo);
                 $arrRetorno['link'] = '';
                 $arrRetorno['filesize'] = '';
             }
         }
         //            switch ($sqTipoArtefato) {
         //                //Processo apenas com a 1ª Peça
         //                case \Core_Configuration::getSgdoceTipoArtefatoProcesso() && count($arrVinculo) == 1:
         //                    $arrRetorno = $this->_processDownloadUniqueFile($arrVinculo[1]['sqArtefato']);
         //                    break;
         //                //Documento sem Vinculo
         //                case \Core_Configuration::getSgdoceTipoArtefatoDocumento() && count($arrVinculo) == 0:
         //                    $arrRetorno = $this->_processDownloadUniqueFile($sqArtefato);
         //                    break;
         //                //Processo com vinculo além da 1ª Peça
         //                //Documento com vinculo
         //                default:
         //
         //                    $sqPessoa        = \Core_Integration_Sica_User::getPersonId();
         //                    $configs         = \Core_Registry::get('configs');
         //                    $mergePdfOptions = $configs['merge_pdf'];
         //                    $robotMode       = (boolean) $mergePdfOptions['robotMode'];
         //
         //                    if (!$robotMode) {
         //                        $arrRetorno = $this->_processMergeFiles($sqArtefato, $sqPessoa);
         //                        break;
         //                    }
         //
         //                    $txEmailCorporativo = $this->_getEmailCorporativo($sqPessoa);
         //
         //                    if (!$txEmailCorporativo) {
         //                        throw new \Core_Exception_ServiceLayer('Email corporativo não localizado. Impossível prosseguir.');
         //                    }
         //
         //                    $entSolicitacaoDownloadImagem = $this->_newEntity('app:SolicitacaoDownloadImagem');
         //                    $entSolicitacaoDownloadImagem->setSqArtefato($entArtefato)
         //                            ->setSqPessoa($this->getEntityManager()->getPartialReference('app:VwPessoa', $sqPessoa))
         //                            ->setSqUnidadeOrg($this->getEntityManager()->getPartialReference('app:VwUnidadeOrg', \Core_Integration_Sica_User::getUserUnit()))
         //                            ->setDtSolicitacao(\Zend_Date::now())
         //                            ->setStProcessado(FALSE)
         //                            ->setInTentativa(0)
         //                            ->setTxEmail($txEmailCorporativo);
         //
         //                    $this->getEntityManager()->persist($entSolicitacaoDownloadImagem);
         //                    $this->getEntityManager()->flush();
         //
         //                    $arrRetorno['success']  = true;
         //                    $arrRetorno['msg']      = sprintf(\Core_Registry::getMessage()->translate('MN169'), $txEmailCorporativo);
         //                    $arrRetorno['link']     = '';
         //                    $arrRetorno['filesize'] = '';
         //
         //                    break;
         //            }
     } catch (\Exception $e) {
         $arrRetorno['success'] = false;
         $arrRetorno['msg'] = $e->getMessage();
         $arrRetorno['link'] = '';
     }
     return $arrRetorno;
 }
Exemplo n.º 13
0
 /**
  */
 public function searchArtefatoAction()
 {
     $this->_helper->layout->disableLayout();
     $this->_helper->viewRenderer->setNoRender(TRUE);
     $params = $this->_getAllParams();
     if (isset($params['extraParam']) && $params['extraParam'] != '') {
         $params['sqTipoArtefato'] = $params['extraParam'];
     } else {
         $params['sqTipoArtefato'] = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     }
     $params['sqUnidadeOrg'] = \Core_Integration_Sica_User::getUserUnit();
     $params['sqPessoa'] = \Core_Integration_Sica_User::getPersonId();
     $dtoSearch = Core_Dto::factoryFromData($params, 'search');
     $this->getHelper('json')->sendJson($this->getService()->comboArtefato($dtoSearch));
 }
Exemplo n.º 14
0
 /**
  * @return
  */
 public function listGrid(\Core_Dto_Search $dto)
 {
     $listCondition = array('getSqPessoaAbertura' => array("=" => array("AND" => 's.sq_pessoa')), 'getSqUnidadeOrgAbertura' => array("=" => array("AND" => 's.sq_unidade_org')), 'getSqTipoAssuntoSolicitacao' => array("=" => array("AND" => 'tas.sq_tipo_assunto_solicitacao')), 'getSqTipoStatusSolicitacao' => array("=" => array("AND" => 'uss.sq_tipo_status_solicitacao')), 'getSqTipoStatusSolicitacaoNot' => array("<>" => array("AND" => 'uss.sq_tipo_status_solicitacao')), 'getSqPessoaResponsavel' => array("=" => array("AND" => 'uss.sq_pessoa_responsavel')), 'getSqPessoaResponsavelIsNull' => array("IS" => array("AND" => 'uss.sq_pessoa_responsavel')), 'getSqPessoaResponsavelNot' => array("<>" => array("AND" => 'uss.sq_pessoa_responsavel')), 'getSearch' => array("ilike" => array('OR' => array('tas.no_tipo_assunto_solicitacao', 's.ds_solicitacao', 'pes_atendimento.no_pessoa', 'und_abertura.sg_unidade_org', 'pes_abertura.no_pessoa', 'at.nu_artefato', 'formata_numero_digital(at.nu_digital)', 'cast(s.sq_solicitacao as text)', 'tx_email'))));
     $operationTypeArtefato = 'IS NULL';
     if (in_array($dto->getSqTipoArtefato(), array(1, 2))) {
         $operationTypeArtefato = '=';
     }
     $listCondition['getSqTipoArtefato'] = array($operationTypeArtefato => array("AND" => 'taa.sq_tipo_artefato'));
     if ($dto->getNuArtefato() != '' && $dto->getSqTipoArtefato()) {
         if ($dto->getSqTipoArtefato() == \Core_Configuration::getSgdoceTipoArtefatoProcesso()) {
             $listCondition['getNuArtefato'] = array("ilike" => array("OR" => array("formata_numero_artefato(at.nu_artefato, ap.co_ambito_processo)", 'at.nu_artefato')));
         } else {
             $listCondition['getNuArtefato'] = array("ilike" => array("AND" => "formata_numero_digital(at.nu_digital)"));
         }
     }
     $period = null;
     if ($dto->getDtSolicitacao() != "") {
         $period = "s.dt_solicitacao";
     }
     $where = $this->getEntityManager()->getRepository('app:Artefato')->getCriteriaText($listCondition, $dto, $period);
     $rsm = new \Doctrine\ORM\Query\ResultSetMapping($this->_em);
     $rsm->addScalarResult('sq_solicitacao', 'sqSolicitacao', 'integer');
     $rsm->addScalarResult('sq_artefato', 'sqArtefato', 'integer');
     $rsm->addScalarResult('no_tipo_assunto_solicitacao', 'noTipoAssuntoSolicitacao', 'string');
     $rsm->addScalarResult('ds_solicitacao', 'dsSolicitacao', 'string');
     $rsm->addScalarResult('sq_pessoa_abertura', 'sqPessoaAbertura', 'integer');
     $rsm->addScalarResult('no_pessoa_abertura', 'noPessoaAbertura', 'string');
     $rsm->addScalarResult('sq_unidade_abertura', 'sqUnidadeAbertura', 'integer');
     $rsm->addScalarResult('no_unidade_abertura', 'noUnidadeAbertura', 'string');
     $rsm->addScalarResult('sq_tipo_status_solicitacao', 'sqTipoStatusSolicitacao', 'integer');
     $rsm->addScalarResult('no_tipo_status_solicitacao', 'noTipoStatusSolicitacao', 'string');
     $rsm->addScalarResult('sq_tipo_assunto_solicitacao', 'sqTipoAssuntoSolicitacao', 'integer');
     $rsm->addScalarResult('sq_pessoa_responsavel', 'sqPessoaResponsavel', 'integer');
     $rsm->addScalarResult('has_image', 'hasImage', 'boolean');
     $rsm->addScalarResult('no_pessoa_atendimento', 'noPessoaAtendimento', 'string');
     $rsm->addScalarResult('dt_operacao', 'dtOperacao', 'string');
     $rsm->addScalarResult('dt_solicitacao', 'dtSolicitacao', 'string');
     $rsm->addScalarResult('nu_artefato', 'nuArtefato', 'string');
     $rsm->addScalarResult('nu_digital', 'nuDigital', 'string');
     $rsm->addScalarResult('sq_tipo_artefato', 'sqTipoArtefato', 'string');
     $rsm->addScalarResult('tx_email', 'txEmail', 'string');
     $rsm->addScalarResult('total_record', 'totalRecord', 'integer');
     $sql = "SELECT COUNT(s.sq_solicitacao) OVER() AS total_record,\n                        s.sq_solicitacao,\n                        s.sq_artefato,\n                        tas.no_tipo_assunto_solicitacao,\n                        s.ds_solicitacao,\n                        s.sq_pessoa as sq_pessoa_abertura,\n                        s.dt_solicitacao,\n                        pes_abertura.no_pessoa || (COALESCE('<br>(' || tel.nu_ddd || ') ' || tel.nu_telefone, '')) as no_pessoa_abertura,\n                        s.sq_unidade_org as sq_unidade_abertura,\n                        und_abertura.sg_unidade_org as no_unidade_abertura,\n                        uss.sq_tipo_status_solicitacao,\n                        uss.no_tipo_status_solicitacao,\n                        tas.sq_tipo_assunto_solicitacao,\n                        uss.sq_pessoa_responsavel,\n                        pes_atendimento.no_pessoa as no_pessoa_atendimento,\n                        uss.dt_operacao,\n                        CASE\n                         WHEN at.nu_digital IS NOT NULL THEN\n                            sgdoce.formata_numero_digital(at.nu_digital)\n                         ELSE\n                            sgdoce.formata_numero_artefato(at.nu_artefato, ap.co_ambito_processo)\n                        END AS nu_artefato,\n                        sgdoce.formata_numero_digital(at.nu_digital) as nu_digital,\n                        taa.sq_tipo_artefato,\n                        EXISTS\n                        (\n                            SELECT\n                                 uia.sq_artefato\n                             FROM\n                                 sgdoce.vw_ultima_imagem_artefato uia\n                             WHERE\n                                 uia.sq_artefato = at.sq_artefato AND\n                                 taa.sq_tipo_artefato = " . \Core_Configuration::getSgdoceTipoArtefatoDocumento() . "\n                        UNION\n                            SELECT\n                                artv.sq_artefato_filho\n                            FROM\n                                sgdoce.artefato_vinculo artv\n                            JOIN sgdoce.artefato_imagem uia ON  uia.st_ativo and artv.sq_artefato_filho = uia.sq_artefato\n                                AND artv.sq_tipo_vinculo_artefato = " . \Core_Configuration::getSgdoceTipoVinculoArtefatoAutuacao() . "\n                            WHERE\n                                artv.sq_artefato_pai = at.sq_artefato AND\n                                taa.sq_tipo_artefato = " . \Core_Configuration::getSgdoceTipoArtefatoProcesso() . "\n                        ) has_image,\n                        em.tx_email\n                   FROM sgdoce.solicitacao s\n                   JOIN sgdoce.tipo_assunto_solicitacao     AS tas USING(sq_tipo_assunto_solicitacao)\n                   LEFT JOIN\n                   (\n                       sgdoce.artefato AS at\n                       INNER JOIN sgdoce.tipo_artefato_assunto AS taa\n                           ON at.sq_tipo_artefato_assunto = taa.sq_tipo_artefato_assunto\n                   )                                        ON s.sq_artefato = at.sq_artefato\n                   LEFT JOIN sgdoce.artefato_processo AS ap ON at.sq_artefato = ap.sq_artefato\n                   JOIN corporativo.vw_pessoa               AS pes_abertura ON s.sq_pessoa = pes_abertura.sq_pessoa\n                   LEFT JOIN corporativo.vw_telefone        AS tel ON (tel.sq_pessoa = pes_abertura.sq_pessoa AND tel.sq_tipo_telefone = " . \Core_Configuration::getCorpTipoTelefoneInstitucional() . ")\n                   JOIN corporativo.vw_unidade_org          AS und_abertura ON s.sq_unidade_org = und_abertura.sq_pessoa\n                   JOIN sgdoce.vw_ultimo_status_solicitacao AS uss ON s.sq_solicitacao = uss.sq_solicitacao\n              LEFT JOIN corporativo.vw_pessoa               AS pes_atendimento ON uss.sq_pessoa_responsavel = pes_atendimento.sq_pessoa\n              LEFT JOIN corporativo.vw_email                AS em ON em.sq_pessoa = s.sq_pessoa AND em.sq_tipo_email = " . \Core_Configuration::getCorpTipoEmailInstitucional() . "\n                  %s\n              ORDER BY s.dt_solicitacao DESC";
     if ($where != "") {
         $sql = sprintf($sql, "WHERE {$where}");
     } else {
         $sql = sprintf($sql, "");
     }
     return $this->_em->createNativeQuery($sql, $rsm)->useResultCache(false);
 }
Exemplo n.º 15
0
 public function autocompleteDocumentsFirstPieceAction()
 {
     $this->_helper->layout->disableLayout();
     $params = $this->_getAllParams();
     $params['sqTipoArtefato'] = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
     $dto = Core_Dto::factoryFromData($params, 'search');
     $result = $this->getService('ArtefatoVinculo')->searchDocumentsFirstPiece($dto);
     if (0 === count($result)) {
         $result = array('__NO_CLICK__' => \Core_Registry::getMessage()->_('MN025') . ' Apenas documentos com imagem são apresentados');
     }
     $this->_helper->json($result);
 }
Exemplo n.º 16
0
 /**
  *
  * @param array $data
  * @param integer $sqArtefato
  */
 private function _getProcessChildrenDocument(array &$data, $sqArtefato)
 {
     $dto = \Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato, 'sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoDocumento(), 'sqPessoaFuncao' => \Core_Configuration::getSgdocePessoaFuncaoOrigem()), 'search');
     $children = $this->getEntityManager()->getRepository('app:ArtefatoVinculo')->findProcessGuiaDocument($dto);
     $data = array_merge($data, $children);
 }
Exemplo n.º 17
0
 public function inserirPeca($params, $tipoVinculo = null)
 {
     try {
         if (is_null($tipoVinculo)) {
             $tipoVinculo = \Core_Configuration::getSgdoceTipoVinculoArtefatoInsercao();
         }
         $TParent = $params['parent']->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getSqTipoArtefato();
         $TProcesso = \Core_Configuration::getSgdoceTipoArtefatoProcesso();
         $TCild = $params['child']->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getSqTipoArtefato();
         $TDocumento = \Core_Configuration::getSgdoceTipoArtefatoDocumento();
         # inserir peca soh pode ser entre:
         #    1º    ->    2º
         #
         if (!($TParent == $TProcesso) && $TCild == $TDocumento) {
             throw new \Exception('** criar código para msg que determine tipos incopativeis ** ');
         }
         $this->_vincular($tipoVinculo, $params);
         $this->_historicoVinculoInserirPeca(array('sqArtefatoPai' => $params['parent']->getSqArtefato(), 'sqArtefatoFilho' => $params['child']->getSqArtefato()), $tipoVinculo);
     } catch (\Exception $exc) {
         dumpd($exc);
     }
 }