public static function createOrUpdateDistantParams(EiProjet $ei_project, EiProfil $ei_profile, KalFunction $kal_function, $data, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     try {
         $conn->beginTransaction();
         //Début de la transaction
         //Appel du webservice
         $result_update = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "/serviceweb/project/parameter/createOrUpdate.json", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'profile_id' => $ei_profile->getProfileId(), 'profile_ref' => $ei_profile->getProfileRef(), 'function_id' => $kal_function->getFunctionId(), 'function_ref' => $kal_function->getFunctionRef(), 'data' => $data));
         $array_result = json_decode(html_entity_decode($result_update), true);
         //Récupération du paramètre pour traitement
         if (count($array_result) == 0) {
             return false;
         }
         if (array_key_exists("error", $array_result)) {
             return false;
         }
         if (!$array_result[0]) {
             return false;
         }
         //Rechargement d'un paramètre
         self::reload($array_result, $conn);
         $conn->commit();
         return $array_result[0]['fp_id'];
     } catch (Exception $e) {
         $conn->rollback();
         return false;
         throw $e;
     }
 }
Exemplo n.º 2
0
 public static function createDistantView(EiProjet $ei_project, EiTree $ei_parent_tree, $data, Doctrine_Connection $conn = null)
 {
     $result_file = new DOMDocument();
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     try {
         $conn->beginTransaction();
         //Début de la transaction
         //$result_file = new DOMDocument();
         //Appel du webservice
         $result_update = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "/serviceweb/project/view/create.json", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'parent_id' => $ei_parent_tree->getId(), 'data' => $data));
         $array_result = json_decode(html_entity_decode($result_update), true);
         //Récupération de la vue  pour traitement
         if (count($array_result) == 0) {
             return false;
         }
         if (array_key_exists("error", $array_result)) {
             return false;
         }
         if (!$array_result[0]) {
             return false;
         }
         //Rechargement d'une vuew
         EiView::reload($array_result, $conn);
         $conn->commit();
         return true;
     } catch (Exception $e) {
         $conn->rollback();
         //return false;
         throw $e;
     }
 }
Exemplo n.º 3
0
 public function checkLogicBetweenProjectAndProfile(EiProjet $ei_project, EiProfil $ei_profile)
 {
     //On vérifie si le profil appartient bien au projet
     if ($ei_project->getProjectId() != $ei_profile->getProjectId() || $ei_project->getRefId() != $ei_profile->getProjectRef()) {
         $this->forward404('Environment  don\'t belong to project');
     }
 }
 public function getDefaultInterventionWithScenarioVersion(EiProjet $ei_project, EiVersion $ei_version, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     return $conn->fetchRow("select sp.*, s.id as subject_id ,s.name as subject_name from ei_scenario_package sp\n                                inner join ei_subject s on sp.package_id= s.package_id and sp.package_ref=s.package_ref\n                                where sp.ei_scenario_id= " . $ei_version->getEiScenarioId() . " and sp.ei_version_id=" . $ei_version->getId() . " and s.project_id=" . $ei_project->getProjectId() . " and s.project_ref=" . $ei_project->getRefId());
 }
Exemplo n.º 5
0
 public function getDefaultInterventionWithScenarioVersion(EiProjet $ei_project, EiVersion $ei_version, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     return $conn->fetchRow("select s.id as subject_id,s.name as subject_name,sp.ei_version_id as sp_ei_version_id, s.package_id,s.package_ref ,t.name as ticket_name  from ei_subject s " . " inner join ei_ticket t on s.package_id=t.ticket_id and s.package_ref=t.ticket_ref " . " Left join ei_scenario_package sp on sp.package_id=t.ticket_id and sp.package_ref=t.ticket_ref and sp.ei_scenario_id=" . $ei_version->getEiScenarioId() . " inner join ei_user_default_package udp on t.ticket_id=udp.ticket_id and t.ticket_ref=udp.ticket_ref " . " where udp.user_id=" . $this->getUserId() . " and udp.user_ref=" . $this->getRefId() . " and s.project_id=" . $ei_project->getProjectId() . " and s.project_ref=" . $ei_project->getRefId());
 }
