/** * LISTA DE TIPO DE ASSUNTO DE SOLICITAÇÃO. * * @param \Core_Dto_Search $dto * @param string $sort * @param string $order * @return array */ public function listTipoAssuntoSolicitacao($dto, $sort = 'a.noTipoAssuntoSolicitacao', $order = 'ASC') { $queryBuilder = $this->_em->createQueryBuilder()->select('a.sqTipoAssuntoSolicitacao, a.noTipoAssuntoSolicitacao, a.inTipoParaArtefato')->from('app:TipoAssuntoSolicitacao', 'a')->orderBy($sort, $order); if ($dto->getQuery() != "") { $search = mb_strtolower($dto->getQuery(), 'UTF-8'); $noTipoAssuntoSolicitacao = $queryBuilder->expr()->lower($queryBuilder->expr()->trim('a.noTipoAssuntoSolicitacao')); $queryBuilder->where($queryBuilder->expr()->like('clear_accentuation(' . $noTipoAssuntoSolicitacao . ')', $queryBuilder->expr()->literal($this->removeAccent('%' . $search . '%')))); } $inTipoParaArtefato = $dto->getInTipoParaArtefato(); if (!is_null($inTipoParaArtefato)) { $paraArtefato = $dto->getInTipoParaArtefato() > 0 ? '1' : '0'; $queryBuilder->andWhere("a.inTipoParaArtefato = :inTipoParaArtefato")->setParameter(":inTipoParaArtefato", $paraArtefato); if ($paraArtefato) { $arrAssuntoProcesso = array(\Core_Configuration::getSgdoceTipoAssuntoSolicitacaoComentario(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoDespacho(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoAlterarCadastro(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoVolumeDeProcesso(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoDesanexaProcesso(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoDesmembraPecas(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoRemoverPeca()); $arrAssuntoDocumento = array(\Core_Configuration::getSgdoceTipoAssuntoSolicitacaoComentario(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoAlterarCadastro(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoDespacho(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoDesanexaDigital(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoExcluirImagem()); $arrAssunto = $inTipoParaArtefato == \Core_Configuration::getSgdoceTipoArtefatoProcesso() ? $arrAssuntoProcesso : $arrAssuntoDocumento; $queryBuilder->andWhere("a.sqTipoAssuntoSolicitacao IN(:sqTipoAssuntoSolicitacaoiIn)")->setParameter(":sqTipoAssuntoSolicitacaoiIn", $arrAssunto); } } $queryBuilder->andWhere("a.stRegistroAtivo = :stRegistroAtivo")->setParameter(":stRegistroAtivo", TRUE); return $queryBuilder->getQuery()->useResultCache(TRUE, NULL, __METHOD__)->execute(); }
public function getTipoAssuntoSolcOnlyConsistent() { return array(\Core_Configuration::getSgdoceTipoAssuntoSolicitacaoAlterarCadastro(), \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoVolumeDeProcesso()); }
/** * implementa a regra de negócio para remover o volume * * @param integer * @throws Exception * @return Volume * */ public function preDelete($id) { $entity = $this->_getRepository()->find($id); # apenas usuário SGI pode excluir if (!\Zend_Registry::get('isUserSgi')) { throw new \Exception(\Core_Registry::getMessage()->translate('MN203')); } $arrFromData = array('sqArtefato' => $entity->getSqArtefato()->getSqArtefato(), 'sqTipoAssuntoSolicitacao' => \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoVolumeDeProcesso()); $hasDemandaExcluirVolume = $this->getServiceLocator()->getService('Solicitacao')->hasDemandaAbertaByAssuntoPessoaResponsavel(\Core_Dto::factoryFromData($arrFromData, 'search')); # tem que ter demanda de exclusão if (!$hasDemandaExcluirVolume) { throw new \Exception(\Core_Registry::getMessage()->translate('MN047')); } return $this; }
public function listAction() { $dto = Core_Dto::factoryFromData($this->_getAllParams(), 'search'); $sqArtefato = $dto->getSqArtefato(); $this->view->lastVolume = $this->getService()->getLastVolume($sqArtefato); $this->view->hasTramiteEfetivo = $this->getService('Artefato')->hasTramiteEfetivo($dto); $this->view->limitComment = self::T_ARTEFATO_VOLUME_LIMIT_COMMENT_GRID; $this->view->hasPermission = $this->getService()->checkPermisionArtefato($sqArtefato); $this->view->notTheOnlyVolume = $this->getService()->checkIfVolumeCanBeDeleted($sqArtefato); $this->view->hasDemandaVolumeDeProcesso = $this->getServiceLocator()->getService('Solicitacao')->hasDemandaAbertaByAssuntoPessoaResponsavel(\Core_Dto::factoryFromData(array('sqArtefato' => $sqArtefato, 'sqTipoAssuntoSolicitacao' => \Core_Configuration::getSgdoceTipoAssuntoSolicitacaoVolumeDeProcesso()), 'search')); parent::listAction(); $this->getMessaging()->dispatchPackets(); }