Esempio n. 1
0
 /**
  * @param type $entity
  * @param type $dto
  */
 public function postSave($entity, $dto = NULL)
 {
     if ($entity->getNuFolhaFinal()) {
         $entArtefatoProcesso = $this->_getRepository('app:ArtefatoProcesso')->find($entity->getSqArtefato()->getSqArtefato());
         $entArtefatoProcesso->setNuVolume($entity->getNuVolume());
         $entArtefatoProcesso->setNuPaginaProcesso($entity->getNuFolhaFinal());
         $this->getEntityManager()->merge($entArtefatoProcesso);
         $this->getEntityManager()->flush();
     }
 }
 /**
  * @param type $entity
  * @param type $dto
  */
 public function postInsert($entity, $dto = NULL)
 {
     // Salvando histórico.
     $txNumeroPecas = $entity->getTxNumeroPecas();
     $sqArtefato = $entity->getSqArtefato()->getSqArtefato();
     $artefatoEnt = $this->getServiceLocator()->getService('Artefato')->find($sqArtefato);
     $nuArtefato = $artefatoEnt->getNuArtefato();
     if ($entity->getStDesmembramento()) {
         $sqArtefatoDestino = $entity->getSqArtefatoDestino()->getSqArtefato();
         $artefatoDestinoEnt = $this->getServiceLocator()->getService('Artefato')->find($sqArtefatoDestino);
         $nuArtefatoDestino = $artefatoDestinoEnt->getNuArtefato();
         // #HistoricoArtefato::save();
         $strMessage = $this->getServiceLocator()->getService('HistoricoArtefato')->getMessage('MH010', $txNumeroPecas, $nuArtefato, $nuArtefatoDestino);
     } else {
         // #HistoricoArtefato::save();
         $strMessage = $this->getServiceLocator()->getService('HistoricoArtefato')->getMessage('MH011', $txNumeroPecas, $nuArtefato);
     }
     $this->getServiceLocator()->getService('HistoricoArtefato')->registrar($sqArtefato, \Core_Configuration::getSgdoceSqOcorrenciaCadastrar(), $strMessage);
 }
Esempio n. 3
0
 /**
  * @param type $dto
  * @return type
  */
 protected function _inserirTramite($dto)
 {
     $this->getEntityManager()->getConnection()->beginTransaction();
     try {
         $objUltTramiteArtefato = $this->getServiceLocator()->getService('TramiteArtefato')->findBy(array('sqArtefato' => $dto->getSqArtefato()));
         $objUltTramiteArtefato = current($objUltTramiteArtefato);
         $entArtefato = $this->getEntityManager()->getPartialReference('app:Artefato', $dto->getSqArtefato());
         if ($objUltTramiteArtefato instanceof \Sgdoce\Model\Entity\TramiteArtefato) {
             // RECEBE ARTEFATO.
             $entStatusTramite = $this->getEntityManager()->getPartialReference('app:StatusTramite', \Core_Configuration::getSgdoceStatusTramiteRecebido());
             $entPessoa = $this->getEntityManager()->getPartialReference('app:VwPessoa', \Core_Integration_Sica_User::getPersonId());
             $entPessoaDestino = $this->getEntityManager()->getPartialReference('app:VwPessoa', \Core_Integration_Sica_User::getUserUnit());
             $entUnidadeOrg = $this->getEntityManager()->getPartialReference('app:VwUnidadeOrg', \Core_Integration_Sica_User::getUserUnit());
             $newTramiteArtefato = $this->_newEntity('app:TramiteArtefato');
             $artefatoDto = \Core_Dto::factoryFromData(array('sqArtefato' => $dto->getSqArtefato()), 'search');
             $nextNuTramite = $this->getServiceLocator()->getService('TramiteArtefato')->getNextTramiteNumber($artefatoDto);
             $newTramiteArtefato->setSqArtefato($entArtefato);
             $newTramiteArtefato->setSqPessoaTramite($entPessoa);
             $newTramiteArtefato->setSqUnidadeOrgTramite($entUnidadeOrg);
             $newTramiteArtefato->setSqPessoaDestino($entPessoaDestino);
             $newTramiteArtefato->setSqPessoaDestinoInterno($entPessoa);
             $newTramiteArtefato->setSqPessoaRecebimento($entPessoa);
             $newTramiteArtefato->setSqStatusTramite($entStatusTramite);
             $newTramiteArtefato->setNuTramite($nextNuTramite);
             $newTramiteArtefato->setDtTramite(\Zend_Date::now());
             $newTramiteArtefato->setDtRecebimento(\Zend_Date::now()->addSecond(1));
             $newTramiteArtefato->setInImpresso(true);
             $this->getEntityManager()->persist($newTramiteArtefato);
             $this->getEntityManager()->flush($newTramiteArtefato);
         } else {
             $newTramiteArtefato = $this->getServiceLocator()->getService('TramiteArtefato')->insertFirstTramite($dto->getSqArtefato());
         }
         $this->getEntityManager()->getConnection()->commit();
     } catch (\Exception $e) {
         $this->getEntityManager()->getConnection()->rollback();
         throw $e;
     }
     return $newTramiteArtefato;
 }
 /**
  * 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;
 }
Esempio n. 5
0
 /**
  * Metodo responsavel por modificar setar o verso
  * @param type $dto
  * @return type
  */
 public function setaVersoBranco($dto)
 {
     //recuperando anexo e setando novo valor
     $criteria = array('sqAnexoArtefato' => $dto->getSqAnexoArtefato());
     $sqAnexoArtefato = $this->_getRepository()->findOneBy($criteria);
     $sqAnexoArtefato->setInVersoBranco($dto->getInValueBranco());
     $this->getEntityManager()->persist($sqAnexoArtefato);
     $this->getEntityManager()->flush();
     // corrigindo a ordenacao das imagens na base
     $this->reordenandoImagens($dto->getSqArtefato());
     return array('success' => true);
 }