Commit 7235fd83 authored by Laurent's avatar Laurent

dev#102397 : Facets : The thesaurii Id cannot take more than 10000 values

parent 0582a0dd
Pipeline #9726 passed with stage
in 49 minutes and 19 seconds
- ticket #102397 : Le nombre d'entrées pour les facettes dynamiques peut maintenant aller jusqu'à 1 679 615 (au lieu de 9 999 auparavant).
\ No newline at end of file
......@@ -243,9 +243,10 @@ class CodifThesaurusLoader extends Storm_Model_Loader {
public function incrementId($id) {
$last=substr($id,strlen($id)-4);
$last=base_convert(substr($id,strlen($id)-4), 36, 10);
$first_part=substr($id,0,strlen($id)-4);
$last++;
$last = strtoupper(base_convert($last, 10, 36));
return $first_part.$this->getCodeSur4Chiffres($last,true);
}
......@@ -731,7 +732,7 @@ class Class_CodifThesaurus extends Storm_Model_Abstract {
$this->checkAttribute('id_thesaurus',
$my_key != $empty_key,
$this->_('Nombre maximum d\'élément à ce niveau déjà atteint (%s)',
str_repeat('9', self::ID_KEY_LENGTH)));
str_repeat('Z', self::ID_KEY_LENGTH)));
}
......
......@@ -58,14 +58,20 @@ class CodifThesaurusCommonTest extends ModelTestCase {
/** @test */
public function incrementYYYY0001ShouldReturnYYYY0002() {
$this->assertEquals('YYYY1000', Class_CodifThesaurus::incrementId('YYYY0999'));
public function incrementYYYY0999ShouldReturnYYYY099A() {
$this->assertEquals('YYYY099A', Class_CodifThesaurus::incrementId('YYYY0999'));
}
/** @test */
public function incrementYYYY00ZZShouldReturnYYYY0100() {
$this->assertEquals('YYYY01AA', Class_CodifThesaurus::incrementId('YYYY00ZZ'));
$this->assertEquals('YYYY0100', Class_CodifThesaurus::incrementId('YYYY00ZZ'));
}
/** @test */
public function incrementYYYY0009ShouldReturnYYYY000A() {
$this->assertEquals('YYYY000A', Class_CodifThesaurus::incrementId('YYYY0009'));
}
......@@ -203,7 +209,7 @@ class CodifThesaurusTooManyValuesTest extends ModelTestCase {
'rules' => null]);
$this->fixture('Class_CodifThesaurus',
['id_thesaurus' => 'TEST9999',
['id_thesaurus' => 'TESTZZZZ',
'id_origine' => 'RIME',
'libelle' => 'rime',
'code' => 'TEST',
......@@ -215,7 +221,7 @@ class CodifThesaurusTooManyValuesTest extends ModelTestCase {
/** @test */
public function shouldNotInsertMoreThan9999Child() {
public function shouldNotInsertMoreThanZZZZChild() {
Class_CodifThesaurus::find(723)
->getOrCreateChild(strtoupper('métiers de la recherche'),
'métiers de la recherche');
......
Markdown is supported
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