diff --git a/VERSIONS_HOTLINE/65042 b/VERSIONS_HOTLINE/65042 new file mode 100644 index 0000000000000000000000000000000000000000..6a569f5b37e961af4b62201155fc11b1632aa96d --- /dev/null +++ b/VERSIONS_HOTLINE/65042 @@ -0,0 +1 @@ + - ticket #65042 : Cosmogramme avec SIGB Nanook : Correction de la régénération des intégrations à partir de l'étalon \ No newline at end of file diff --git a/library/Class/Cosmogramme/Generator.php b/library/Class/Cosmogramme/Generator.php index a90906123e2ec9afdf9527f18c573f7724653029..4f2e291ba8f20ac377c38b290179572e3a01178d 100644 --- a/library/Class/Cosmogramme/Generator.php +++ b/library/Class/Cosmogramme/Generator.php @@ -164,24 +164,18 @@ class Class_Cosmogramme_Generator { 'visibilite' => Class_Bib::V_DATA]) ->save(); - if (!$int_bib = Class_IntBib::findFirstBy(['id_bib' => $bib->getIdSite()])) - $int_bib = Class_IntBib::newInstance(['id_bib' => $bib->getIdSite()]); + if (!$int_bib = Class_IntBib::findFirstBy(['id_bib' => $bib->getIdSite()])) { + $int_bib = Class_IntBib::newInstance(['id_bib' => $bib->getIdSite(), + 'qualite' => 5, + 'sigb' => $this->_params['type_sigb'], + 'planif_mode' => 'r', + 'planif_jours' => '1111111']); + } $int_bib->updateAttributes(['nom' => $bib->getLibelle(), - 'nom_court' => $bib->getLibelle(), - 'qualite' => 5, - 'sigb' => $this->_params['type_sigb'], - 'planif_mode' => 'r', - 'planif_jours' => '1111111', - 'comm_sigb' => Class_IntBib::COM_PERGAME, - 'comm_params' => serialize(['Autoriser_docs_disponibles' => '0', - 'Max_par_carte' => '3', - 'Max_par_document' => '3'])]); + 'nom_court' => $bib->getLibelle()]); - if ($this->isNanook()) - $int_bib - ->setCommSigb(Class_IntBib::COM_NANOOK) - ->setCommParams(serialize(['url_serveur' => $this->_params['service_nanook']])); + $this->_generateNewLibrary($int_bib); $int_bib->save(); @@ -189,6 +183,24 @@ class Class_Cosmogramme_Generator { } + protected function _generateNewLibrary($int_bib) + { + if (!$int_bib->isNew()) + return $int_bib; + + if ($int_bib->isNanook()) + return $int_bib + ->setCommSigb(Class_IntBib::COM_NANOOK) + ->setCommParams(serialize(['url_serveur' => $this->_params['service_nanook']])); + + return $int_bib + ->setCommSigb(Class_IntBib::COM_PERGAME) + ->setCommParams(serialize(['Autoriser_docs_disponibles' => '0', + 'Max_par_carte' => '3', + 'Max_par_document' => '3'])); + } + + protected function _generateLibrariesBranches($libraries) { if ('1' != $this->_params['creer_annexes']) { $this->logTitle($this->_('2 - Création des annexes')); diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php index b8a24d4f2d621f541f39f5c8cf23b111762eec73..fa3ed6aaea84df398803f04bda3c08f9a13b9957 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php @@ -475,7 +475,8 @@ class PhasePrepareIntegrationsNanookStandardTest $this->fixture('Class_IntBib', ['id' => 2, 'nom_court' => 'My library', - 'sigb' => Class_IntBib::SIGB_NANOOK]); + 'sigb' => Class_IntBib::SIGB_NANOOK, + 'comm_params' => serialize(['provide_suggest' => 1])]); $this->fixture('Class_Cosmogramme_Generator_FixedIdBib', ['id' => 2, @@ -602,6 +603,12 @@ class PhasePrepareIntegrationsNanookStandardTest } + /** @test */ + public function updatedLibraryShouldKeepCommParams() { + $this->assertEquals(1, Class_IntBib::find(2)->getCommParamsAsArray()['provide_suggest']); + } + + /** @test */ public function updatedLibraryRunQueueShouldNotBeLost() { $this->assertNotEmpty(Class_IntBib::find(2)->getIntegrations());