Exemplo n.º 6
0
 public static function createDistantPackage(EiProjet $ei_project, $data, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     try {
         $conn->beginTransaction();
         //Début de la transaction
         $result_file = new DOMDocument();
         //Appel du webservice
         $result_update = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "serviceweb/project/package/create.json", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'data' => $data));
         //Récupération du ticket pour traitement
         $array_result = json_decode(html_entity_decode($result_update), true);
         //throw new Exception(html_entity_decode($result_update));
         //Récupération du projet pour traitement
         if (count($array_result) == 0) {
             return false;
         }
         if (array_key_exists("error", $array_result)) {
             return false;
         }
         if (!$array_result[0]) {
             return false;
         }
         EiTicket::reload($array_result, $conn);
         $conn->commit();
         return array('package_id' => $array_result[0]['t_id'], 'package_ref' => $array_result[0]['t_ref']);
     } catch (Exception $e) {
         $conn->rollback();
         throw $e;
         return false;
     }
 }
Exemplo n.º 7
0
 /**
  * @param $parent
  * @param EiProjet $projet
  * @param $nom
  */
 public function createEmpty($parent, EiProjet $projet, $nom)
 {
     $this->project_id = $projet->getProjectId();
     $this->project_ref = $projet->getRefId();
     $this->name = $nom;
     $this->root_id = $parent;
 }
 public function getSubjectStateForSearchBox(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     //Récupération des status
     return $this->getSubjectStateForProjectQuery($ei_project->getProjectId(), $ei_project->getRefId(), $conn)->execute();
 }
 public function getLastScenarioExecution(EiProjet $ei_project, EiScenario $ei_scenario = null)
 {
     $q = Doctrine_Query::create()->from('EiLogFunction elf ')->where('EiScenario.id=elf.ei_scenario_id')->andWhere(" EiScenario.project_ref=? And   EiScenario.project_id=?", array($ei_project->getRefId(), $ei_project->getProjectId()));
     if ($ei_scenario != null) {
         $q = $q->andWhere('EiScenario.id=' . $ei_scenario->getId());
     }
     return $q->orderBy('elf.date_debut DESC')->limit(1);
 }
 /**
  * @param EiProjet $project
  * @param EiProfil $profile
  *
  * @return EiActiveIteration
  */
 public function getActiveIteration(EiProjet $project = null, EiProfil $profile = null)
 {
     if ($project == null || $profile == null) {
         return null;
     } else {
         return $this->findOneByProjectRefAndProjectIdAndProfileRefAndProfileId($project->getRefId(), $project->getProjectId(), $profile->getProfileRef(), $profile->getProfileId());
     }
 }
Exemplo n.º 11
0
 public function checkEiScenario(sfWebRequest $request, EiProjet $ei_project)
 {
     if (($this->ei_scenario_id = $request->getParameter('ei_scenario_id')) != null) {
         //Recherche du scénario en base
         $this->ei_scenario = Doctrine_Core::getTable('EiScenario')->findOneByIdAndProjectIdAndProjectRef($this->ei_scenario_id, $ei_project->getProjectId(), $ei_project->getRefId());
     } else {
         $this->ei_scenario = null;
     }
 }
Exemplo n.º 12
0
 public function checkEiDelivery(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->delivery_id = $request->getParameter('delivery_id');
     if ($this->delivery_id != null) {
         //Recherche de la livraison en base
         $this->ei_delivery = Doctrine_Core::getTable('EiDelivery')->findOneByIdAndProjectIdAndProjectRef($this->delivery_id, $ei_project->getProjectId(), $ei_project->getRefId());
     } else {
         $this->ei_delivery = null;
     }
 }
 public function getSubjectPriorityForSearchBox(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     //On crèe les priorité par défaut du projet si ces dernières n'existent pas encore
     $this->createDefaultSubjectPriorities($ei_project->getProjectId(), $ei_project->getRefId(), $conn);
     //On récupère les priorités du projet
     return $this->getSubjectPriorityForProjectQuery($ei_project->getProjectId(), $ei_project->getRefId(), $conn)->execute();
 }
