Esempio n. 1
0
 /**
  * @param $name
  * @param $permaLink
  * @param Etude $entity
  * Used  only in Mgate\CommentBundle\Controller\DefaultController for undocumented purpose (maintenance ??)
  */
 public function creerThread($name, $permaLink, Etude $entity)
 {
     if (!$entity->getThread()) {
         $thread = $this->tm->createThread($name . $entity->getId());
         $thread->setPermalink($permaLink);
         //non exploité dans notre cas. Commentable.
         $entity->setThread($thread);
         //persist thread inutile, car cascade sur $entity.
         $this->em->flush();
     }
 }
Esempio n. 2
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('stateID', 'choice', array('choices' => Etude::getStateIDChoice(), 'label' => 'Etat de l\'Étude', 'required' => true))->add('auditDate', 'genemu_jquerydate', array('label' => 'Audité le', 'format' => 'd/MM/y', 'required' => false, 'widget' => 'single_text'))->add('auditType', new AuditType(), array('label' => 'Type d\'audit', 'required' => false))->add('stateDescription', 'textarea', array('label' => 'Problèmes', 'required' => false, 'attr' => array('cols' => '100%', 'rows' => 5)))->add('ap', new DocTypeSuiviType(), array('label' => 'Avant-Projet', 'data_class' => 'Mgate\\SuiviBundle\\Entity\\Ap'))->add('cc', new DocTypeSuiviType(), array('label' => 'Convention Client', 'data_class' => 'Mgate\\SuiviBundle\\Entity\\Cc'));
     $builder->add('missions', 'collection', array('type' => new DocTypeSuiviType(), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false));
     $builder->add('pvis', 'collection', array('type' => new DocTypeSuiviType(), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false));
     $builder->add('avs', 'collection', array('type' => new DocTypeSuiviType(), 'allow_add' => true, 'allow_delete' => true, 'prototype' => true, 'by_reference' => false));
     $builder->add('pvr', new DocTypeSuiviType(), array('label' => 'PVR', 'data_class' => 'Mgate\\SuiviBundle\\Entity\\ProcesVerbal'));
 }
Esempio n. 3
0
 private function createDeleteForm(Etude $etude)
 {
     return $this->createFormBuilder(array('id' => $etude->getId()))->add('id', 'hidden')->getForm();
 }
 public function getGroupePhasesByEtude(Etude $etude)
 {
     $qb = $this->_em->createQueryBuilder();
     $query = $qb->select('g')->from('MgateSuiviBundle:GroupePhases', 'g')->innerJoin('g.etude', 'e')->where('e.id = :etudeID')->orderBy('g.numero', 'ASC')->setParameter('etudeID', $etude->getId());
     return $query;
 }
