Exemplo n.º 1
0
 public function save(Doctrine_Connection $conn = null)
 {
     $is_new = $this->isNew();
     $procedure = parent::Save($conn);
     if ($is_new) {
         /*
         $dc=DatoCatastralPeer::retrieveByPK($this->getDatoCatastralId());
         $numero=$dc->getNumero().'-'.$dc->getCircunscripcion().'-'.$dc->getSeccion().'-'.$this->getId();
         $this->setNumero($numero);
         $this->save();
         */
         // singleton
         $singleton = sfContext::getInstance();
         $revision = new Revision();
         $revision->setNumber(0);
         $revision->setProcedureId($this->get('id'));
         $revision->setRevisionStateId(1);
         // <- Estado inicial.
         $revision->setBlock(true);
         // <- Bloqueamos la revision.
         $revision->setCreatorId($singleton->getUser()->getGuardUser()->getId());
         $revision->save();
         // Agregamos registro usuario_tramite
         $usuarioTramite = new UserProcedure();
         $usuarioTramite->setUserId($singleton->getUser()->getGuardUser()->getId());
         $usuarioTramite->setProcedureId($this->get('id'));
         $usuarioTramite->save();
     } else {
         /*
             //guarda el numero de tramite en funcion del dato catastral
             $dc=DatoCatastralPeer::retrieveByPK($this->getDatoCatastralId());
             $numero=$dc->getNumero().'-'.$dc->getCircunscripcion().'-'.$dc->getSeccion().'-'.$this->getId();
             $this->setNumero($numero);
             //$this->save();
             return parent::save($con);
         */
     }
 }
Exemplo n.º 2
0
 /**
  * action Complete
  *
  * @author Damian Suarez
  */
 public function executeComplete(sfWebRequest $request)
 {
     $user = $this->getUser()->getGuardUser();
     if ($user->hasPermission('Responsable de cierre')) {
         $this->revision = Doctrine::getTable('Revision')->find($request->getParameter('id'));
         $this->procedure = $this->revision->getProcedure();
         // bloqueamos todas las revisiones
         foreach ($this->procedure->getRevisions() as $revision) {
             $revision->setBlock(true);
             $revision->save();
         }
         // Creamos la ultima revision
         $last_revision = new Revision();
         $last_revision->setRevisionStateId(4);
         $last_revision->setProcedureId($this->procedure->get('id'));
         $last_revision->setCreatorId($this->getUser()->getGuardUser()->get('id'));
         $last_revision->setBlock(true);
         $last_revision->setParentId($this->revision->get('id'));
         $last_revision->save();
         $this->redirect('procedures/index?id=' . $this->procedure->get('id'));
     }
 }