Skip to content
Snippets Groups Projects
Commit dcc3162c authored by Laurent's avatar Laurent
Browse files

Merge branch 'hotline#24503_marc_facets' into 'hotline-master'

Hotline#24503 marc facets

See merge request !837
parents b3e1fbba 2b7dcef4
Branches
Tags
2 merge requests!896Master,!850Master
-ticket #24503: fixe les thesaurus dont le titre contient des caractères autre que [a-zA-Z0-9]
......@@ -63,7 +63,8 @@ class Cosmo_FacetsController extends Zend_Controller_Action {
}
if (!$model->getIdThesaurus()) {
$libelle = substr(str_replace(' ' ,'', $this->_getParam('libelle_facette')),0,4);
$libelle = preg_replace('/[^a-zA-Z0-9]/', '', $this->_getParam('libelle_facette'));
$libelle = substr($libelle, 0, 4);
$id_thesaurus = $this->generateNewIdThesaurusForLabel($libelle);
$model->setIdThesaurus($id_thesaurus);
$model->setCode($libelle);
......
......@@ -187,6 +187,19 @@ class Cosmo_DynamicFacetsControllerValidateTest extends Cosmo_DynamicFacetsContr
Class_CodifThesaurus::findFirstBy(['libelle'=>'doc'])->getIdThesaurus());
}
/** @test */
public function withSpecialCharsNewIdThesaurusShouldBeFourLetters() {
$this->postDispatch(
'/cosmo/facets/validate',
['libelle_facette' => 'Année top 5',
'rules' => '66$6']);
$this->assertEquals('ANNE',
Class_CodifThesaurus::findFirstBy(['libelle'=>'Année top 5'])->getIdThesaurus());
}
}
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment