/** * @param Core_Model_Entity_Abstract $entity * @param type $dto */ public function preInsert($entity, $searchDto = null, $artefatoProcesso = null, $digital = null) { if ($this->isDocumentoAutuado($searchDto->getNuDigitalAutuado())) { throw new \Exception("Documento já autuado."); } $configs = \Core_Registry::get('configs'); $nuArtefato = null; if ($configs['processo']['numberWithNupSiorg']) { // ATRUBUI NU NUP DA DIGITAL $nuNupSiorg = $digital->getNuDigital()->getNuNupSiorg(); if ($nuNupSiorg == '') { throw new \Exception("Número Nup Siorg não definido."); } $nuArtefato = $nuNupSiorg; } else { $nuArtefato = $this->getServiceLocator()->getService('ProcessoEletronico')->getNovoNumeroProcesso(); $this->getServiceLocator()->getService('SequencialArtefato')->setSequencialProcesso(\Core_Integration_Sica_User::getUserUnit()); } $entity->setNuArtefato($nuArtefato); // PESQUISA TIPO ARTEFATO ASSUNTO. $sqTpArtAssunto = $this->_getRepository('app:TipoArtefatoAssunto')->findOneBy(array('sqAssunto' => $searchDto->getSqAssunto(), 'sqTipoArtefato' => \Core_Configuration::getSgdoceTipoArtefatoProcesso())); if (!$sqTpArtAssunto) { $entityAssunto = $this->getEntityManager()->getPartialReference('app:Assunto', $searchDto->getSqAssunto()); $entityTipoArtefato = $this->getEntityManager()->getPartialReference('app:TipoArtefato', \Core_Configuration::getSgdoceTipoArtefatoProcesso()); $sqTpArtAssunto = $this->_newEntity('app:TipoArtefatoAssunto'); $sqTpArtAssunto->setSqAssunto($entityAssunto); $sqTpArtAssunto->setSqTipoArtefato($entityTipoArtefato); // persistindo informacao $this->getEntityManager()->persist($sqTpArtAssunto); $this->getEntityManager()->flush($sqTpArtAssunto); } $entity->setSqTipoArtefatoAssunto($sqTpArtAssunto); $entity->setDtCadastro(\Zend_Date::now()); $entity->setInEletronico(false); // trantando atributos if ($searchDto->getInDiasCorridos() == '1') { //Corridos $entity->setInDiasCorridos(TRUE); } else { if ($searchDto->getInDiasCorridos() == '0') { //Uteis $entity->setInDiasCorridos(FALSE); } else { $entity->setInDiasCorridos(NULL); } } ## Tipo Prioridade ## $entSqTipoPrioridade = $this->getEntityManager()->getPartialReference('app:TipoPrioridade', $entity->getSqTipoPrioridade()); $entity->setSqTipoPrioridade($entSqTipoPrioridade); }
public function findRequestsToProcess($limit = 100) { $config = \Core_Registry::get('configs'); $queryBuilder = $this->_em->createQueryBuilder(); $queryBuilder->select('smi')->from('app:SolicitacaoMigracaoImagem', 'smi')->innerJoin('smi.sqArtefato', 'a')->innerJoin('smi.sqUnidadeOrg', 'un')->innerJoin('smi.sqPessoa', 'p')->andWhere('smi.stProcessado = FALSE')->andWhere($queryBuilder->expr()->lt('smi.inTentativa', $config['migration']['qtdeTentativa']))->orderBy('smi.dtSolicitacao')->setMaxResults($limit); return $queryBuilder->getQuery()->execute(); }
public function logoSystem() { $infoSystem = Core_Integration_Sica_User::getInfoSystem(); $configs = Core_Registry::get('configs'); $systemId = isset($infoSystem['sqSistema']) ? $infoSystem['sqSistema'] : null; $systemAlias = isset($infoSystem['sgSistema']) ? $infoSystem['sgSistema'] : null; $urlImagem = rtrim($configs['urlSica']) . '/sistema/render-logo/id/' . $systemId; return "<img src=\"{$urlImagem}\" alt=\"{$systemAlias}\" width=\"120\" height=\"70\">"; }
public function editAction() { $entity = $this->getService()->find($this->_getParam('id')); $urlSica = \Core_Registry::get('configs'); $urlSica = rtrim($urlSica['urlSica'], '/') . '/'; if ($entity->getSqUsuarioPessoaJuridica()->getNuCnpj()) { $this->_redirect($urlSica . '/usuario-externo-pessoa-juridica/edit/id/' . $this->_getParam('id')); } else { $this->_redirect($urlSica . '/usuario-externo-pessoa-fisica/edit/id/' . $this->_getParam('id')); } }
/** * Metódo que verifica se o modelo está cadastrado * @return boolean */ public function checkProcessoCadastrado(\Core_Dto_Search $dtoSearch) { $nuArtefato = preg_replace('/[^a-zA-Z0-9]/', '', $dtoSearch->getNuArtefato()); $configs = \Core_Registry::get('configs'); if (strlen($nuArtefato) > 17 && !$configs['processo']['numberWithNupSiorg']) { throw new \Core_Exception_ServiceLayer(\Core_Registry::getMessage()->translate('MN204')); } $return = $this->_getRepository()->findByNuArtefato($nuArtefato); if (count($return) > 0) { throw new \Core_Exception_ServiceLayer(\Core_Registry::getMessage()->translate('MN020')); } else { $nuArtefato = preg_replace('/[^a-zA-Z0-9\\.\\-\\/]/', '', $dtoSearch->getNuArtefato()); $return = $this->_getRepository()->findByNuArtefato($nuArtefato); if (count($return) > 0) { throw new \Core_Exception_ServiceLayer(\Core_Registry::getMessage()->translate('MN020')); } } return FALSE; }
/** * Ação para visualização de imagem de documentos migrados */ public function viewMigrationAction() { $this->getHelper('layout')->setLayout('modal'); $sqArtefato = $this->getRequest()->getParam('id'); // Regras para artefatos de migração. $dtoSearchPai = \Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato), 'search'); $params = $this->_viewSteps(); $entArtefato = $this->getService("Artefato")->find($params['id']); if ($entArtefato->isProcesso() && $this->getService("Artefato")->isMigracao($dtoSearchPai) && $this->getService("Artefato")->isInconsistent($dtoSearchPai)) { $firstItem = current($this->view->treeviewData); $primeiraPeca = current($firstItem['filhos']); $dtoSearch = \Core_Dto::factoryFromData(array('sqArtefato' => $primeiraPeca['sqArtefatoFilho']), 'search'); $hasImagem = $this->getService()->hasArtefatoImagemAtiva($dtoSearch); if (!$hasImagem) { $this->view->entArtefato = $entArtefato; //recupera a 1ª Peça $entPrimeiraPeca = $this->getService('ArtefatoVinculo')->findOneBy(array('sqArtefatoPai' => $entArtefato->getSqArtefato(), 'sqTipoVinculoArtefato' => \Core_Configuration::getSgdoceTipoVinculoArtefatoAutuacao())); //se não tem 1ª Peça não faz nada if (!$entPrimeiraPeca) { $this->render('fail-image-not-first-piece'); } else { $listSolicitacao = $this->getService()->getSolicitacaoMigracaoImagem($dtoSearch); if ($listSolicitacao) { $configs = \Core_Registry::get('configs'); $qtdeTentativa = $configs['migration']['qtdeTentativa']; $entSolicitacao = current($listSolicitacao); if (!$entSolicitacao->getStProcessado() && $entSolicitacao->getInTentativa() == $qtdeTentativa) { $this->render('fail-image-not-process'); } else { $this->render('fail-image-processo'); } } else { $this->render('fail-image-processo'); } } } } $this->view->canOverwrite = false; if (count($this->view->treeviewData) > 0 && !$this->view->hasImage) { $firstItem = current($this->view->treeviewData); $this->view->hasImage = count($firstItem['filhos']) > 0; } if (!$this->view->treeviewData) { $this->view->hasDuplicity = true; } $this->getService('VinculoMigracao')->verificaImagemArvore($this->view->treeviewData); // Verifica se item é de migração e se tem imagem, se não tiver, adicionar uma solicitação de migração de imagem if (isset($params['view']) && $params['view'] == 'migracao') { if ($this->getService("Artefato")->isInconsistent($dtoSearchPai, true)) { $this->view->canOverwrite = true; } $this->view->id = $params['id']; $this->render('view-migracao'); } else { $this->render('view'); } $isAllowedAlter = in_array(\Core_Integration_Sica_User::getUserProfile(), $this->getService()->getUsersAllowedAlterImage()); $inMyDashboard = $this->getService("Artefato")->inMyDashboard($dtoSearchPai->getSqArtefato()); $this->view->canAlterImage = $isAllowedAlter && $inMyDashboard; $this->view->sqTipoArtefato = $entArtefato->getSqTipoArtefatoAssunto()->getSqTipoArtefato()->getSqTipoArtefato(); }
public function findLogo($identifier) { $configs = \Core_Registry::get('configs'); $path = realpath($configs['upload']['sistema']['destination']); if (!is_writable($path)) { return; } $imagem = $this->find($identifier); if (!$imagem instanceof \Sica\Model\Entity\Sistema || !$imagem->getTxEnderecoImagem()) { return; } $filename = $path . '/' . $imagem->getTxEnderecoImagem(); if (!is_writable($filename) || !file_exists($filename)) { return; } return $filename; }
/** * Faz o upload do arquivo * @param array $params Parâmetros http * @return string Retorna o basename do arquivo enviado */ public function upload($params) { $registry = \Core_Registry::get('configs'); $maxSize = $registry['upload']['carimboMaxSize']; $adapter = $this->getFileTransferAdapter(); $adapter->addValidator('Extension', FALSE, 'png')->addValidator('Size', TRUE, array('max' => $maxSize)); $errorCodes = array(); $errorCodes['fileExtensionFalse'] = str_replace('<extensão>', '.png', \Core_Registry::getMessage()->translate('MN076')); $errorCodes['fileSizeTooBig'] = str_replace('<tamanho>', $maxSize, \Core_Registry::getMessage()->translate('MN077')); $uploadErrors = array(); if (!$adapter->isValid()) { $errors = $adapter->getErrors(); foreach ($errors as $error) { if (isset($errorCodes[$error])) { $uploadErrors[] = $errorCodes[$error]; } } if (empty($uploadErrors)) { $msg = 'Erro na operação'; } else { $msg = implode('<br />', $uploadErrors); } throw new \Core_Exception_ServiceLayer($msg); } $info = $adapter->getFileInfo(); $this->isAlphaPng($info['deCaminhoArquivo']['tmp_name']); $this->isValidSize($info['deCaminhoArquivo']['tmp_name']); $path = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'carimbo' . DIRECTORY_SEPARATOR; if (!$this->fileExists($path)) { throw new \Core_Exception_ServiceLayer("MN111"); } if (!is_writable($path)) { throw new \Core_Exception_ServiceLayer("MN110"); } // pegando os dados do documento $currentFile = $info['deCaminhoArquivo']['name']; $newFile = $this->getUploadedFilename($info['deCaminhoArquivo']['name']); $data = array('de_caminho_arquivo' => date('Ymdhis') . "_" . $info['deCaminhoArquivo']['name']); $newFile = $path . $data['de_caminho_arquivo']; $adapter->addFilter('Rename', array('source' => $info['deCaminhoArquivo']['tmp_name'], 'target' => $newFile, 'overwrite' => TRUE)); // adicionando no temp $this->addTemp($data); // colocando o arquivo na pasta $adapter->receive($currentFile); if (!$this->fileExists($newFile)) { throw new \Core_Exception_ServiceLayer("MN109"); } return basename($newFile); }
/** * Ação para download de anexos */ public function downloadAnexoAction() { $this->_helper->layout->disableLayout(); $this->_helper->viewRenderer->setNoRender(TRUE); $resultAnexo = $this->getService()->find($this->_request->get('id')); $registry = \Core_Registry::get('configs'); $path = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'carimbo' . DIRECTORY_SEPARATOR; $address = $path . $resultAnexo->getDeCaminhoArquivo(); $fsize = filesize($address); $nameArquivo = basename($address); $extensao = substr($nameArquivo, strpos($nameArquivo, ".") + 1); header("Pragma: public"); // required header("Expires: 0"); header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Cache-Control: private", FALSE); // required for certain browsers header("Content-Type: image/png"); header("Content-Transfer-Encoding: binary"); header("Content-Length: " . $fsize); ob_clean(); flush(); readfile($address); }
public function update(array $postData) { $configs = \Core_Registry::get('configs'); if (!$postData['sqPessoaAssinaturaAbertura'] && $postData['sqPessoaAssinaturaAberturaBD_hidden']) { $postData['sqPessoaAssinaturaAbertura'] = $postData['sqPessoaAssinaturaAberturaBD_hidden']; } if (!$postData['sqPessoaAssinaturaEncerramento'] && $postData['sqPessoaAssinaturaEncerramentoBD_hidden']) { $postData['sqPessoaAssinaturaEncerramento'] = $postData['sqPessoaAssinaturaEncerramentoBD_hidden']; } $dtoVolume = \Core_Dto::factoryFromData($postData, 'search'); if ($dtoVolume->getNuFolhaFinal() && (int) $dtoVolume->getNuFolhaFinal() <= (int) $dtoVolume->getNuFolhaInicial()) { throw new \Core_Exception_ServiceLayer('A Folha Final deve ser maior que a Folha Inicial.'); } if ((int) $dtoVolume->getNuFolhaFinal() - (int) $dtoVolume->getNuFolhaInicial() > (int) $configs['volume']['maxPagePerVolume']) { throw new \Core_Exception_ServiceLayer('Volume não pode ter mais de 200 páginas.'); } $hasDemandaAlterarVolume = $this->getServiceLocator()->getService('Solicitacao')->hasDemandaAbertaByAssuntoPessoaResponsavel(\Core_Dto::factoryFromData(array('sqArtefato' => $dtoVolume->getSqArtefato(), 'sqTipoAssuntoSolicitacao' => \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoVolumeDeProcesso()), 'search')); $entVolume = $this->_getRepository()->find($dtoVolume->getSqVolume()); if (\Zend_Registry::get('isUserSgi') && !$hasDemandaAlterarVolume && $this->_checkArtefatoLastTramite($entVolume) < 1) { throw new \Core_Exception_ServiceLayer(\Core_Registry::getMessage()->translate('MN147')); } $entArtefato = $this->getEntityManager()->getPartialReference('app:Artefato', $dtoVolume->getSqArtefato()); $entPessAbertura = $this->getEntityManager()->getPartialReference('app:VwPessoa', $dtoVolume->getSqPessoaAbertura()); $entUOrgAbertura = $this->getEntityManager()->getPartialReference('app:VwUnidadeOrg', $dtoVolume->getSqUnidadeOrgAbertura()); $entPessAssAbertura = $this->getEntityManager()->getPartialReference('app:VwPessoa', $dtoVolume->getSqPessoaAssinaturaAbertura()); $sqPessoaAbertura = \Core_Integration_Sica_User::getPersonId(); $sqUnidadeOrgAbertura = \Core_Integration_Sica_User::getUserUnit(); $entVolume->setSqVolume($dtoVolume->getSqVolume())->setSqArtefato($entArtefato)->setNuVolume($dtoVolume->getNuVolume())->setNuFolhaInicial($dtoVolume->getNuFolhaInicial())->setDtAbertura($dtoVolume->getDtAbertura())->setSqPessoaAbertura($entPessAbertura)->setSqUnidadeOrgAbertura($entUOrgAbertura)->setSqPessoaAssinaturaAbertura($entPessAssAbertura); if ($dtoVolume->getSqCargoAssinaturaAbertura()) { $entCargoAbertura = $this->getEntityManager()->getPartialReference('app:VwCargo', $dtoVolume->getSqCargoAssinaturaAbertura()); $entVolume->setSqCargoAssinaturaAbertura($entCargoAbertura)->setSqFuncaoAssinaturaAbertura(NULL); } else { $entFuncaoAbertura = $this->getEntityManager()->getPartialReference('app:VwFuncao', $dtoVolume->getSqFuncaoAssinaturaAbertura()); $entVolume->setSqFuncaoAssinaturaAbertura($entFuncaoAbertura)->setSqCargoAssinaturaAbertura(NULL); } if ($dtoVolume->getNuFolhaFinal()) { $entPessEncerramento = $this->getEntityManager()->getPartialReference('app:VwPessoa', \Core_Integration_Sica_User::getPersonId()); $entUOrgEncerramento = $this->getEntityManager()->getPartialReference('app:VwUnidadeOrg', (int) \Core_Integration_Sica_User::getUserUnit()); $entPessAssEncerramento = $this->getEntityManager()->getPartialReference('app:VwPessoa', $dtoVolume->getSqPessoaAssinaturaEncerramento()); $entVolume->setNuFolhaFinal($dtoVolume->getNuFolhaFinal())->setDtEncerramento($dtoVolume->getDtEncerramento())->setSqPessoaEncerramento($entPessEncerramento)->setSqUnidadeOrgEncerramento($entUOrgEncerramento)->setSqPessoaAssinaturaEncerramento($entPessAssEncerramento); if ($dtoVolume->getSqCargoAssinaturaEncerramento()) { $entCargoEncerramento = $this->getEntityManager()->getPartialReference('app:VwCargo', $dtoVolume->getSqCargoAssinaturaEncerramento()); $entVolume->setSqCargoAssinaturaEncerramento($entCargoEncerramento)->setSqFuncaoAssinaturaEncerramento(NULL); } else { $entFuncaoEncerramento = $this->getEntityManager()->getPartialReference('app:VwFuncao', $dtoVolume->getSqFuncaoAssinaturaEncerramento()); $entVolume->setSqFuncaoAssinaturaEncerramento($entFuncaoEncerramento)->setSqCargoAssinaturaEncerramento(NULL); } } else { $entVolume->setNuFolhaFinal(NULL)->setDtEncerramento(NULL)->setSqPessoaEncerramento(NULL)->setSqUnidadeOrgEncerramento(NULL)->setSqPessoaAssinaturaEncerramento(NULL)->setSqCargoAssinaturaEncerramento(NULL)->setSqFuncaoAssinaturaEncerramento(NULL); } $this->getEntityManager()->persist($entVolume); $this->getEntityManager()->flush(); }
public function getCoreUpload() { $configs = \Core_Registry::get('configs'); return new \Core_Upload('Http', false, $configs['upload']['documento']); }
/** * @return type * @throws RuntimeException */ public function saveAction() { if (!$this->_request->isPost()) { throw new RuntimeException('A requisição deve ser POST'); } $isValid = true; if ($this->getRequest()->getParam('stProcessoVolume', false)) { $this->getRequest()->setPost('sqPessoaAbertura', \Core_Integration_Sica_User::getPersonId()); $this->getRequest()->setPost('sqUnidadeOrgAbertura', (int) \Core_Integration_Sica_User::getUserUnit()); } else { $sqArtefato = (int) $this->getRequest()->getParam('id'); $volume = $this->getService()->getLastVolumeAberto($sqArtefato); $params = $this->_getAllParams(); $configs = \Core_Registry::get('configs'); if ($params['nuFolhaFinal'] - $params['nuFolhaInicial'] <= (int) $configs['volume']['maxPagePerVolume']) { $sqPessoaAbertura = $volume->getSqPessoaAbertura() ? $volume->getSqPessoaAbertura()->getSqPessoa() : 0; $sqUnidadeOrgAbertura = $volume->getSqUnidadeOrgAbertura() ? $volume->getSqUnidadeOrgAbertura()->getSqUnidadeOrg() : 0; $this->getRequest()->setPost('sqVolume', $volume->getSqVolume()); $this->getRequest()->setPost('sqPessoaAbertura', $sqPessoaAbertura); $this->getRequest()->setPost('sqUnidadeOrgAbertura', $sqUnidadeOrgAbertura); if ($volume->getSqPessoaAssinaturaAbertura() && $volume->getSqCargoAssinaturaAbertura()) { $this->getRequest()->setPost('sqPessoaAssinaturaAbertura', $volume->getSqPessoaAssinaturaAbertura()->getSqPessoa()); $this->getRequest()->setPost('sqCargoAssinaturaAbertura', $volume->getSqCargoAssinaturaAbertura()->getSqCargo()); } if ($volume->getSqPessoaAssinaturaAbertura() && $volume->getSqFuncaoAssinaturaAbertura()) { $this->getRequest()->setPost('sqPessoaAssinaturaAbertura', $volume->getSqPessoaAssinaturaAbertura()->getSqPessoa()); $this->getRequest()->setPost('sqFuncaoAssinaturaAbertura', $volume->getSqFuncaoAssinaturaAbertura()->getSqFuncao()); } $this->getRequest()->setPost('sqPessoaEncerramento', \Core_Integration_Sica_User::getPersonId()); $this->getRequest()->setPost('sqUnidadeOrgEncerramento', (int) \Core_Integration_Sica_User::getUserUnit()); $this->_optionsDtoEntity['mapping'] = array_merge($this->_optionsDtoEntity['mapping'], array('sqPessoaAssinaturaEncerramento' => array('sqPessoa' => 'Sgdoce\\Model\\Entity\\VwPessoa'), 'sqCargoAssinaturaEncerramento' => array('sqCargo' => 'Sgdoce\\Model\\Entity\\VwCargo'), 'sqFuncaoAssinaturaEncerramento' => array('sqFuncao' => 'Sgdoce\\Model\\Entity\\VwFuncao'), 'sqPessoaEncerramento' => array('sqPessoa' => 'Sgdoce\\Model\\Entity\\VwPessoa'), 'sqUnidadeOrgEncerramento' => array('sqUnidadeOrg' => 'Sgdoce\\Model\\Entity\\VwUnidadeOrg'))); } else { $isValid = false; $this->getMessaging()->addErrorMessage('Volume não pode ter mais de 200 páginas.', 'User'); } } if ($isValid) { $entity = $this->_save(); $this->getService()->finish(); $this->_addMessageSave(); return $this->_redirect("/artefato/volume/termo/id/" . $entity->getSqVolume()); } $this->getMessaging()->dispatchPackets(); $sqTipoArtefato = \Core_Configuration::getSgdoceTipoArtefatoProcesso(); return $this->_redirect("/artefato/area-trabalho/index/tipoArtefato/{$sqTipoArtefato}/caixa/minhaCaixa"); }
public function searchDocumentsFirstPiece(\Core_Dto_Search $dto) { $sqArtefato = $dto->getExtraParam(); $rsPesArtOrigem = $this->_getRepository('app:PessoaArtefato')->findBy(array('sqArtefato' => $sqArtefato, 'sqPessoaFuncao' => \Core_Configuration::getSgdocePessoaFuncaoOrigem())); $entPesArtOrigem = current($rsPesArtOrigem); $isExterno = !$entPesArtOrigem->getStProcedencia(); $configs = \Core_Registry::get('configs'); $dataEntradaProducao = $configs['dataEntradaProducao']; $entArtefato = $this->_getRepository('app:Artefato')->find($sqArtefato); $dtCadastro = $entArtefato->getDtCadastro(); $dtEntradaProducao = new \Zend_Date($dataEntradaProducao); $isLegado = false; if ($dtEntradaProducao->compare($dtCadastro)) { $isLegado = true; } $data = $this->_getRepository()->searchDocumentsToFirstPiece($dto, $isExterno, $isLegado); $sqTipoArtefato = $dto->getSqTipoArtefato(); $field = "nuDigital"; if ($sqTipoArtefato == \Core_Configuration::getSgdoceTipoArtefatoProcesso()) { $field = "nuArtefato"; } $result = array(); foreach ($data as $value) { $result[$value['sqArtefato']] = $value[$field]; } return $result; }
/** * método que retorna dados para grid * @param \Core_Dto_Abstract $dto * @return \Doctrine\ORM\NativeQuery */ public function listGridHistorico(\Core_Dto_Search $dto) { $configs = \Core_Registry::get('configs'); $dataEntradaProducao = $configs['dataEntradaProducao']; $strSql = "WITH\n artef AS (\n select {$dto->getSqArtefato()} as sq_artefato\n ),\n hist AS (\n SELECT tx_descricao_operacao AS tx_operacao\n ,to_char(dt_ocorrencia,'dd/mm/yyyy HH24:MI:SS') AS dt_operacao\n ,dt_ocorrencia AS dt_ordenacao\n ,p.no_pessoa\n ,uo.sg_unidade_org AS no_unidade_org\n FROM historico_artefato ha\n JOIN artef ON ha.sq_artefato = artef.sq_artefato\n JOIN vw_pessoa p USING(sq_pessoa)\n JOIN vw_unidade_org uo ON ha.sq_unidade_org = uo.sq_pessoa\n WHERE ha.dt_ocorrencia >= :dataEntradaProducao\n ),\n tramite AS (\n SELECT CASE WHEN ta.sq_pessoa_destino_interno IS NULL THEN\n 'Tramitado para ' || pesDest.no_pessoa ||' em ' || to_char(ta.dt_tramite,'dd/mm/yyyy HH24:MI:SS')\n ELSE\n 'Tramitado para ' || pesDest.no_pessoa || ' [' || pesDestInt.no_pessoa || ']' || ' em ' || to_char(ta.dt_tramite,'dd/mm/yyyy HH24:MI:SS')\n END AS tx_operacao\n ,to_char(ta.dt_tramite,'dd/mm/yyyy HH24:MI:SS') AS dt_operacao\n ,ta.dt_tramite AS dt_ordenacao\n ,pes.no_pessoa\n ,uo.sg_unidade_org AS no_unidade_org\n FROM tramite_artefato ta\n JOIN artef ON artef.sq_artefato = ta.sq_artefato\n JOIN vw_pessoa pes ON pes.sq_pessoa = ta.sq_pessoa_tramite\n JOIN vw_unidade_org uo ON uo.sq_pessoa = ta.sq_unidade_org_tramite\n JOIN vw_pessoa pesDest ON ta.sq_pessoa_destino = pesDest.sq_pessoa\n LEFT JOIN vw_pessoa pesDestInt ON ta.sq_pessoa_destino_interno = pesDestInt.sq_pessoa\n WHERE ta.dt_tramite is not null\n AND ta.nu_tramite <> 1\n AND ta.sq_status_tramite IN (1,2,3)\n AND ta.dt_tramite >= :dataEntradaProducao\n ),\n recebimento AS(\n SELECT 'Trâmite recebido em ' || to_char(ta.dt_recebimento,'dd/mm/yyyy HH24:MI:SS') AS tx_operacao\n ,to_char(ta.dt_recebimento,'dd/mm/yyyy HH24:MI:SS') AS dt_operacao\n ,ta.dt_recebimento AS dt_ordenacao\n ,pes.no_pessoa\n ,uo.sg_unidade_org AS no_unidade_org\n FROM tramite_artefato ta\n JOIN artef ON artef.sq_artefato = ta.sq_artefato\n JOIN vw_pessoa pes ON pes.sq_pessoa = ta.sq_pessoa_recebimento\n JOIN vw_unidade_org uo ON uo.sq_pessoa = ta.sq_pessoa_destino\n WHERE ta.dt_recebimento IS NOT NULL\n AND ta.nu_tramite <> 1\n AND ta.dt_tramite >= :dataEntradaProducao\n ),\n cancelamento AS (\n SELECT\n 'Trâmite cancelado em ' || to_char(ta.dt_cancelamento,'dd/mm/yyyy HH24:MI:SS') AS tx_operacao\n ,to_char(ta.dt_cancelamento,'dd/mm/yyyy HH24:MI:SS') AS dt_operacao\n ,ta.dt_cancelamento AS dt_ordenacao\n ,pes.no_pessoa\n ,uo.sg_unidade_org AS no_unidade_org\n FROM tramite_artefato ta\n JOIN artef ON artef.sq_artefato = ta.sq_artefato\n JOIN vw_pessoa pes ON pes.sq_pessoa = ta.sq_pessoa_tramite\n JOIN vw_unidade_org uo ON uo.sq_pessoa = ta.sq_unidade_org_tramite\n WHERE ta.dt_cancelamento IS NOT NULL\n AND ta.dt_tramite >= :dataEntradaProducao\n ),\n devolucao AS(\n SELECT\n 'Trâmite devolvido em ' || to_char(ta.dt_devolucao,'dd/mm/yyyy HH24:MI:SS') AS tx_operacao\n ,to_char(ta.dt_devolucao,'dd/mm/yyyy HH24:MI:SS') AS dt_operacao\n ,ta.dt_devolucao AS dt_ordenacao\n ,pes.no_pessoa\n ,uo.sg_unidade_org AS no_unidade_org\n FROM tramite_artefato ta\n JOIN artef ON artef.sq_artefato = ta.sq_artefato\n JOIN vw_pessoa pes ON pes.sq_pessoa = ta.sq_pessoa_tramite\n JOIN vw_unidade_org uo ON uo.sq_pessoa = ta.sq_unidade_org_tramite\n WHERE ta.dt_devolucao IS NOT NULL\n AND ta.dt_tramite >= :dataEntradaProducao\n )\n\n SELECT\n COUNT(dt_operacao) over() as total_record, *\n FROM(\n SELECT * FROM hist\n UNION ALL\n SELECT * FROM tramite\n UNION ALL\n SELECT * FROM recebimento\n UNION ALL\n SELECT * FROM cancelamento\n UNION ALL\n SELECT * FROM devolucao\n ) t\n ORDER BY dt_ordenacao DESC"; $rsm = new \Doctrine\ORM\Query\ResultSetMapping($this->_em); $rsm->addScalarResult('total_record', 'totalRecord', 'integer'); $rsm->addScalarResult('tx_operacao', 'txOperacao', 'string'); $rsm->addScalarResult('no_pessoa', 'noPessoa', 'string'); $rsm->addScalarResult('no_unidade_org', 'noUnidadeOrg', 'string'); $rsm->addScalarResult('dt_operacao', 'dtOperacao', 'zenddate'); $nativeQuery = $this->_em->createNativeQuery($strSql, $rsm); $nativeQuery->setParameter('dataEntradaProducao', $dataEntradaProducao); $nativeQuery->useResultCache(false); return $nativeQuery; }
/** * metod que realiza o upload e a persistencia do Arquivo */ protected function _upload($dto) { $configs = \Core_Registry::get('configs'); $upload = new \Zend_File_Transfer_Adapter_Http(); $files = $upload->getFileInfo(); $filesUp = array(); $return = array(); $error = false; foreach ($files as $file => $info) { $upload->setDestination($configs['upload']['material']); $upload->setValidators(array()); $upload->addValidator('Size', TRUE, array('max' => $configs['upload']['materialApoioMaxSize'], 'messages' => "O tamanho do arquivo é superior ao permitido. O tamanho permitido é 25MB.")); $upload->addValidator('ExcludeExtension', TRUE, array('dll', 'msi', 'phtml', 'phar', 'pyc', 'py', 'jar', 'bat', 'com', 'exe', 'pif', 'bin', 'sh', 'pl', 'php') + array('messages' => "Extensão do arquivo inválida.")); $upload->getValidator('Upload')->setMessages(array('fileUploadErrorNoFile' => "Arquivo não selecionado.")); if ($upload->isValid($file)) { $fileinfo = pathinfo($info['name']); $upload->receive($file); $filesUp[] = $upload->getFileName($file); $return[] = array('name' => $upload->getFileName($file)); } else { $error = $upload->getMessages(); break; } } if ($error) { if (count($filesUp)) { foreach ($filesUp as $file) { unlink($file); } } return array('errors' => $error); } return $return; }
private function _checkSendEmail() { $configs = \Core_Registry::get('configs'); return $configs['merge_pdf']['mail']['sendStatus']; }
public function getCoreUpload() { $configs = \Core_Registry::get('configs'); return new \Core_Upload('Http', FALSE, $configs['upload']['rodape']); }
private function _getMergePdfConfigs($key = NULL) { if (is_null($this->_configsMergePdf)) { $configs = \Core_Registry::get('configs'); $this->_configsMergePdf = $configs['merge_pdf']; } if (is_null($key)) { return $this->_configsMergePdf; } else { return $this->_configsMergePdf[$key]; } }
/** * Metdo responsavel por persistir os uploads * @param type $destino * @param type $thumb * @param type $validFile * @param type $invalidFile * @return type */ public static function upload($destino = 'anexoArtefato', $thumb = FALSE, $validFile = TRUE, $invalidFile = TRUE, $validImageSize = TRUE) { $configs = \Core_Registry::get('configs'); $upload = new \Zend_File_Transfer_Adapter_Http(); $files = $upload->getFileInfo(); $filesUp = array(); $return = array(); $error = false; $pasta = 'anexo-material'; if ($destino == 'anexoArtefato') { $pasta = 'anexo-artefato'; } $path = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . $pasta . DIRECTORY_SEPARATOR; foreach ($files as $file => $info) { $upload = new \Zend_File_Transfer_Adapter_Http(); $upload->setDestination($path); $upload->setValidators(array()); $upload->addValidator('Size', TRUE, array('max' => '100MB', 'messages' => "O tamanho do arquivo é superior ao permitido. O tamanho permitido é 100MB.")); self::_invalidFile($invalidFile, $upload); self::_validFile($validFile, $upload); self::_validImageSize($validImageSize, $upload); self::_getValidator($upload); if ($upload->isValid($file)) { $fileinfo = pathinfo($info['name']); $upload->receive($file); $filesUp[] = $upload->getFileName($file); $return[] = array('name' => $upload->getFileName($file), 'size' => $upload->getFileSize($file)); } else { $error = $upload->getMessages(); break; } } if ($error) { if (count($filesUp)) { foreach ($filesUp as $file) { unlink($file); } } return array('errors' => $error); } if ($thumb) { $pasta = current(explode('application', __DIR__)) . 'data' . DIRECTORY_SEPARATOR . 'upload' . DIRECTORY_SEPARATOR . 'thumbs' . DIRECTORY_SEPARATOR; foreach ($filesUp as $endereco) { $fileinfo = pathinfo($endereco); $image = \WideImage::load($endereco); $image->resize(300, 300, 'outside')->crop('50% - 150', '50% - 150', 300, 300)->saveToFile($pasta . $fileinfo['filename'] . '_300_X_300.' . strtolower($fileinfo['extension'])); $image->resize(133, 89, 'outside')->crop('50% - 67', '50% - 45', 133, 89)->saveToFile($pasta . $fileinfo['filename'] . '_133_X_89.' . strtolower($fileinfo['extension'])); } } return $return; }