Esempio n. 5
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('suiveur', 'genemu_jqueryselect2_entity', array('label' => 'Suiveur de projet', 'class' => 'Mgate\\PersonneBundle\\Entity\\Personne', 'property' => 'prenomNom', 'query_builder' => function (PersonneRepository $pr) {
         return $pr->getByMandatNonNulQueryBuilder();
     }, 'required' => false))->add('ap', new SubApType(), array('label' => ' ', 'prospect' => $options['prospect']))->add('fraisDossier', 'integer', array('label' => 'Frais de dossier', 'required' => false))->add('presentationProjet', 'textarea', array('label' => 'Présentation du projet', 'required' => false, 'attr' => array('cols' => '100%', 'rows' => 5)))->add('descriptionPrestation', 'textarea', array('label' => 'Description de la prestation proposée', 'required' => false, 'attr' => array('title' => "La phrase commence par 'N7 Consulting réalisera, pour le compte du Client, une étude consistant en'. Il faut la continuer en décrivant la prestation proposée. Le début de la phrase est déjà généré.", 'cols' => '100%', 'rows' => 5)))->add('typePrestation', 'choice', array('choices' => Etude::getTypePrestationChoice(), 'label' => 'Type de prestation', 'required' => false))->add('competences');
 }
 /**
  * {@inheritdoc}
  */
 protected function execute(InputInterface $input, OutputInterface $output)
 {
     $em = $this->getContainer()->get('doctrine.orm.entity_manager');
     $array_projects = array(array('nom' => '315GLA', 'description' => 'Realisation site web', 'statut' => 1, 'nbrJEH' => 9, 'duree' => 5, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Gladiator Consulting', 'adresse' => '3 rue du chene noir', 'codePostal' => 33100, 'ville' => 'Toulouse', 'entite' => 2, 'email' => '*****@*****.**')), array('nom' => '316BLA', 'description' => 'Electronique avancee', 'statut' => 2, 'nbrJEH' => 5, 'duree' => 3, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Blackwater', 'adresse' => '1020 5th Avenue', 'codePostal' => 92200, 'ville' => 'Neuilly', 'entite' => 3, 'email' => '*****@*****.**')), array('nom' => '317IMU', 'description' => 'Design Base de donnes', 'statut' => 4, 'nbrJEH' => 8, 'duree' => 4, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Imuka', 'adresse' => 'Kuruma San', 'codePostal' => 91000, 'ville' => 'Evry', 'entite' => 4, 'email' => '*****@*****.**')), array('nom' => '319UNI', 'description' => 'Conception Radar recul', 'statut' => 4, 'nbrJEH' => 12, 'duree' => 8, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Universal rad', 'adresse' => '2 rue Marie Curie', 'codePostal' => 35000, 'ville' => 'Rennes', 'entite' => 5, 'email' => '*****@*****.**')), array('nom' => '320TEK', 'description' => 'Refactorisation code Java', 'statut' => 2, 'nbrJEH' => 10, 'duree' => 8, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Teknik studio', 'adresse' => '10 impasse sunderland', 'codePostal' => 35000, 'ville' => 'Rennes', 'entite' => 6, 'email' => '*****@*****.**')), array('nom' => '321DUV', 'description' => 'Calcul de flux thermique', 'statut' => 2, 'nbrJEH' => 9, 'duree' => 4, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Duvilcolor', 'adresse' => '600 la pyrennene ', 'codePostal' => 33100, 'ville' => 'Labege', 'entite' => 4, 'email' => '*****@*****.**')), array('nom' => '322NIL', 'description' => 'Application Android', 'statut' => 1, 'nbrJEH' => 8, 'duree' => 12, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'Nilsen Industries', 'adresse' => '2 rue saint-louis', 'codePostal' => 31000, 'ville' => 'Bordeaux', 'entite' => 7, 'email' => '*****@*****.**')), array('nom' => '323PRR', 'description' => 'Etude de faisabilite', 'statut' => 3, 'nbrJEH' => 4, 'duree' => 4, 'dateCC' => 'ok', 'prospect' => array('entreprise' => 'PRR', 'adresse' => 'PRR', 'codePostal' => 35000, 'ville' => 'Rennes', 'entite' => 4, 'email' => '*****@*****.**')));
     $inserted_projects = 0;
     $inserted_prospects = 0;
     foreach ($array_projects as $etude) {
         //create project
         $e = new Etude();
         $inserted_projects++;
         $mandat = rand(2013, 2016);
         $month = rand(1, 10);
         $day = rand(1, 30);
         $e->setMandat($mandat);
         $e->setNom($etude['nom']);
         $e->setDescription($etude['description']);
         $e->setDateCreation(new \DateTime($mandat . '-' . $month . '-' . $day));
         $e->setStateID($etude['statut']);
         $e->setAcompte(true);
         $e->setPourcentageAcompte(0.3);
         $e->setFraisDossier(90);
         $e->setPresentationProjet('Presentation ' . $etude['description']);
         $e->setDescriptionPrestation('Describe what we will do here');
         $e->setSourceDeProspection(rand(1, 10));
         $em->persist($e);
         $c = $em->getRepository('N7consultingRhBundle:Competence')->find(rand(1, 12));
         if ($c !== null) {
             $c->addEtude($e);
         }
         /** Prospect management */
         $p = new Prospect();
         $inserted_prospects++;
         $p->setNom($etude['prospect']['entreprise']);
         $p->setAdresse($etude['prospect']['adresse']);
         $p->setCodePostal($etude['prospect']['codePostal']);
         $p->setVille($etude['prospect']['ville']);
         $p->setEntite($etude['prospect']['entite']);
         $pe = new Personne();
         $pe->setPrenom(self::PRENOM[array_rand(self::PRENOM)]);
         //whitespace explode : not perfect but better than nothing
         $pe->setNom(self::NOM[array_rand(self::NOM)]);
         $pe->setEmailEstValide(true);
         $pe->setEstAbonneNewsletter(false);
         $pe->setEmail($etude['prospect']['email']);
         $pe->setAdresse($etude['prospect']['adresse']);
         $pe->setCodePostal($etude['prospect']['codePostal']);
         $pe->setVille($etude['prospect']['ville']);
         $emp = new Employe();
         $emp->setProspect($p);
         $p->addEmploye($emp);
         $emp->setPersonne($pe);
         $em->persist($emp->getPersonne());
         $em->persist($emp);
         $em->persist($p);
         $e->setProspect($p);
         //create phases
         $g = new GroupePhases();
         //default group
         $g->setTitre('Random generated' . rand());
         $g->setNumero(1);
         $g->setDescription('Automatic description');
         $g->setEtude($e);
         $em->persist($g);
         $ph = new Phase();
         $ph->setEtude($e);
         $ph->setGroupe($g);
         $ph->setPosition(0);
         $ph->setNbrJEH($etude['nbrJEH']);
         $ph->setPrixJEH(340);
         $ph->setTitre('Default phase');
         $ph->setDelai($etude['duree'] * 7);
         $ph->setDateDebut(new \DateTime($mandat . '-' . $month . '-' . $day));
         $em->persist($ph);
         //manage project manager
         $pm = new Personne();
         $pm->setPrenom(self::PRENOM[array_rand(self::PRENOM)]);
         $pm->setNom(self::NOM[array_rand(self::NOM)]);
         $pm->setEmailEstValide(false);
         $pm->setEstAbonneNewsletter(false);
         $em->persist($pm);
         $m = new Membre();
         $m->setPersonne($pm);
         $m->setPromotion($mandat + 2);
         $em->persist($m);
         if ($c !== null) {
             $c->addMembre($m);
         }
         $e->setSuiveur($pm);
         //manage AP & CC
         if ($etude['dateCC'] !== null && $etude['statut'] > 1) {
             $ap = new Ap();
             $ap->setEtude($e);
             $em->persist($ap);
             $cc = new Cc();
             $cc->setEtude($e);
             $cc->setDateSignature(new \DateTime($mandat . '-' . $month . '-' . $day));
             $cc->setSignataire2($pe);
             $em->persist($cc);
         }
         //manage intervenant
         if ($etude['statut'] > 1 && $etude['statut'] < 5) {
             //manage developper
             $dev = new Personne();
             $dev->setPrenom(self::PRENOM[array_rand(self::PRENOM)]);
             $dev->setNom(self::NOM[array_rand(self::NOM)]);
             $dev->setEmailEstValide(false);
             $dev->setEstAbonneNewsletter(false);
             $em->persist($dev);
             $mdev = new Membre();
             $mdev->setPersonne($dev);
             $mdev->setPromotion($mandat + rand(1, 2));
             $em->persist($mdev);
             if ($c !== null) {
                 $c->addMembre($mdev);
             }
             $mi = new Mission();
             $mi->setSignataire2($dev);
             $mi->setEtude($e);
             $mi->setDateSignature(new \DateTime($mandat . '-' . $month . '-' . $day));
             $mi->setDebutOm(new \DateTime($mandat . '-' . $month . '-' . $day));
             $mi->setAvancement(rand(90, 100));
             $mi->setIntervenant($mdev);
             $em->persist($mi);
         }
         //manage PVR
         if ($etude['statut'] > 1 && $etude['statut'] < 5) {
             $pv = new ProcesVerbal();
             $pv->setEtude($e);
             $pv->setDateSignature(new \DateTime($mandat . '-' . ($month + 1) . '-' . $day));
             $pv->setSignataire2($pe);
             $pv->setType('pvr');
             $em->persist($pv);
         }
     }
     $em->flush();
     $output->writeln('Done.');
 }
