public static function createNewLink(KalFunction $kal_fonction, EiSubject $bug, $automate = false, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $newLink = new EiSubjectFunctions(); $newLink->setKalFunction($kal_fonction); $newLink->setSubjectId($bug->getId()); $newLink->setAutomate($automate); $currentLink = Doctrine_core::getTable('EiSubjectFunctions')->findOneBySubjectIdAndFunctionIdAndFunctionRef($bug->getId(), $kal_fonction->getFunctionId(), $kal_fonction->getFunctionRef()); if ($currentLink == null) { $newLink->save($conn); //La liaison n'existe pas: on la crée. } if ($currentLink != null && !$currentLink->getAutomate()) { $currentLink->setAutomate($automate); //La liaison existe mais n'est pas forte: on la rend forte. $currentLink->save($conn); } }
public function checkContext(sfWebRequest $request, EiSubject $ei_subject) { $this->ei_context_id = $request->getParameter('id'); if ($this->ei_context_id == null) { $this->forward404('Missing context parameters'); } //Recherche du contexte tout en s'assurant qu'elle corresponde au sujet courant $this->ei_context = Doctrine_Core::getTable('EiBugContext')->getContext($this->ei_context_id); if ($this->ei_context == null) { $this->forward404('Subject not found'); } //Vérification de la possibilité d'accès if ($this->ei_context->getSubjectId() != $ei_subject->getId()) { $this->forward404('Context is not part of subject . Access denied ...'); } }
public function checkSubjectCampaign(EiSubject $ei_subject, EiCampaign $ei_campaign) { $this->subjectCampaign = Doctrine_Core::getTable('EiSubjectHasCampaign')->findOneByCampaignIdAndSubjectId($ei_campaign->getId(), $ei_subject->getId()); }
public function setInterventionAsDefault(EiSubject $ei_subject) { $ei_subject->save(); //$tabPackage= $ei_subject->getPackage(); $this->ei_subject = Doctrine_Core::getTable("EiSubject")->findOneById($ei_subject->getId()); $this->ei_ticket = Doctrine_Core::getTable('EiTicket')->findOneByTicketIdAndTicketRef($this->ei_subject->getPackageId(), $this->ei_subject->getPackageRef()); //On définit le package du sujet comme package courant //On vérifie que le package par défaut du sujet est définit pour le user et le projet $defPack = Doctrine_Core::getTable('EiUserDefaultPackage')->findOneByUserRefAndUserIdAndProjectRefAndProjectId($this->ei_user->getRefId(), $this->ei_user->getUserId(), $ei_subject->getProjectRef(), $ei_subject->getProjectId()); Doctrine_Core::getTable('EiUserDefaultPackage')->setDefaultPackage($this->ei_subject->getPackageId(), $this->ei_subject->getPackageRef(), $this->ei_project, $this->ei_user, $defPack == null ? 0 : 1); }
public function getModifyAndExecDelFunctions(EiDelivery $ei_delivery = null, EiSubject $ei_subject = null, KalFunction $kal_function = null, $executed = true, Doctrine_Connection $conn = null) { if ($conn == null) { $conn = Doctrine_Manager::connection(); } $q = "select COUNT(DISTINCT(lf.ei_scenario_id)) as nbScenario ,COUNT(DISTINCT(fc.campaign_id)) as nbCamp, MAX(tsf.date_debut) as last_ex,\n df.* , tsf.* from ei_delivery_impacted_functions_vw df \n left join ei_test_set_function tsf on tsf.function_id=df.t_obj_id and tsf.function_ref=df.t_ref_obj\n left join eifunction_campaigns fc on fc.function_id=df.t_obj_id and fc.function_ref=df.t_ref_obj\n left join ei_log_function lf on lf.ei_test_set_function_id = tsf.id "; /* On vérifie que la livraison est renseignée et on ajoute le critère de sélection*/ if ($ei_delivery != null) { $q .= " where (df.s_delivery_id = " . $ei_delivery->getId() . " or df.s2_delivery_id = " . $ei_delivery->getId() . ") "; /*Si on recherche les fonctions modifiées et non executées */ if (!$executed) { $q .= " And tsf.id IS NULL"; } else { $q .= " And tsf.id IS NOT NULL"; } } /* Si on recherche les fonctions pour un bug , alors :*/ if ($ei_subject != null) { $q .= " where ( (df.s_id=" . $ei_subject->getId() . ") or (df.s2_id=" . $ei_subject->getId() . ")) "; } /* Si on a spécifié la fonction concernée , alors on rajoute le critère */ if ($ei_subject != null && $kal_function != null) { $q .= " and df.t_obj_id=" . $kal_function->getFunctionId() . " and df.t_ref_obj=" . $kal_function->getFunctionRef(); } /* On complète la requête */ $q .= " group by df.t_id order by tsf.date_debut desc "; //throw new Exception($q); return $conn->fetchAll($q); }
public function setEiSubjectId(EiSubject $ei_subject) { $this->setSubjectId($ei_subject->getId()); }
public function removeAssignmentOnSubject(EiSubject $ei_subject, sfGuardUser $guard, sfGuardUser $author) { $assignment = Doctrine_Core::getTable('EiSubjectAssignment')->findOneBySubjectIdAndGuardId($ei_subject->getId(), $guard->getId()); $assignment->delete(); }