From 71f490fd6b109ea6a3e92fe4c45593fb58585c79 Mon Sep 17 00:00:00 2001 From: Laurent Laffont <llaffont@afi-sa.fr> Date: Tue, 20 Sep 2022 13:36:35 +0000 Subject: [PATCH] fix #155235 Reindex record create AND update --- VERSIONS_WIP/155235 | 1 + cosmogramme/php/classes/classe_notice_integration.php | 5 ++--- .../tests/php/classes/KohaRecordIntegrationTest.php | 11 +++++++++++ 3 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 VERSIONS_WIP/155235 diff --git a/VERSIONS_WIP/155235 b/VERSIONS_WIP/155235 new file mode 100644 index 00000000000..978c56dc12d --- /dev/null +++ b/VERSIONS_WIP/155235 @@ -0,0 +1 @@ + - correctif #155235 : correction de l'indexation des libellés des facettes dynamiques lors de la mise à jour d'une notice \ No newline at end of file diff --git a/cosmogramme/php/classes/classe_notice_integration.php b/cosmogramme/php/classes/classe_notice_integration.php index 26fde2d3fa0..37833f16466 100644 --- a/cosmogramme/php/classes/classe_notice_integration.php +++ b/cosmogramme/php/classes/classe_notice_integration.php @@ -716,9 +716,8 @@ class notice_integration { protected function _realUpdate($record) { $this->traiteFacettes($record->getId()); - $record - ->updateAttributes($this->noticeToDBEnreg()) - ->save(); + $record->updateAttributes($this->noticeToDBEnreg()); + (new Class_Notice_Indexation($record))->indexAndSave(); return $record->getId(); } diff --git a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php index 45f1ba9f681..3725d1f83af 100644 --- a/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php +++ b/cosmogramme/tests/php/classes/KohaRecordIntegrationTest.php @@ -477,6 +477,17 @@ class KohaRecordIntegrationVagabondWithThesaurusOn702DollarATest extends KohaRec $this->assertEquals('PARIS PARI HAUTH_YOSHIKAWA HAUTH_LALLOZ HAUTH_MARCEL', Class_Notice::find(1)->getOtherTerms()); } + + + /** @test */ + public function onUpdateExistingRecordShouldUpdateOtherTermsToo() { + Class_Notice::find(1) + ->setOtherTerms('AN OLD ONE') + ->assertSave(); + $this->loadNotice('unimarc_vagabond'); + $this->assertEquals('PARIS PARI HAUTH_YOSHIKAWA HAUTH_LALLOZ HAUTH_MARCEL', + Class_Notice::find(1)->getOtherTerms()); + } } -- GitLab