diff --git a/VERSIONS_HOTLINE/103756 b/VERSIONS_HOTLINE/103756 new file mode 100644 index 0000000000000000000000000000000000000000..ea0d5efd0c93d4ffe4a5602f01aecef81088a8be --- /dev/null +++ b/VERSIONS_HOTLINE/103756 @@ -0,0 +1 @@ + - ticket #103756 : Intégrations : Correction d'une erreur pouvant survenir lors de l'import des paniers \ No newline at end of file diff --git a/library/Class/Cosmogramme/Integration/PhasePanier.php b/library/Class/Cosmogramme/Integration/PhasePanier.php index 79ced34fbc04229d5c6f429edd958ea7e6a524ca..7aaf7cf74cfaa76d9e383d6756b81e7eb5857ff0 100644 --- a/library/Class/Cosmogramme/Integration/PhasePanier.php +++ b/library/Class/Cosmogramme/Integration/PhasePanier.php @@ -177,9 +177,12 @@ class Class_Cosmogramme_Integration_PhasePanier protected function _afterFileProcessed($integration) { - Class_PanierNotice::deleteBy(['notices' => '', - 'id_int_bib' => $integration->getIdBib(), - 'id not' => Class_PanierNotice::findAllIdsWithCatalogue() - ]); + $params = ['notices' => '', + 'id_int_bib' => $integration->getIdBib()]; + + if ($linked_to_domain = Class_PanierNotice::findAllIdsWithCatalogue()) + $params['id not'] = $linked_to_domain; + + Class_PanierNotice::deleteBy($params); } } diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php index 049de9b90d7030c9c69572d47d96da79fa692a1d..9ce502309cdddc424e014e8a290577edd05fa77b 100644 --- a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php +++ b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php @@ -228,6 +228,34 @@ class PhasePanierKohaSameIdOrigineTest extends PhasePanierKohaTestCase { +class PhasePanierFullImportWithoutLinkedToDomainTest extends PhasePanierKohaTestCase { + protected $_wrapper; + + public function _prepareFixtures() { + parent::_prepareFixtures(); + Class_PanierNotice::find(5)->delete(); + + $this->onLoaderOfModel('Class_PanierNotice'); + Class_Cosmogramme_Integration::find(999)->beTotalImport()->save(); + } + + + /** @test */ + public function noLinkedToDomainShouldExists() { + $this->assertEquals([], Class_PanierNotice::findAllIdsWithCatalogue()); + } + + + /** @test */ + public function panierDeleteByShouldNotContainsIdParam() { + $this->assertNotContains('id not', + array_keys(Class_PanierNotice::getFirstAttributeForLastCallOn('deleteBy'))); + } +} + + + + class PhasePanierFullImportTest extends PhasePanierKohaTestCase { public function _prepareFixtures() { parent::_prepareFixtures();