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;
     }
 }
 public function getScriptsForProfile(KalFunction $function, EiProfil $profile)
 {
     if ($function == null || $profile == null) {
         return null;
     }
     return $this->getInstance()->createQuery('s')->select('s.script_id')->where('KalFunction.function_id=s.function_id And KalFunction.function_ref=s.function_ref')->AndWhere('KalFunction.function_id=? And KalFunction.function_ref=? ', array($function->getFunctionId(), $function->getFunctionRef()))->AndWhere('EiScriptVersion.script_id=s.script_id And EiScriptVersion.profile_id=? And EiScriptVersion.profile_ref=?', array($profile->getProfileId(), $profile->getProfileRef()))->AndWhere('EiFunctionHasCommande.script_id=s.script_id')->fetchArray();
 }
 /**
  * @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());
     }
 }
 public function saveActiveIteration($iteration_id, EiProjet $ei_project, EiProfil $ei_profile, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $itLink = new EiActiveIteration();
     $itLink->setProjectId($ei_project->getProjectId());
     $itLink->setProjectRef($ei_project->getRefId());
     $itLink->setProfileId($ei_profile->getProfileId());
     $itLink->setProfileRef($ei_profile->getProfileRef());
     $itLink->setIterationId($iteration_id);
     $itLink->save($conn);
 }
Example #5
0
 public static function getScriptUpdateResult(EiProjet $ei_project, EiProfil $kal_profil, EiTicket $ei_ticket, $json_string, KalFunction $kal_function, EiUser $ei_user, $script_id = 0, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $ei_subject = Doctrine_Core::getTable("EiSubject")->findOneByPackageIdAndPackageRef($ei_ticket->getTicketId(), $ei_ticket->getTicketRef());
     if ($ei_subject == null) {
         return array("success" => false, "message" => "Intervention not found ... ");
     }
     //Intervention non trouvée
     //Appel du webservice
     $result_update = MyFunction::loadResultOfWebServiceByPostJson(MyFunction::getPrefixPath(null) . "serviceweb/project/script/update.json", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'ticket_id' => $ei_ticket->getTicketId(), 'ticket_ref' => $ei_ticket->getTicketRef(), 'profile_id' => $kal_profil->getProfileId(), 'profile_ref' => $kal_profil->getProfileRef(), 'function_id' => $kal_function->getFunctionId(), 'function_ref' => $kal_function->getFunctionRef(), 'script_id' => $script_id, 'user_id' => $ei_user->getUserId(), 'user_ref' => $ei_user->getRefId(), 'package_name' => "Package_S" . $ei_subject->getId(), 'json_string' => rawurlencode($json_string)));
     //Récupération du projet pour traitement
     //        if ($result_update == null) return null;
     //        $result_file->loadXML($result_update);
     //        $result_file->save('result_update.xml'); /* sauvegarde du fichier pour vérifier le bon fonctionnement du web service */
     //        $result_item=$result_file->documentElement;
     //        if ($result_item->getElementsByTagName("error")->item(0)):
     //            return -1;
     //        endif;
     //        if ($result_item->getElementsByTagName("process_error")->item(0)):
     //            return 0;
     //        endif;
     //        if ($result_item->getElementsByTagName("process_ok")->item(0)):
     //            return 1;
     //        endif;
     try {
         $conn->beginTransaction();
         //Récupération du ticket pour traitement
         $array_result = json_decode(html_entity_decode($result_update), true);
         //Récupération du projet pour traitement
         if (count($array_result) == 0) {
             return array("success" => false, "message" => "Error on transaction");
         }
         if (array_key_exists("error", $array_result)) {
             return array("success" => false, "message" => $array_result["error"]);
         }
         if (array_key_exists("process_error", $array_result)) {
             return array("success" => false, "message" => $array_result["process_error"]);
         }
         if (!$array_result[0]) {
             return array("success" => false, "message" => "Empty result content");
         }
         self::reload($array_result, $conn);
         $conn->commit();
         return array("success" => true, "message" => "Transaction maded successfully");
     } catch (Exception $e) {
         throw new Exception($e);
         $conn->rollback();
         return array("success" => false, "message" => "Error on reload process ...");
     }
 }
 public function getCurrentNoticeVersion(EiProjet $ei_project, EiProfil $ei_profile, KalFunction $kal_function, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $q = $conn->fetchAll("select vn.*, np.* from ei_version_notice vn \n            left join ei_notice n on n.notice_id=vn.notice_id and n.notice_ref=vn.notice_ref \n            left join kal_function k on k.function_id=n.function_id and k.function_ref= n.function_ref\n            left join ei_notice_profil np on vn.notice_id=np.notice_id and np.notice_ref=vn.notice_ref and np.version_notice_id=vn.version_notice_id \n\n            where k.function_id=" . $kal_function->getFunctionId() . " and k.function_ref=" . $kal_function->getFunctionRef() . "\n            and np.profile_id=" . $ei_profile->getProfileId() . " and np.profile_ref=" . $ei_profile->getProfileRef() . " and vn.lang='" . $ei_project->getDefaultNoticeLang() . "'");
     if (count($q) > 0) {
         return $q[0];
     }
     return array();
 }