Esempio n. 7
0
 public function getGantt(Etude $etude, $type)
 {
     // Chart
     $series = array();
     $data = array();
     $cats = array();
     $naissance = new \DateTime();
     $mort = new \DateTime();
     //Contacts Client
     if ($etude->getClientContacts()->count() != 0 && $type == 'suivi') {
         foreach ($etude->getClientContacts() as $contact) {
             $date = $contact->getDate();
             if ($naissance >= $date) {
                 $naissance = clone $date;
             }
             if ($mort <= $date) {
                 $mort = clone $date;
             }
             $data[] = array('x' => count($cats), 'y' => $date->getTimestamp() * 1000, 'titre' => $contact->getObjet(), 'detail' => 'fait par ' . $contact->getFaitPar()->getPrenomNom() . ' le ' . $date->format('d/m/Y'));
         }
         $series[] = array('type' => 'scatter', 'data' => $data);
         $cats[] = 'Contact client';
     }
     //Documents
     if ($type == 'suivi') {
         $data = array();
         $count_cats = count($cats);
         for ($j = 0; $j < $count_cats; ++$j) {
             $data[] = array();
         }
         $dataSauv = $data;
         if ($etude->getAp() && $etude->getAp()->getDateSignature()) {
             $date = $etude->getAp()->getDateSignature();
             if ($naissance >= $date) {
                 $naissance = clone $date;
             }
             if ($mort <= $date) {
                 $mort = clone $date;
             }
             $data[] = array('x' => count($cats), 'y' => $date->getTimestamp() * 1000, 'titre' => 'Avant-Projet', 'detail' => 'signé le ' . $date->format('d/m/Y'));
             $series[] = array('type' => 'scatter', 'data' => $data, 'marker' => array('symbol' => 'square', 'fillColor' => 'blue'));
             $naissance = clone $etude->getAp()->getDateSignature();
         }
         $data = $dataSauv;
         if ($etude->getCc() && $etude->getCc()->getDateSignature()) {
             $date = $etude->getCc()->getDateSignature();
             if ($naissance >= $date) {
                 $naissance = clone $date;
             }
             if ($mort <= $date) {
                 $mort = clone $date;
             }
             $data[] = array('x' => count($cats), 'y' => $date->getTimestamp() * 1000, 'titre' => 'Convention Client', 'detail' => 'signé le ' . $date->format('d/m/Y'));
             $series[] = array('type' => 'scatter', 'data' => $data, 'marker' => array('symbol' => 'triangle', 'fillColor' => 'red'));
         }
         $data = $dataSauv;
         if ($etude->getPvr() && $etude->getPvr()->getDateSignature()) {
             $date = $etude->getPvr()->getDateSignature();
             if ($naissance >= $date) {
                 $naissance = clone $date;
             }
             if ($mort <= $date) {
                 $mort = clone $date;
             }
             $data[] = array('x' => count($cats), 'y' => $date->getTimestamp() * 1000, 'name' => 'Procès Verbal de Recette', 'detail' => 'signé le ' . $date->format('d/m/Y'));
             $series[] = array('type' => 'scatter', 'data' => $data, 'marker' => array('symbol' => 'circle'));
         }
         $cats[] = 'Documents';
     }
     //Etude
     if ($type == 'suivi') {
         $data = array();
         $count_cats = count($cats);
         for ($j = 0; $j < $count_cats; ++$j) {
             $data[] = array();
         }
         if ($etude->getDateLancement() && $etude->getDateFin(true)) {
             $debut = $etude->getDateLancement();
             $fin = $etude->getDateFin(true);
             $data[] = array('low' => $debut->getTimestamp() * 1000, 'y' => $fin->getTimestamp() * 1000, 'color' => '#005CA4', 'titre' => 'Durée de déroulement des phases', 'detail' => 'du ' . $debut->format('d/m/Y') . ' au ' . $fin->format('d/m/Y'));
             $cats[] = 'Etude';
         }
     }
     foreach ($etude->getPhases() as $phase) {
         if ($phase->getDateDebut() && $phase->getDelai()) {
             $debut = $phase->getDateDebut();
             if ($naissance >= $debut) {
                 $naissance = clone $debut;
             }
             $fin = clone $debut;
             $fin->add(new \DateInterval('P' . $phase->getDelai() . 'D'));
             if ($mort <= $fin) {
                 $mort = clone $fin;
             }
             $func = new Expr('function() {return this.point.titre;}');
             $data[] = array('low' => $fin->getTimestamp() * 1000, 'y' => $debut->getTimestamp() * 1000, 'titre' => $phase->getTitre(), 'detail' => 'du ' . $debut->format('d/m/Y') . ' au ' . $fin->format('d/m/Y'), 'color' => '#F26729', 'dataLabels' => array('enabled' => true, 'align' => 'left', 'inside' => true, 'verticalAlign' => 'bottom', 'formatter' => $func, 'y' => -5));
         } else {
             $data[] = array();
         }
         $cats[] = 'Phase n°' . ($phase->getPosition() + 1);
     }
     $series[] = array('type' => 'bar', 'data' => $data);
     //Today, à faire à la fin
     $data = array();
     if ($type == 'suivi') {
         $now = new \DateTime('NOW');
         $data[] = array('x' => 0, 'y' => $now->getTimestamp() * 1000, 'titre' => "aujourd'hui", 'detail' => 'le ' . $now->format('d/m/Y'));
         $data[] = array('x' => count($cats) - 1, 'y' => $now->getTimestamp() * 1000, 'titre' => "aujourd'hui", 'detail' => 'le ' . $now->format('d/m/Y'));
         $series[] = array('type' => 'spline', 'data' => $data, 'marker' => array('radius' => 1, 'color' => '#545454'), 'color' => '#545454', 'lineWidth' => 1, 'pointWidth' => 5);
     }
     $ob = $this->ganttChartFactory($series, $cats);
     $ob->yAxis->min($naissance->sub(new \DateInterval('P1D'))->getTimestamp() * 1000);
     $ob->yAxis->max($mort->add(new \DateInterval('P1D'))->getTimestamp() * 1000);
     return $ob;
 }
 /**
  * @param UploadedFile $file resources file contzaining data to import.
  * @return mixed Process Import.
  * Process Import.
  */
 public function run(UploadedFile $file)
 {
     if ($file->guessExtension() == "txt") {
         //csv is seen as text/plain
         $i = 1;
         $inserted_projects = 0;
         $inserted_prospects = 0;
         if (($handle = fopen($file->getPathname(), "r")) !== FALSE) {
             $array_manager = array();
             //an array containing references to managers.
             $array_prospect = array();
             //an array containing references to projects.
             //iterate csv, row by row
             while (($data = fgetcsv($handle, 0, ",")) !== FALSE) {
                 if ($i > 1 && $this->readArray($data, 'Intitule') != "") {
                     //first row is column headers
                     $etude = $this->em->getRepository('MgateSuiviBundle:Etude')->findOneByNom($this->readArray($data, 'Intitule'));
                     if ($etude === null) {
                         //create project if it doesn't exists in DB
                         $e = new Etude();
                         $inserted_projects++;
                         $e->setMandat($this->readArray($data, 'Exercice comptable'));
                         // $e->setNum($this->readArray($data, 'No Etude')); //untrusted, can be duplicated in siaje.
                         $e->setNom($this->readArray($data, 'Intitule'));
                         $e->setDescription($this->readArray($data, 'Domaine de compétence'));
                         $e->setDateCreation($this->dateManager($this->readArray($data, 'Date d\'ajout')));
                         if (array_key_exists($this->normalize($this->readArray($data, 'Statut')), self::SIAJE_AVAILABLE_STATE)) {
                             $e->setStateID(self::SIAJE_AVAILABLE_STATE[$this->normalize($this->readArray($data, 'Statut'))]);
                         } else {
                             $e->setStateID(self::SIAJE_AVAILABLE_STATE['Contact initial']);
                         }
                         $e->setAcompte(true);
                         if ($this->readArray($data, 'Acompte') !== null) {
                             $rate = explode(',', $this->readArray($data, 'Acompte'));
                             //acompte is a percentage such as "30,00%".
                             $e->setPourcentageAcompte($rate['0'] / 100);
                         }
                         $e->setFraisDossier($this->readArray($data, 'Frais de dossier HT'));
                         $e->setPresentationProjet('Etude importée depuis Siaje');
                         $e->setDescriptionPrestation($this->readArray($data, 'Domaine de compétence'));
                         $e->setPourcentageAcompte($this->readArray($data, 'Acompte'));
                         $this->em->persist($e);
                         /** Prospect management */
                         // Check if a prospect with same already exists in database
                         if ($this->readArray($data, 'Entreprise', true) !== "") {
                             $prospect = $this->em->getRepository('MgatePersonneBundle:Prospect')->findOneByNom($this->readArray($data, 'Entreprise', true));
                             if ($prospect === null) {
                                 //check if prospect already exist in local objects
                                 if (array_key_exists($this->readArray($data, 'Entreprise', true), $array_prospect)) {
                                     $prospect = $array_prospect[$this->readArray($data, 'Entreprise', true)];
                                 }
                             }
                         } else {
                             $prospect = null;
                         }
                         if ($prospect !== null) {
                             $e->setProspect($prospect);
                         } else {
                             $p = new Prospect();
                             $inserted_prospects++;
                             if ($this->readArray($data, 'Entreprise', true) !== "") {
                                 $p->setNom($this->readArray($data, 'Entreprise', true));
                             } else {
                                 $p->setNom('Prospect sans nom ' . rand());
                             }
                             $p->setAdresse($this->readArray($data, 'Adresse'));
                             $p->setCodePostal($this->readArray($data, 'Code Postal'));
                             $p->setVille($this->readArray($data, 'Ville'));
                             $contact = explode(' ', $this->normalize($this->readArray($data, 'Contact', true)));
                             $pe = new Personne();
                             $pe->setPrenom($contact[0]);
                             //whitespace explode : not perfect but better than nothing
                             unset($contact[0]);
                             if (implode(' ', $contact) == "") {
                                 $pe->setNom('inconnu');
                             } else {
                                 $pe->setNom(implode(' ', $contact));
                             }
                             $pe->setEmailEstValide(true);
                             $pe->setEstAbonneNewsletter(false);
                             $pe->setEmail($this->readArray($data, 'Email'));
                             $pe->setAdresse($this->readArray($data, 'Adresse'));
                             $pe->setCodePostal($this->readArray($data, 'Code Postal'));
                             $pe->setVille($this->readArray($data, 'Ville'));
                             $emp = new Employe();
                             $emp->setProspect($p);
                             $p->addEmploye($emp);
                             $emp->setPersonne($pe);
                             $this->em->persist($emp->getPersonne());
                             $this->em->persist($emp);
                             $this->em->persist($p);
                             $e->setProspect($p);
                             $array_prospect[$this->readArray($data, 'Entreprise', true)] = $p;
                         }
                         //create phases
                         $g = new GroupePhases();
                         //default group
                         $g->setTitre('Imported from Siaje');
                         $g->setNumero(1);
                         $g->setDescription('Automatic description');
                         $g->setEtude($e);
                         $this->em->persist($g);
                         $ph = new Phase();
                         $ph->setEtude($e);
                         $ph->setGroupe($g);
                         $ph->setPosition(0);
                         $ph->setNbrJEH($this->readArray($data, 'JEHs'));
                         if ($this->readArray($data, 'JEHs') > 0) {
                             $ph->setPrixJEH(round($this->floatManager($this->readArray($data, 'Montant HT')) / $this->floatManager($this->readArray($data, 'JEHs'))));
                         }
                         $ph->setTitre('Default phase');
                         $ph->setDelai($this->readArray($data, 'Durée en semaine') * 7);
                         $ph->setDateDebut($this->dateManager($this->readArray($data, 'Date signature CC')));
                         $this->em->persist($ph);
                         //manage project manager
                         $contact = explode(' ', $this->normalize($this->readArray($data, 'Suiveur principal', true)));
                         $firstname = $contact[0];
                         unset($contact[0]);
                         $surname = implode(' ', $contact);
                         $pm = $this->em->getRepository('MgatePersonneBundle:Personne')->findOneBy(array('nom' => $surname, 'prenom' => $firstname));
                         if ($pm !== null) {
                             $e->setSuiveur($pm);
                         } else {
                             //create a new member and a new person
                             if (array_key_exists($this->readArray($data, 'Suiveur principal', true), $array_manager) && $this->readArray($data, 'Suiveur principal', true) != '') {
                                 //has already been created before
                                 $e->setSuiveur($array_manager[$this->readArray($data, 'Suiveur principal', true)]);
                             } else {
                                 $pm = new Personne();
                                 $pm->setPrenom($firstname);
                                 if ($surname == "") {
                                     $pm->setNom('inconnu');
                                 } else {
                                     $pm->setNom($surname);
                                 }
                                 $pm->setEmailEstValide(false);
                                 $pm->setEstAbonneNewsletter(false);
                                 $this->em->persist($pm);
                                 $m = new Membre();
                                 $m->setPersonne($pm);
                                 $this->em->persist($m);
                                 $e->setSuiveur($pm);
                                 $array_manager[$this->readArray($data, 'Suiveur principal', true)] = $pm;
                             }
                         }
                         //manage AP & CC
                         if ($this->dateManager($this->readArray($data, 'Date signature CC')) !== null) {
                             $ap = new Ap();
                             $ap->setEtude($e);
                             $this->em->persist($ap);
                             $cc = new Cc();
                             $cc->setEtude($e);
                             $cc->setDateSignature($this->dateManager($this->readArray($data, 'Date signature CC')));
                             if (isset($pe)) {
                                 //if firm has been created in this loop iteration
                                 $cc->setSignataire2($pe);
                             }
                             $this->em->persist($cc);
                         }
                         //manage PVR
                         if ($this->dateManager($this->readArray($data, 'Date signature PV')) !== null) {
                             $pv = new ProcesVerbal();
                             $pv->setEtude($e);
                             $pv->setDateSignature($this->dateManager($this->readArray($data, 'Date signature PV')));
                             $this->em->persist($pv);
                         }
                     }
                 }
                 $i++;
             }
             fclose($handle);
             $this->em->flush();
         }
         return array('inserted_projects' => $inserted_projects, 'inserted_prospects' => $inserted_prospects);
     }
     return array('inserted_projects' => 0, 'inserted_prospects' => 0);
 }
