Esempio n. 1
0
 public function initAction(Request $request, $code, $type)
 {
     $em = $this->getDoctrine()->getManager();
     $tdc = $em->getRepository('TRCCoreBundle:DDC\\TDC')->findOneByCode($code);
     if (is_null($tdc)) {
         throw $this->createNotFoundException("Error de code : " . $code);
     }
     $tddc = $em->getRepository('TRCCoreBundle:DDC\\TDDC')->findOneByCode($type);
     if (is_null($tddc)) {
         throw $this->createNotFoundException("Error de code de type : " . $type);
     }
     $sysnoti = $this->get('trc_core.noti');
     $sysddc = $this->get('trc_core.ddc');
     $sysgu = $this->get('trc_core.gu');
     $sysmatricule = $this->get('trc_core.matricule');
     $user = $this->getUser();
     $utilisateur = $em->getRepository('TRCCoreBundle:Utilisateur')->findOneByCompte($user);
     $fonction = $sysgu->fonction($utilisateur);
     $ddc = new DDC();
     // Affection du dossier de credit a l'utilisateur
     $ddc->setFonction($fonction);
     //$ddc->setCdcd(new CDCD());
     $ddc->setTddc($tddc);
     $ddc->setTdc($tdc);
     //Affection reference systeme
     $ddc = $sysmatricule->rsDDC($ddc);
     $ddc = $sysddc->initDDC($ddc, $user);
     $edp = new EDP();
     $edp->setMatricule($sysmatricule->matriculeStandard($edp));
     $ddc->setEdp($edp);
     $em->persist($ddc);
     $em->flush();
     $sysddc->initPhases($ddc);
     $sysddc->setDocs($ddc);
     //Activer la phase Etude de dossier
     $ddc->setPhaseActuelle($sysddc->activerPhase($ddc, "ETDOS"));
     //Activer l'etat INI
     $ddc->setEtatActuel($sysddc->activerEtat($ddc, $fonction, "INIT"));
     // Documentation du dossier
     $em->flush();
     $sysnoti->notifier(array("acteur" => $utilisateur->getActeur(), "titre" => "Enregistrement de DDC", "contenu" => " Vous avez crée avec succes un DDC RS : <strong>" . $ddc->getRs() . "</strong>"));
     return $this->redirect($this->generateUrl('trcddc_def_client', array('rs' => $ddc->getRs())));
 }
 /**
  * {@inheritDoc}
  */
 public function getMatricule()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getMatricule', []);
     return parent::getMatricule();
 }