From da0f7aaeb20683a1911d0b59c377c92643adb4c4 Mon Sep 17 00:00:00 2001 From: llaffont <llaffont@afi-sa.fr> Date: Tue, 1 Sep 2015 10:27:15 +0200 Subject: [PATCH] hotline #28796 fix duplicate entries for dynamic facets when label size is more than 20 characters --- cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php | 2 +- library/Class/CodifThesaurus.php | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php index a665b4e31a7..70ceb22dd5d 100644 --- a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php +++ b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php @@ -213,7 +213,7 @@ class KohaRecordIntegrationVagabondWithThesaurusOn702DollarATest extends KohaRec ['id' => 5, 'libelle' => 'd\'après l\'oeuvre d\'Eiji Yoshikawa, "Miyamoto Musashi"', 'id_thesaurus' => 'SUMM0001', - 'id_origine' => 'D\'APRèS L\'OEUVRE D\'', + 'id_origine' => 'D\'APRèS L\'OEUVRE D\'E', 'code' => 'summary' ]); diff --git a/library/Class/CodifThesaurus.php b/library/Class/CodifThesaurus.php index 56984d5aa6f..8f3a0663eb5 100644 --- a/library/Class/CodifThesaurus.php +++ b/library/Class/CodifThesaurus.php @@ -243,8 +243,9 @@ class Class_CodifThesaurus extends Storm_Model_Abstract { public function getOrCreateChild($id_origine, $label) { - if (!$entry = $this->getLoader()->findFirstBy(['code' => $this->getCode(), - 'id_origine' => substr($id_origine, 0, self::COLUMN_ORIGIN_SIZE)])) { + if (!$entry = $this->getLoader() + ->findFirstBy(['code' => $this->getCode(), + 'id_origine' => mb_substr($id_origine, 0, self::COLUMN_ORIGIN_SIZE, 'UTF-8')])) { $entry = $this ->newChildEntry() ->updateAttributes(['id_origine' => $id_origine, -- GitLab