Esempio n. 9
0
 public function buildForm(FormBuilderInterface $builder, array $options)
 {
     $builder->add('knownProspect', 'checkbox', array('required' => false, 'label' => 'Le signataire client existe-t-il déjà dans la base de donnée ?'))->add('prospect', 'genemu_jqueryselect2_entity', array('class' => 'Mgate\\PersonneBundle\\Entity\\Prospect', 'property' => 'nom', 'required' => true, 'label' => 'Prospect existant'))->add('newProspect', new ProspectType(), array('label' => 'Nouveau prospect:', 'required' => false))->add('nom', 'text', array('label' => 'Nom interne de l\'étude'))->add('description', 'textarea', array('label' => 'Présentation interne de l\'étude', 'required' => false, 'attr' => array('cols' => '100%', 'rows' => 5)))->add('mandat', 'integer')->add('num', 'integer', array('label' => 'Numéro de l\'étude', 'required' => false))->add('confidentiel', 'checkbox', array('label' => 'Confidentialité :', 'required' => false, 'attr' => array('title' => "Si l'étude est confidentielle, elle ne sera visible que par vous et les membres du CA.")))->add('suiveur', 'genemu_jqueryselect2_entity', array('label' => 'Suiveur de projet', 'class' => 'Mgate\\PersonneBundle\\Entity\\Personne', 'property' => 'prenomNom', 'query_builder' => function (PersonneRepository $pr) {
         return $pr->getMembreOnly();
     }, 'required' => false))->add('domaineCompetence', 'genemu_jqueryselect2_entity', array('class' => 'Mgate\\SuiviBundle\\Entity\\DomaineCompetence', 'property' => 'nom', 'required' => false, 'label' => 'Domaine de compétence'))->add('sourceDeProspection', 'choice', array('choices' => Etude::getSourceDeProspectionChoice(), 'required' => false));
 }