/**
  * Function dedicated to sending admin mail for new demands
  * @param Demand $demand
  * @param $subject
  */
 protected function sendNewDemandAdminMail(Demand $demand, $subject)
 {
     // Define necessary vars
     $template = 'SpiritDevDBoxPortalBundle:Mailer/Demand:adminRegistration.html.twig';
     // Template
     $subject = $this->getSubject($subject);
     // Subject
     $demandUrl = $this->router->generate('spirit_dev_dbox_portal_bundle_demand', array('id' => $demand->getId()), true);
     $rendered = $this->templating->render($template, array('demand' => $demand, 'demand_url' => $demandUrl));
     // Template rendering
     // Send Mail
     $this->sendEmailMessage($rendered, $subject, $this->adminMail);
 }
 /**
  * Function finalizing processes
  * @param Project $project
  * @param Demand $demand
  * @param bool $flashbag
  * @return mixed
  */
 protected function processProjectCreationFinalize(Project $project, Demand $demand, $flashbag = true)
 {
     $returnValues['slot_name'] = 'proc';
     try {
         // Finalizing process
         //            if ($project->getGitLabProjectId() != null && $project->getRedmineProjectId() != null) {
         // Update demand
         $resolvedStatus = $this->em->getRepository('SpiritDevDBoxPortalBundle:Status')->findOneBy(array('canonicalName' => 'resolved'));
         $demand->setStatus($resolvedStatus);
         $project->setActive(true);
         // Apply project and demand modification
         $this->em->flush();
         // Send user mail + team mail
         $this->mailer->processProjectCreationSendMail($project);
         $returnValues['data'][] = $this->setRetVal('Mail sent', 'bool', true);
         if ($flashbag) {
             $this->session->getFlashBag()->set('success', 'flashbag.demand.processing_project.success');
         }
     } catch (\Exception $e) {
         $returnValues['data'][] = $this->setRetVal('Mail sent', 'bool', false);
     }
     $returnValues['data'][] = $this->setRetVal('Demand status', 'string', $demand->getStatus()->getCanonicalName());
     return $returnValues;
 }
Exemple #3
0
 /**
  * Send mail for a new Security request
  *  To Admin
  *  To project owner
  * @param Demand $demand
  * @param $projectName
  * @return mixed
  */
 public function newSecurityRequestSendMail(Demand $demand, $projectName)
 {
     // User mail
     $template = "SpiritDevDBoxPortalBundle:Mailer/Security:securityRequest.html.twig";
     // Template
     $subject = $this->getSubject('New security assessment request - ' . $projectName);
     // Subject
     $demandUrl = $this->router->generate('spirit_dev_dbox_portal_bundle_demand', array('id' => $demand->getId()), true);
     $rendered = $this->templating->render($template, array('firstname' => $demand->getApplicant()->getFirstName(), 'lastname' => $demand->getApplicant()->getLastName(), 'demand' => $demand, 'project_name' => $projectName, 'demand_url' => $demandUrl));
     // Template rendering
     // Send mail effectively
     $this->sendEmailMessage($rendered, $subject, $demand->getApplicant()->getEmail());
     // Admin mail
     $this->sendNewDemandAdminMail($demand, 'Admin - New security request - ' . $projectName);
 }
 /**
  * Process demand registration
  * @return Demand
  */
 private function registerDemand()
 {
     // Managing EM entities
     $status = $this->em->getRepository('SpiritDevDBoxPortalBundle:Status')->findOneBy(array('canonicalName' => 'new'));
     $type = $this->em->getRepository('SpiritDevDBoxPortalBundle:Type')->findOneBy(array('canonicalName' => 'new_security'));
     // Creating empty demand
     $demand = new Demand();
     // Setting datas
     $demand->setAskdate(new \DateTime());
     $demand->setApplicant($this->getCurrentUser());
     $demand->setStatus($status);
     $demand->setType($type);
     $demand->setContent($this->setContentData());
     // Persisting EM entity
     $this->em->persist($demand);
     $this->em->flush();
     return $demand;
 }
Exemple #5
0
 /**
  * AutoProcess Project
  * @param Demand $demandToProcess
  * @param bool $flashbag
  * @return mixed
  */
 public function processNewProject(Demand $demandToProcess, $flashbag = true)
 {
     // Preparing return values
     $returnValues['processor'] = "project";
     $returnValues['demand_id'] = $demandToProcess->getId();
     // Process GitLabAPI project creation
     // Getting related project
     $projectId = $demandToProcess->getContent()["id"];
     $demandProject = $this->em->getRepository('SpiritDevDBoxPortalBundle:Project')->findOneBy(array('id' => $projectId));
     // Process VCS project creation
     if ($demandProject->isVcsManaged()) {
         $returnValues['slot'][] = $this->processVCSProjectCreation($demandProject);
     }
     // Process PM Project creation
     if ($demandProject->isPmManaged()) {
         $returnValues['slot'][] = $this->processPMProjectCreation($demandProject);
     }
     // Process CI Project creation
     if ($demandProject->isCiDevManaged()) {
         $returnValues['slot'][] = $this->processCIProjectCreation($demandProject);
     }
     // Process QA Project creation
     if ($demandProject->isQaDevManaged()) {
         $returnValues['slot'][] = $this->processQAProjectCreation($demandProject);
     }
     // Finalize Process
     $returnValues['slot'][] = $this->processProjectCreationFinalize($demandProject, $demandToProcess, $flashbag);
     // Adding todos
     $returnValues['slot'][] = $this->processProjectCreationTodos($demandProject);
     return $returnValues;
 }