Example #7
0
 /**
  * Méthode permettant de récupérer la version associée
  * au profil passé en paramètres.
  * @param type $profile_id
  * @return type
  * @throws Exception 
  */
 public function getVersionForProfil(EiProfil $ei_profile)
 {
     $versions = Doctrine_Query::create()->from('EiVersion v ')->where('EiProfilScenario.ei_scenario_id=v.ei_scenario_id And EiProfilScenario.ei_version_id=v.id')->AndWhere('EiProfilScenario.ei_scenario_id=? And
                         EiProfilScenario.profile_id=? And EiProfilScenario.profile_ref=?', array($this->getId(), $ei_profile->getProfileId(), $ei_profile->getProfileRef()))->execute();
     if (!$versions->getFirst()) {
         return null;
     }
     return $versions->getFirst();
 }
Example #8
0
 public function getVersionNoticeByProfil(EiProfil $profil, EiProjet $ei_project, $lang)
 {
     $notice = $this->getKalFonction()->getNotice();
     $result = Doctrine_Core::getTable('EiVersionNotice')->createQuery('v')->where('EiNoticeProfil.notice_id=v.notice_id And EiNoticeProfil.notice_ref=v.notice_ref
                         And EiNoticeProfil.version_notice_id=v.version_notice_id ')->andWhere("EiNoticeProfil.profile_id=? And EiNoticeProfil.profile_ref=?", array($profil->getProfileId(), $profil->getProfileRef()))->andWhere("v.notice_id=? And v.notice_ref=?", array($notice->getNoticeId(), $notice->getNoticeRef()))->andWhere('v.lang=?', array($lang))->execute();
     if ($result->getFirst()) {
         return $result->getFirst();
     }
     //Si la version de notice n'est pas spécifiée pour la langue donnée,
     // on retourne celle definie avec la langue definie par défaut sur le projet
     $result2 = Doctrine_Core::getTable('EiVersionNotice')->createQuery('v')->where('EiNoticeProfil.notice_id=v.notice_id And EiNoticeProfil.notice_ref=v.notice_ref
                         And EiNoticeProfil.version_notice_id=v.version_notice_id ')->andWhere("EiNoticeProfil.profile_id=? And EiNoticeProfil.profile_ref=?", array($profil->getProfileId(), $profil->getProfileRef()))->andWhere("v.notice_id=? And v.notice_ref=?", array($notice->getNoticeId(), $notice->getNoticeRef()))->andWhere('v.lang=? ', array($ei_project->getDefaultNoticeLang()))->execute();
     if ($result2->getFirst()) {
         return $result2->getFirst();
     }
     //Si aucune version de notice est trouvé on retourne null
     return null;
 }
 public function MigrateManyFunctions(EiProjet $ei_project, EiProfil $ei_profile, sfGuardUser $guard, $tab_functions)
 {
     $result_file = new DOMDocument();
     //Appel du webservice
     $result_update = self::loadResultOfWebServiceForMigration(MyFunction::getPrefixPath(null) . "/serviceweb/bug/migrateMany.xml", array('project_id' => $ei_project->getProjectId(), 'project_ref' => $ei_project->getRefId(), 'profile_id' => $ei_profile->getProfileId(), 'profile_ref' => $ei_profile->getProfileRef(), 'guard_id' => $guard->getId(), 'tab_functions' => $tab_functions));
     //Récupération du projet pour traitement
     if ($result_update == null) {
         return null;
     }
     $result_file->loadXML($result_update);
     $result_file->save('result_migrate_many_bug.xml');
     /* sauvegarde du fichier pour vérifier le bon fonctionnement du web service */
     $result_item = $result_file->documentElement;
     if ($result_item->getElementsByTagName("process_error")->item(0)) {
         return 0;
     }
     if ($result_item->getElementsByTagName("process_ok")->item(0)) {
         return true;
     }
 }
Example #10
0
 public function setEiProfile(EiProfil $ei_profile)
 {
     $this->setProfileId($ei_profile->getProfileId());
     $this->setProfileRef($ei_profile->getProfileRef());
 }
 public function updateExistProfile(EiProfil $profile, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     $conn->createQuery()->update('EiProfil')->set('name', '?', $profile->getName())->set('base_url', '?', $profile->getBaseUrl())->set('description', '?', $profile->getDescription())->set('is_default', '?', $profile->getIsDefault())->set('parent_id', '?', $profile->getParentId())->set('parent_ref', '?', $profile->getParentRef())->where('profile_id=? And profile_ref=? ', array($profile->getProfileId(), $profile->getProfileRef()))->execute();
 }
Example #12
0
 public function getLastIterationForProfile(EiProfil $ei_profile, Doctrine_Connection $conn = null)
 {
     if ($conn == null) {
         $conn = Doctrine_Manager::connection();
     }
     return Doctrine_core::getTable("EiIteration")->getLastIterationForProfile($this->getProjectId(), $this->getProjectRef(), $this->getId(), $ei_profile->getProfileId(), $ei_profile->getProfileRef(), $conn);
 }