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();
 }
Пример #2
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;
 }