diff --git a/cosmogramme/php/integre_traite_main.php b/cosmogramme/php/integre_traite_main.php index ca77f6d96ef92d6443cee2a0e5ee78b8da04922e..12272f1e7fd71a682ca180125d660ba40822d33c 100644 --- a/cosmogramme/php/integre_traite_main.php +++ b/cosmogramme/php/integre_traite_main.php @@ -275,8 +275,7 @@ if ($phase == "0") $phase = "0.1"; // ---------------------------------------------------------------- // PSEUDO-NOTICES - cms rss sitotheque et albums (phase 0.1 a 0.6) // ---------------------------------------------------------------- -if ($phase > 0 and $phase < 1) -{ +if ($phase > 0 and $phase < 1) { include("integration/pseudo_notices.php"); $phase = 1; } diff --git a/library/Class/Catalogue.php b/library/Class/Catalogue.php index 20adf9e55a393ce1feca7fe96ea3e62aa58ea0f9..549c2b817b04587cec19da21d630e8be5c89ba64 100644 --- a/library/Class/Catalogue.php +++ b/library/Class/Catalogue.php @@ -383,7 +383,8 @@ class Class_Catalogue extends Storm_Model_Abstract { public function deleteThesaurusInFacette($id_thesaurus) { $sql = Zend_Registry::get('sql'); - $sql->query('update notices set facettes = clean_spaces(replace(facettes,"H'.$id_thesaurus.'","")) where match(facettes) against("+H'.$id_thesaurus.'" in boolean mode)'); + $sql->query('update notices set facettes = clean_spaces(replace(facettes,"H'.$id_thesaurus.'","")) '. + 'where match(facettes) against("+H'.$id_thesaurus.'" in boolean mode)'); } diff --git a/library/Class/Indexation/PseudoNotice.php b/library/Class/Indexation/PseudoNotice.php index 7e8b5dc2bec0228c8a09b8df0b861781555b0ef0..280045bf2f580ef4804e6b008ca1c1ea062bdc31 100644 --- a/library/Class/Indexation/PseudoNotice.php +++ b/library/Class/Indexation/PseudoNotice.php @@ -63,8 +63,9 @@ class Class_Indexation_PseudoNotice { public function __construct($type_doc, $datas) { $this->_type_doc = (int)$type_doc; $this->_indexation = new Class_Indexation(); - $this->_datas = $datas; - $this->_model = call_user_func_array([$this->_model_name, 'find'], [$datas[$this->_id]]); + $this->_datas = array_change_key_case($datas, CASE_LOWER); + $this->_model = call_user_func_array([$this->_model_name, 'find'], + [$this->_datas[$this->_id]]); } public function getId() { @@ -431,7 +432,7 @@ class Class_Indexation_PseudoNotice_Album extends Class_Indexation_PseudoNotice{ class Class_Indexation_PseudoNotice_Cms extends Class_Indexation_PseudoNotice{ protected $_model_name = 'Class_Article'; - protected $_id = 'ID_ARTICLE'; + protected $_id = 'id_article'; protected $_label='m1'; protected function _prepare() { @@ -443,7 +444,7 @@ class Class_Indexation_PseudoNotice_Cms extends Class_Indexation_PseudoNotice{ class Class_Indexation_PseudoNotice_Rss extends Class_Indexation_PseudoNotice{ protected $_model_name = 'Class_Rss'; - protected $_id = 'ID_RSS'; + protected $_id = 'id_rss'; protected $_label='m2'; } diff --git a/tests/library/Class/Indexation/PseudoNoticeTest.php b/tests/library/Class/Indexation/PseudoNoticeTest.php index 99ed09366fd2d6b5a6405163f0d3cab7c2630816..955ee80e51b748f0f921547cd905743b2454f9f9 100644 --- a/tests/library/Class/Indexation/PseudoNoticeTest.php +++ b/tests/library/Class/Indexation/PseudoNoticeTest.php @@ -69,6 +69,39 @@ class Class_Indexation_PseudoNoticeAlbumTest extends Class_Indexation_PseudoNoti +class Class_Indexation_PseudoNoticeSitothequeFromRawSQLTest extends Class_Indexation_PseudoNoticeTestCase { + protected $_sito; + protected $_notice; + + + public function setUp() { + parent::setUp(); + $this->fixture('Class_Sitotheque', ['id' => 12, + 'titre' => 'Thot cursus', + 'url' => 'http://cursus.edu/', + 'description' => 'Top notch site', + 'tags' => 'VOD']); + + /** as done in Cosmogramme */ + Class_Indexation_PseudoNotice::newWith(Class_Indexation_PseudoNotice::TYPE_SITO, + ['ID_SITO' => 12, + 'TITRE' => 'Thot cursus', + 'URL' => 'http://cursus.edu/', + 'DESCRIPTION' => 'Top notch site', + 'TAGS' => 'VOD'])->save(); + + $this->_notice = Class_Notice::find(1); + } + + /** @test */ + public function titleShouldBeIndexed() { + $this->assertEquals('Thot cursus', $this->_notice->getTitrePrincipal()); + } +} + + + + class Class_Indexation_PseudoNoticeSitothequeTest extends Class_Indexation_PseudoNoticeTestCase { protected $_sito; protected $_notice;