public function addDeliveryInUserSession(EiDelivery $ei_delivery)
 {
     //On enregistre la livraison et le contexte d'enregistrement en session (profil) pour pouvoir retrouver l'objet dans les mêmes circonstances
     $this->getUser()->setAttribute("current_delivery_name", $ei_delivery->getName());
     $this->getUser()->setAttribute("current_delivery_id", $ei_delivery->getId());
     $this->getUser()->setAttribute("current_delivery_project_ref", $ei_delivery->getProjectRef());
     $this->getUser()->setAttribute("current_delivery_project_id", $ei_delivery->getProjectId());
     $this->getUser()->setAttribute("current_delivery_profile_name", $this->profile_name);
     $this->getUser()->setAttribute("current_delivery_profile_id", $this->profile_id);
     $this->getUser()->setAttribute("current_delivery_profile_ref", $this->profile_ref);
 }
 public function createItem(EiScenario $ei_scenario, EiDelivery $ei_delivery, EiTicket $ei_ticket, sfGuardUser $guard_user, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $stmt = $conn->prepare("INSERT INTO ei_package_scenario_conflict (ei_scenario_id,delivery_id,package_id, package_ref,resolved_date,resolved_author,created_at,updated_at) " . "VALUES (:ei_scenario_id,:delivery_id,:package_id, :package_ref,:resolved_date,:resolved_author,:created_at,:updated_at) " . "ON DUPLICATE KEY UPDATE ei_scenario_id=ei_scenario_id, delivery_id=delivery_id, package_id=:package_id,package_ref=:package_ref");
     $stmt->bindValue("ei_scenario_id", $ei_scenario->getId());
     $stmt->bindValue("delivery_id", $ei_delivery->getId());
     $stmt->bindValue("package_id", $ei_ticket->getTicketId());
     $stmt->bindValue("package_ref", $ei_ticket->getTicketRef());
     $stmt->bindValue("resolved_date", date('Y-m-d H:i:s'));
     $stmt->bindValue("resolved_author", $guard_user->getId());
     $stmt->bindValue("created_at", date('Y-m-d H:i:s'));
     $stmt->bindValue("updated_at", date('Y-m-d H:i:s'));
     $stmt->execute(array());
 }
 public function getSimpleSujects(Eiprojet $ei_project, EiDelivery $ei_delivery = null, $state_id = null, $guard_id = null)
 {
     //Requete plus simple car moins de besoin en terme d'objets liés au sujet
     $q = Doctrine_Query::create()->from('EiSubject s')->leftJoin('s.subjectAssignments as')->where('s.project_id=? And s.project_ref=? ', array($ei_project->getProjectId(), $ei_project->getRefId()));
     //Si l'utilisateur est spécifié alors on rajoute le critère
     if ($guard_id != null) {
         $q = $q->andWhere('as.guard_id=' . $guard_id);
     }
     //Si la livraison est spécifiée
     if ($ei_delivery != null) {
         $q = $q->andWhere('s.delivery_id=' . $ei_delivery->getId());
     }
     //Si le statut est spécifié
     if ($state_id != null) {
         $q = $q->andWhere('s.subject_state_id=' . $state_id);
     }
     return $q->execute();
 }
 public function getDeliveryIterationsGroupByProfiles(EiProjet $ei_project, EiDelivery $ei_delivery, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     /* Requête de récupération des itérations d'une livraison groupées par profil. On récupère également les itérations actives en même temps */
     $q = "\n            SELECT p.*,g.id as guard_id ,g.username, i.id as iteration_id,i.delivery_id as i_delivery_id, i.description as i_desc,i.created_at as i_created_at,i.updated_at as i_updated_at,\n            ai.iteration_id as active_iteration_id  FROM ei_profil p\n            left join ei_iteration i on i.profile_id =p.profile_id and i.profile_ref=p.profile_ref And (i.delivery_id=" . $ei_delivery->getId() . " or i.delivery_id is NULL)\n            left join sf_guard_user g on g.id=i.author_id    \n            left join ei_active_iteration ai on ai.iteration_id=i.id\n            WHERE p.project_id= " . $ei_project->getProjectId() . " and p.project_ref=" . $ei_project->getRefId();
     $tabRes = $conn->fetchAll($q);
     $arrayRes = array();
     if (count($tabRes) > 0) {
         foreach ($tabRes as $res) {
             if (!array_key_exists($res['profile_id'] . '-' . $res['profile_ref'], $arrayRes)) {
                 $arrayRes[$res['profile_id'] . '-' . $res['profile_ref']] = array('profile_name' => $res['name'], 'profile_id' => $res['profile_id'], 'profile_ref' => $res['profile_ref'], 'base_url' => $res['base_url'], 'iterations' => array());
             }
             if (array_key_exists($res['profile_id'] . '-' . $res['profile_ref'], $arrayRes) && $res['iteration_id'] != null) {
                 $arrayRes[$res['profile_id'] . '-' . $res['profile_ref']]['iterations'][] = array('iteration_id' => $res['iteration_id'], 'delivery_id' => $res['i_delivery_id'], 'username' => $res['username'], 'description' => $res['i_desc'], 'created_at' => $res['i_created_at'], 'updated_at' => $res['i_updated_at'], 'is_active' => isset($res['active_iteration_id']) && $res['active_iteration_id'] != null ? true : false);
             }
         }
     }
     return $arrayRes;
 }
 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);
 }
Exemple #6
0
 public function checkDeliveryCampaign(EiDelivery $ei_delivery, EiCampaign $ei_campaign)
 {
     $this->ei_delivery_has_campaign = Doctrine_Core::getTable('EiDeliveryHasCampaign')->findOneByDeliveryIdAndCampaignId($ei_delivery->getId(), $ei_campaign->getId());
 }
Exemple #7
0
 public function executeCreate(sfWebRequest $request)
 {
     $this->forward404Unless($request->isMethod(sfRequest::POST));
     $this->checkProject($request);
     //Récupération du projet
     $this->checkProfile($request, $this->ei_project);
     //Récupération du profil courant
     $delivery = new EiDelivery();
     $delivery->setProjectId($this->ei_project->getProjectId());
     $delivery->setProjectRef($this->ei_project->getRefId());
     $delivery->setAuthorId($this->getUser()->getGuardUser()->getId());
     $this->form = new EiDeliveryForm($delivery);
     $this->processForm($request, $this->form);
     $this->setTemplate('new');
 }