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 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);
     }
 }
Example #3
0
 public function getAssignAndNonAssignUserToSubject(EiSubject $ei_subject)
 {
     $this->alreadyAssignUsers = $ei_subject->getAssignUsers();
     $this->usersToAssignToSubject = $ei_subject->getNonAssignUsers($this->alreadyAssignUsers);
 }
Example #4
0
 public function checkSubjectCampaign(EiSubject $ei_subject, EiCampaign $ei_campaign)
 {
     $this->subjectCampaign = Doctrine_Core::getTable('EiSubjectHasCampaign')->findOneByCampaignIdAndSubjectId($ei_campaign->getId(), $ei_subject->getId());
 }
 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());
 }
Example #7
0
 public function removeAssignmentOnSubject(EiSubject $ei_subject, sfGuardUser $guard, sfGuardUser $author)
 {
     $assignment = Doctrine_Core::getTable('EiSubjectAssignment')->findOneBySubjectIdAndGuardId($ei_subject->getId(), $guard->getId());
     $assignment->delete();
 }
Example #8
0
function createSubject(EiProjet $ei_project, $superAdmin)
{
    $ei_subject = new EiSubject();
    $ei_subject->setName("Bug" . time());
    $ei_subject->setAuthorId($superAdmin->getId());
    $ei_subject->setProjectId($ei_project->getProjectId());
    $ei_subject->setProjectRef($ei_project->getRefId());
    $ei_subject->save();
    return $ei_subject;
}
Example #9
0
 public function executeCreateContext(sfWebRequest $request)
 {
     $this->guardUser = $this->getUser()->getGuardUser();
     $this->checkProject($request);
     //Récupération du projet
     $this->checkProfile($request, $this->ei_project);
     $this->checkCampaignGraph($request);
     $context = new EiBugContext();
     $context->setCampaignId($this->ei_campaign_graph->getCampaignId());
     $context->setScenarioId($this->ei_campaign_graph->getScenarioId());
     $context->setCampaignGraphId($this->ei_campaign_graph->getId());
     $context->setEiDataSetId($this->ei_campaign_graph->getDataSetId());
     $context->setProfileId($this->ei_profile->getProfileId());
     $context->setProfileRef($this->ei_profile->getProfileRef());
     $context->setAuthorId($this->guardUser->getId());
     $subject = new EiSubject();
     $subject->setProjectId($this->ei_project->getProjectId());
     $subject->setProjectRef($this->ei_project->getRefId());
     $subject->setAuthorId($this->guardUser->getId());
     $this->form = new EiSubjectForm($subject, array('ei_project' => $this->ei_project, 'guardUser' => $this->guardUser, 'ei_bug_context' => $context));
     $this->processForm($request, $this->form);
     if ($this->success) {
         $show = $this->urlParameters;
         $show['ei_context'] = $this->ei_context;
         return $this->renderText(json_encode(array('html' => $this->getPartial('bugContext/show', $show), 'success' => $this->success)));
     } else {
         $newContextForm = $this->urlParameters;
         $newContextForm['form'] = $this->form;
         $newContextForm['campaign_graph_id'] = $this->campaign_graph_id;
         return $this->renderText(json_encode(array('html' => $this->getPartial('bugContext/newContextForm', $newContextForm), 'success' => $this->success)));
     }
     return sfView::NONE;
 }
 public function getSubjectWithRel(EiProjet $ei_project, $delivery_id = null, $subject_id = null, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $q = "select * from ei_subjects_with_relations_vw where project_id=" . $ei_project->getProjectId() . " and project_ref=" . $ei_project->getRefId();
     if ($delivery_id != null) {
         $q .= " and delivery_id=" . $delivery_id;
     }
     if ($subject_id != null) {
         $q .= " and id=" . $subject_id;
     }
     return EiSubject::parseSubjects($conn->fetchAll($q));
 }
 public function getBugWithImpactOrNot($delivery_id, $hasImpact = true, Doctrine_Connection $conn = null)
 {
     $q = "select distinct(s.id), s.name  ,vwf.delivery_id, ss.name as ss_name, ss.color_code as ss_color_code,st.name as type_name,sp.name as sp_name,g.id as assign_id,g.username as assign_name\n            from ei_subject s\n            left join ei_subject_state ss on ss.id=s.subject_state_id\n            left join ei_subject_type st on st.id=s.subject_type_id\n            left join ei_subject_priority sp on sp.id=s.subject_priority_id\n            left join ei_subject_assignment sa on sa.subject_id=s.id\n            left join sf_guard_user g on g.id=sa.guard_id \n            left join \n            (\n            SELECT  IF(s_id is null,  s2_id , s_id) as subject_id, IF(s_delivery_id is null,  s2_delivery_id , s_delivery_id) as delivery_id from\n              ei_delivery_impacted_functions_vw     \n            WHERE t_type='Function' )  as vwf\n            on s.id= vwf.subject_id\n            where  s.delivery_id=" . $delivery_id;
     if ($hasImpact) {
         $q .= " and vwf.subject_id is not  null";
     } else {
         $q .= " and vwf.subject_id is   null";
     }
     return EiSubject::parseSubjects($conn->fetchAll($q));
 }