Exemplo n.º 14
0
 public function getProjectProfilesAsArray(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     $projectProfiles = $this->getProfils()->where('project_id=? And project_ref=?', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute();
     $arrayTab = array();
     if (count($projectProfiles) > 0) {
         foreach ($projectProfiles as $profile) {
             $arrayTab[$profile->getProfileId() . '_' . $profile->getProfileRef()] = $profile->getName();
         }
     }
     return $arrayTab;
 }
Exemplo n.º 15
0
 public function checkParentTree(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->parent_id = $request->getParameter('parent_id');
     if ($this->parent_id == null) {
         $this->forward404('Parent node parameter not found ...');
     }
     $this->ei_parent_tree = Doctrine_Core::getTable('EiTree')->findOneByIdAndProjectIdAndProjectRef($this->parent_id, $ei_project->getProjectId(), $ei_project->getRefId());
     if ($this->ei_parent_tree == null) {
         $this->forward404('Parent node not found');
     }
 }
Exemplo n.º 16
0
 public function checkDelivery(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->delivery_id = $request->getParameter('delivery_id');
     if ($this->delivery_id == null) {
         $this->forward404('Missing delivery parameters');
     }
     //Recherche de la livraison tout en s'assurant qu'elle corresponde au projet courant
     $this->ei_delivery = Doctrine_Core::getTable('EiDelivery')->findOneByIdAndProjectIdAndProjectRef($this->delivery_id, $ei_project->getProjectId(), $ei_project->getRefId());
     if ($this->ei_delivery == null) {
         $this->forward404('Delivery not found');
     }
 }
Exemplo n.º 17
0
 public function checkCurrentCampaign(sfWebRequest $request, $campaign_id, EiProjet $ei_project)
 {
     $this->current_campaign_id = $campaign_id;
     if ($this->current_campaign_id == null) {
         $this->forward404('Campaign parameter not found');
     } else {
         $this->ei_current_campaign = Doctrine_Core::getTable('EiCampaign')->findOneByIdAndProjectIdAndProjectRef($this->current_campaign_id, $ei_project->getProjectId(), $ei_project->getRefId());
         if ($this->ei_current_campaign == null) {
             $this->forward404('Campaign not found');
         }
     }
 }
Exemplo n.º 18
0
 public function checkSubject(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->subject_id = $request->getParameter('subject_id');
     if ($this->subject_id == null) {
         $this->forward404('Missing subject parameters');
     }
     //Recherche du sujet tout en s'assurant qu'elle corresponde au projet courant
     $this->ei_subject_with_relation = Doctrine_Core::getTable('EiSubject')->getSubject($ei_project->getProjectId(), $ei_project->getRefId(), $this->subject_id);
     $this->ei_subject = Doctrine_Core::getTable('EiSubject')->findOneById($this->subject_id);
     if ($this->ei_subject == null) {
         $this->forward404('Subject not found');
     }
 }
Exemplo n.º 19
0
 public function checkEiSubject(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->subject_id = $request->getParameter('subject_id');
     if ($this->subject_id == null) {
         $this->subject_id = $request->getParameter('id');
     }
     if ($this->subject_id != null) {
         //Recherche du sujet en base
         $this->ei_subject = Doctrine_Core::getTable('EiSubject')->findOneByIdAndProjectIdAndProjectRef($this->subject_id, $ei_project->getProjectId(), $ei_project->getRefId());
     } else {
         $this->ei_subject = null;
     }
 }
Exemplo n.º 20
0
 public function findUserByUsername(EiProjet $ei_project, $request)
 {
     $this->guard_username = $request->getParameter('guard_username');
     if ($this->guard_username == null) {
         $this->forward404('User not found');
     }
     $this->guard_user = Doctrine_Core::getTable('sfGuardUser')->findOneByUsername($this->guard_username);
     if ($this->guard_user == null) {
         $this->forward404('User not found with giving parameter');
     }
     //Vérification de l'appartenance de l'utilisateur au projet courant
     $this->forward404Unless(Doctrine_Core::getTable('EiProjectUser')->getEiProjet($ei_project->getProjectId(), $ei_project->getRefId(), $this->guard_user->getEiUser()), "Acces denied.");
 }
Exemplo n.º 21
0
 public function checkEiFonction(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->ei_fonction_id = $request->getParameter('ei_fonction_id');
     if ($this->ei_fonction_id != null) {
         //Recherche de la fonction en base
         $this->ei_fonction = Doctrine_Core::getTable('EiFonction')->findOneByIdAndProjectIdAndProjectRef($this->ei_fonction_id, $ei_project->getProjectId(), $ei_project->getRefId());
         //Si la fonction n'existe pas , alors on retourne null
         if ($this->ei_fonction == null) {
             $this->ei_fonction = null;
         }
     } else {
         $this->ei_fonction_id = null;
     }
 }
 public function setDefaultPackage($ticket_id, $ticket_ref, EiProjet $ei_project, EiUser $ei_user, $is_new, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     if ($ticket_id != null && $ticket_ref != null) {
         if ($is_new == 0) {
             $conn->insert($this->getInstance(), array('user_ref' => $ei_user->getRefId(), 'user_id' => $ei_user->getUserId(), 'project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'ticket_id' => $ticket_id, 'ticket_ref' => $ticket_ref, 'created_at' => date("Y-m-d H:i:s"), 'updated_at' => date("Y-m-d H:i:s")));
         } else {
             $conn->update($this->getInstance(), array('ticket_id' => $ticket_id, 'ticket_ref' => $ticket_ref, 'updated_at' => date("Y-m-d H:i:s")), array('user_ref' => $ei_user->getRefId(), 'user_id' => $ei_user->getUserId(), 'project_ref' => $ei_project->getRefId(), 'project_id' => $ei_project->getProjectId()));
         }
         return true;
     }
     return false;
 }
Exemplo n.º 23
0
 public function checkItProfile(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->it_profile_id = $request->getParameter('it_profile_id');
     $this->it_profile_ref = $request->getParameter('it_profile_ref');
     if ($this->it_profile_id != null && $this->it_profile_ref != null) {
         //Recherche du profil en base
         $this->ei_it_profile = Doctrine_Core::getTable('EiProfil')->findOneByProfileIdAndProfileRefAndProjectIdAndProjectRef($this->it_profile_id, $this->it_profile_ref, $ei_project->getProjectId(), $ei_project->getRefId());
         //Si la fonction n'existe pas , alors on retourne null
         if ($this->ei_profile == null) {
             throw new Exception("Iteration profile not found ...");
         }
     } else {
         throw new Exception("Missing iteration profile parameters ...");
     }
 }
 public function getProjectCampaignsGraphQuery(EiProjet $ei_project, EiCampaign $ei_campaign = null, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $q = $conn->createQuery()->from(' EiCampaignGraph cg')->leftJoin('cg.EiCampaign c');
     if ($ei_campaign == null) {
         $campaign_id = null;
     } else {
         $campaign_id = $ei_campaign->getId();
     }
     //Si la campagne n'est pas spécifiée , on renvoi une liste vide
     $q = $q->where('c.id = ' . $campaign_id);
     return $q->andWhere('c.project_id= ? And c.project_ref=? ', array($ei_project->getProjectId(), $ei_project->getRefId()));
 }
Exemplo n.º 25
0
 public function getIterationAuthorsForProject(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $typehead = array();
     $iterationAuthors = $conn->createQuery()->from('sfGuardUser u')->select('u.username')->leftJoin('u.iterationAuthor d')->where('project_id= ? And project_ref=? ', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute();
     //Parse iteration author for typehead
     if (count($iterationAuthors) > 0) {
         foreach ($iterationAuthors as $iterationAuthor) {
             $typehead[] = $iterationAuthor->getUsername();
         }
     }
     return $typehead;
 }
 public function getDeliveryStateForSearchBox(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     //Récupération des status de livraison du projet
     $deliveryStates = $conn->createQuery()->from('EiDeliveryState')->where('project_id= ? And project_ref=? ', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute();
     $stateTab = array();
     if (count($deliveryStates) > 0) {
         foreach ($deliveryStates as $deliveryState) {
             $stateTab[$deliveryState->getId()] = $deliveryState->getName();
         }
     }
     return $stateTab;
 }
Exemplo n.º 27
0
 public function getProjectUsers(EiProjet $ei_project, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $typehead = array();
     $u = new sfGuardUser();
     $projectUsers = Doctrine_Core::getTable('sfGuardUser')->createQuery('u')->where('EiUser.guard_id=u.id')->AndWhere('EiProjectUser.user_id=EiUser.user_id And EiProjectUser.user_ref=EiUser.ref_id ')->AndWhere('EiProjectUser.project_id=? And EiProjectUser.project_ref =?', array($ei_project->getProjectId(), $ei_project->getRefId()))->execute();
     //Parse projectUsers for typehead
     if (count($projectUsers) > 0) {
         foreach ($projectUsers as $user) {
             $typehead[] = $user->getEmailAddress();
         }
     }
     return $typehead;
 }
Exemplo n.º 28
0
 public function checkEiScenario(sfWebRequest $request, EiProjet $ei_project)
 {
     if (($this->ei_scenario_id = $request->getParameter('ei_scenario_id')) != null) {
         //Recherche du scénario en base
         $this->ei_scenario = Doctrine_Core::getTable('EiScenario')->findOneByIdAndProjectIdAndProjectRef($this->ei_scenario_id, $ei_project->getProjectId(), $ei_project->getRefId());
         //Si le scénario n'existe pas , alors on retourne un erreur 404
         if ($this->ei_scenario == null) {
             $message = 'Scénario  introuvable!! l identificateur n\'est pas spécifié';
             $request->setParameter('msg', $message);
             $request->setParameter('back_link', $request->getReferer());
             $this->forward('erreur', 'error404');
         }
     } else {
         $this->forward404('Missing scenario parameters  ...');
     }
 }
Exemplo n.º 29
0
 public function checkFunction(sfWebRequest $request, EiProjet $ei_project)
 {
     $this->function_id = $request->getParameter('function_id');
     $this->function_ref = $request->getParameter('function_ref');
     if ($this->function_id != null || $this->function_ref != null) {
         //Recherche de la fonction en base
         $this->kal_function = Doctrine_Core::getTable('KalFunction')->findOneByFunctionIdAndFunctionRefAndProjectIdAndProjectRef($this->function_id, $this->function_ref, $ei_project->getProjectId(), $ei_project->getRefId());
         //Si la fonction n'existe pas , alors on retourne null
         if ($this->kal_function == null) {
             $this->kal_function = null;
         }
     } else {
         $this->function_id = null;
         $this->function_ref = null;
     }
 }
Exemplo n.º 30
0
 public function checkCampaignSubject(sfWebRequest $request, EiProjet $ei_project, EiCampaign $ei_campaign = null)
 {
     $this->subject_id = $request->getParameter('subject_id');
     if ($this->subject_id == null) {
         $this->ei_subject = null;
     } else {
         //Recherche du sujet tout en s'assurant qu'elle corresponde au projet courant
         $this->ei_subject = Doctrine_Core::getTable('EiSubject')->findOneByIdAndProjectIdAndProjectRef($this->subject_id, $ei_project->getProjectId(), $ei_project->getRefId());
         if ($this->ei_subject != null && $ei_campaign != null) {
             //On vérifie l'association entre la campagne et le sujet
             $link = Doctrine_Core::getTable('EiSubjectHasCampaign')->findOneBySubjectIdAndCampaignId($this->subject_id, $ei_campaign->getId());
             if ($link == null) {
                 throw new Exception('This campaign is not associate to the intervention ...');
             }
         }
     }
 }