diff --git a/library/Class/CriteresRecherche.php b/library/Class/CriteresRecherche.php index e7d53818cdbc23a888b47817eed4de5ac343263b..b1653d26e4105e9e27bf24bc75405826517daa07 100644 --- a/library/Class/CriteresRecherche.php +++ b/library/Class/CriteresRecherche.php @@ -93,6 +93,7 @@ class Class_CriteresRecherche { 'type_recherche', 'annexe', 'geo_zone', + 'geo_bib', 'fil', 'bib_select', 'serie']); @@ -158,6 +159,11 @@ class Class_CriteresRecherche { return $this->getParam('geo_zone',false); } + + public function getGeoBib() { + return $this->getParam('geo_bib', false); + } + public function getGenre() { return $this->getParam('genre', null); @@ -197,6 +203,11 @@ class Class_CriteresRecherche { $filtres[]=$bib_ids; } + if (($geo_bib = $this->getGeoBib()) + && $bib = Class_Bib::find((int)$geo_bib)) { + $filtres[] = ['B'.$bib->getId()]; + } + return array_filter($filtres); } @@ -425,7 +436,9 @@ class Class_CriteresRecherche { foreach($valid_parameters as $key) { if (array_isset($key, $params)) { - if (preg_match('/^operateur_/', $key) && (!array_key_exists(str_replace('operateur_','rech_',$key),$params) || $params[str_replace('operateur_','rech_',$key)]=='')) { + if (preg_match('/^operateur_/', $key) + && (!array_key_exists(str_replace('operateur_','rech_',$key),$params) + || $params[str_replace('operateur_','rech_',$key)]=='')) { continue; } diff --git a/tests/application/modules/admin/controllers/CmsControllerTest.php b/tests/application/modules/admin/controllers/CmsControllerTest.php index dff4f2a93adcc9925cc4d3b58425b02f03ae37ae..00f14be96b8f5c7aa7f99d98c00a0210bd035332 100644 --- a/tests/application/modules/admin/controllers/CmsControllerTest.php +++ b/tests/application/modules/admin/controllers/CmsControllerTest.php @@ -2055,6 +2055,7 @@ class CmsControllerCategorieEvenementTest extends CmsControllerTestCase { class CmsControllerCategorieNotFoundTest extends CmsControllerTestCase { /** @test */ function deleteShouldRedirectToAdminCms() { + Class_Article::beVolatile(); $this->dispatch('/admin/cms/delete/id/999'); $this->assertRedirect('admin/cms'); } diff --git a/tests/application/modules/admin/controllers/FormationControllerTest.php b/tests/application/modules/admin/controllers/FormationControllerTest.php index d642ff0cb46ae45d1c5e8c6b32766d341b03498c..3b7615b30257b0ac319b40213586c8d90c5a2f1b 100644 --- a/tests/application/modules/admin/controllers/FormationControllerTest.php +++ b/tests/application/modules/admin/controllers/FormationControllerTest.php @@ -1716,7 +1716,7 @@ class FormationControllerGetActionTest extends Admin_AbstractControllerTestCase{ public function setUp() { parent::setUp(); - Class_Formation::beVolatile(); + Class_SessionFormationInscription::beVolatile(); $this->fixture('Class_Formation', ['id' => 1 , diff --git a/tests/library/Class/MoteurRechercheTest.php b/tests/library/Class/MoteurRechercheTest.php index 3bc7c1359a53d597673bc7d77317ce5df819d60e..40487f55719b43d17d4756e4a8831edac2c620b7 100644 --- a/tests/library/Class/MoteurRechercheTest.php +++ b/tests/library/Class/MoteurRechercheTest.php @@ -148,7 +148,19 @@ class MoteurRechercheAvanceeTest extends MoteurRechercheAbstractTest { 'req_notices' => "Select id_notice from notices Where titres like 'LES DECISIONS ABSURDES%' and MATCH(facettes) AGAINST('+S1 +YMED1 +M4669 +(YTUN YTAP) +(B3 B4)' IN BOOLEAN MODE) order by alpha_titre", 'req_comptage' => "Select count(*) from notices Where titres like 'LES DECISIONS ABSURDES%' and MATCH(facettes) AGAINST('+S1 +YMED1 +M4669 +(YTUN YTAP) +(B3 B4)' IN BOOLEAN MODE)", 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where titres like 'LES DECISIONS ABSURDES%' and MATCH(facettes) AGAINST('+S1 +YMED1 +M4669 +(YTUN YTAP) +(B3 B4)' IN BOOLEAN MODE) limit 15000" - ] + ], + + [ ['rech_auteurs' => 'Stiegler', 'operateur_auteurs' => 'and', + 'annexe' => 'MED1', + 'facettes' => 'G23-A345', + 'selection_annexe' => 'TUN;TAP', + 'selection_sections' => '1;12;9', + 'geo_bib' => 3, + 'type_recherche' => 'commence', 'pertinence' => true, 'tri' => 'alpha_titre'] , + 'req_notices' => "Select id_notice from notices Where auteurs like 'STIEGLER%' and MATCH(facettes) AGAINST('+YMED1 +G23 +A345 +(YTUN YTAP) +(S1 S12 S9) +(B3)' IN BOOLEAN MODE) order by alpha_titre", + 'req_comptage' => "Select count(*) from notices Where auteurs like 'STIEGLER%' and MATCH(facettes) AGAINST('+YMED1 +G23 +A345 +(YTUN YTAP) +(S1 S12 S9) +(B3)' IN BOOLEAN MODE)", + 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where auteurs like 'STIEGLER%' and MATCH(facettes) AGAINST('+YMED1 +G23 +A345 +(YTUN YTAP) +(S1 S12 S9) +(B3)' IN BOOLEAN MODE) limit 15000" + ], ]; } @@ -214,6 +226,15 @@ class MoteurRechercheSimpleTest extends MoteurRechercheAbstractTest { ] , + [ ['expressionRecherche' => '2-7427-3315-9', + 'geo_bib' => 3, + 'tri' => 'alpha_auteur'] , + 'nb_mots'=> null, + 'req_comptage' => "Select count(*) from notices Where (isbn='2-7427-3315-9' or isbn='978-2-7427-3315-6') and MATCH(facettes) AGAINST('+(B3)' IN BOOLEAN MODE)", + 'req_liste' => "Select id_notice from notices Where (isbn='2-7427-3315-9' or isbn='978-2-7427-3315-6') and MATCH(facettes) AGAINST('+(B3)' IN BOOLEAN MODE) order by alpha_auteur", + 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where (isbn='2-7427-3315-9' or isbn='978-2-7427-3315-6') and MATCH(facettes) AGAINST('+(B3)' IN BOOLEAN MODE) limit 15000" + ] , + [ [ 'expressionRecherche' => '9782742761579' ] , 'nb_mots'=> null, @@ -222,13 +243,7 @@ class MoteurRechercheSimpleTest extends MoteurRechercheAbstractTest { 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where (isbn='2-7427-6157-8' or isbn='978-2-7427-6157-9') limit 15000" ], - /* [ [ 'expressionRecherche' => 'Les ignorants' , 'clef_chapeau' => 'IGNORANTS'] , - 'nb_mots'=> null, - 'req_comptage' => "Select count(*) from notices Where (isbn='2-7427-6157-8' or isbn='978-2-7427-6157-9') ", - 'req_liste' => "select id_notice from notices Where (isbn='2-7427-6157-8' or isbn='978-2-7427-6157-9') ", - 'req_facettes' => "select id_notice,type_doc,facettes from notices Where (isbn='2-7427-6157-8' or isbn='978-2-7427-6157-9') limit 15000" - ], - */ + [ [ 'expressionRecherche' => '9782742761579', 'selection_bib'=> 1 ] , 'nb_mots'=> null, 'req_comptage' => "Select count(*) from notices Where (isbn='2-7427-6157-8' or isbn='978-2-7427-6157-9') and MATCH(facettes) AGAINST('+B1' IN BOOLEAN MODE)", @@ -339,13 +354,22 @@ class MoteurRechercheRebondTest extends MoteurRechercheAbstractTest { 'tri' => 'alpha_titre', 'code_rebond' => 'A888', 'geo_zone' => 2] , - 'req_comptage' => "Select count(*) from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE)", 'req_liste' => "Select id_notice from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE) order by alpha_titre", 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE) limit 15000" + ] , + + [ ['expressionRecherche' => 'Tom Cora', + 'tri' => 'alpha_titre', + 'code_rebond' => 'A888', + 'geo_bib' => 3] , + 'req_comptage' => "Select count(*) from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE)", + 'req_liste' => "Select id_notice from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE) order by alpha_titre", + 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE) limit 15000" ] , + [ ['rech_auteurs' => 'Fred Frith', 'tri' => 'alpha_titre', 'code_rebond' => 'A888', @@ -391,8 +415,7 @@ class MoteurRechercheRebondTest extends MoteurRechercheAbstractTest { 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where MATCH(facettes) AGAINST('+A92929 +M52291 +A15067 +(YTUN YTAP) +(S1 S12 S9)' IN BOOLEAN MODE) limit 15000" ], - [ - ['expressionRecherche' => 'Biologie et structure', + [ ['expressionRecherche' => 'Biologie et structure', 'tri' => 'alpha_titre', 'fil' => ';X1', 'code_rebond' => 'A888', @@ -401,10 +424,21 @@ class MoteurRechercheRebondTest extends MoteurRechercheAbstractTest { 'geo_zone' => 2] , 'req_comptage' => "Select count(*) from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE)", - 'req_liste' =>"Select id_notice from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE) order by alpha_titre", 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where MATCH(facettes) AGAINST('+A888 +(B3 B4)' IN BOOLEAN MODE) limit 15000" + ], + + [ ['expressionRecherche' => 'Biologie et structure', + 'tri' => 'alpha_titre', + 'fil' => ';X1', + 'code_rebond' => 'A888', + 'rubrique' =>'P4', + 'selection_annexe' => ' ', + 'geo_bib' => 3] , + 'req_comptage' => "Select count(*) from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE)", + 'req_liste' =>"Select id_notice from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE) order by alpha_titre", + 'req_facettes' => "Select id_notice,type_doc,facettes from notices Where MATCH(facettes) AGAINST('+A888 +(B3)' IN BOOLEAN MODE) limit 15000" ] ]; }