diff --git a/VERSIONS_HOTLINE/129860 b/VERSIONS_HOTLINE/129860
new file mode 100644
index 0000000000000000000000000000000000000000..36ef33e31379d9c35f3d852ddaa8b1247f7ed72e
--- /dev/null
+++ b/VERSIONS_HOTLINE/129860
@@ -0,0 +1 @@
+ - ticket #129860 : Intégrations : Les paniers vides non utilisés dans les domaines sont maintenant supprimés lors d'un import total de panier.
\ No newline at end of file
diff --git a/library/Class/Cosmogramme/Integration/PhasePanier.php b/library/Class/Cosmogramme/Integration/PhasePanier.php
index a9b9358f49155f07c2d2434cde1161ab87fce9a7..983ecc0b0eaef45c6ca5555dca5e1a621352097a 100644
--- a/library/Class/Cosmogramme/Integration/PhasePanier.php
+++ b/library/Class/Cosmogramme/Integration/PhasePanier.php
@@ -163,12 +163,31 @@ class Class_Cosmogramme_Integration_PhasePanier
 
 
   protected function _clean($integration) {
-    $baskets = Class_PanierNotice::findAllBy(['integration_hash' => $integration->getHash()]);
+    $this->_cleanOldCarts($integration);
+
+    $baskets = Class_PanierNotice::findAllBy(['id_int_bib' => $integration->getIdBib()]);
     foreach($baskets as $basket)
       $basket->setNotices('')->save();
   }
 
 
+  protected function _cleanOldCarts($integration) {
+    if (0 === count($all_integration = Class_IntBib::findAll()))
+      return;
+
+    $id_bib = $integration->getIdBib();
+
+    $id_bibs = array_map(function($integration)
+                         {
+                           return $integration->getIdBib();
+                         }, $all_integration);
+
+    foreach ( Class_PanierNotice::findAllBy(['id_sigb not' => [null, '', 0],
+                                             'id_int_bib not' => $id_bibs]) as $old_cart)
+      $old_cart->setIdIntBib($id_bib)->save();
+  }
+
+
   protected function _shouldIgnoreLine($line, $integration) {
     return $line->withDataDo([$this, 'isHeader']);
   }
diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
index 9ce502309cdddc424e014e8a290577edd05fa77b..e737b9d05b6cec6796cca22f99eec93287ef2e6e 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhasePanierTest.php
@@ -51,12 +51,11 @@ abstract class PhasePanierTestCase extends Class_Cosmogramme_Integration_PhaseTe
                     'fichier' => 'baskets.txt',
                     'nom_fichier' => 'baskets.txt',
                     'pointeur_reprise' => 0]);
-  }
+ }
 
 
   public function setUp() {
     parent::setUp();
-
     $this->_phase = $this->_buildPhase('Panier')
                          ->setMemoryCleaner(function() {})
                          ->setPrinter($this->_printer)
@@ -219,8 +218,8 @@ class PhasePanierKohaSameIdOrigineTest extends PhasePanierKohaTestCase {
 
 
   /** @test */
-  public function firstBasketRecordsShouldContainsCOKEENSTOCKCASTAFIORELUNE() {
-    $this->assertEquals('COKEENSTOCK;CASTAFIORE;LUNE',
+  public function firstBasketRecordsShouldContainsCASTAFIORELUNE() {
+    $this->assertEquals('CASTAFIORE;LUNE',
                         Class_PanierNotice::find(1)->getNotices());
   }
 }
@@ -277,7 +276,7 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
 
   /** @test */
   public function numberOfBasketsShouldBeEight() {
-    $this->assertCount(9, Class_PanierNotice::findAll());
+    $this->assertCount(8, Class_PanierNotice::findAll());
   }
 
 
@@ -312,8 +311,8 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
 
 
   /** @test */
-  public function thirdBasketShouldNotBeModified() {
-    $this->assertEquals(['VOL714'], Class_PanierNotice::find(3)->getClesNotices());
+  public function thirdBasketShouldBeDeleted() {
+    $this->assertNull( Class_PanierNotice::find(3));
   }
 
 
@@ -331,9 +330,8 @@ class PhasePanierFullImportTest extends PhasePanierKohaTestCase {
 
 
   /** @test */
-  public function firstBasketRecordsShouldContains3items() {
-    $this->assertEquals(['COKEENSTOCK',
-                         'CASTAFIORE',
+  public function firstBasketRecordsShouldContains2items() {
+    $this->assertEquals(['CASTAFIORE',
                          'LUNE'],
                         Class_PanierNotice::find(1)->getClesNotices());
   }
@@ -542,3 +540,129 @@ class PhasePanierNanookTest extends PhasePanierTestCase {
     $this->assertEquals(2, $this->_basket->getIdIntBib());
   }
 }
+
+
+
+
+class PhasePanierWithOldCartAndUserCartInDbTests extends PhasePanierTestCase {
+  public function _prepareFixtures() {
+    parent::_prepareFixtures();
+
+    $this->fixture('Class_Users',
+                   ['id' => 1,
+                    'login' => 'milou_pro',
+                    'password' => 'secret',
+                    'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL,
+                    'idabon' => '0006',
+                    'mail' => 'milou@herge.fr']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 78,
+                    'id_sigb' => 898,
+                    'id_int_bib' => 897,
+                    'libelle' => 'ciné',
+                    'notices' => 'COKEENSTOCK']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 23423423,
+                    'id_sigb' => null,
+                    'id_int_bib' => null,
+                    'libelle' => 'mes préférés',
+                    'notices' => '']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 782374,
+                    'id_sigb' => 0,
+                    'id_int_bib' => 0,
+                    'libelle' => 'mes favoris',
+                    'notices' => '']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 12131231,
+                    'id_sigb' => '',
+                    'id_int_bib' => '',
+                    'libelle' => 'à lire',
+                    'notices' => '']);
+  }
+
+
+  /** @test */
+  public function cartCinéShouldBeDeleted() {
+    Class_PanierNotice::clearCache();
+    $this->assertNull(Class_PanierNotice::find(78));
+  }
+
+
+  /** @test */
+  public function cartMesPréféresShouldExists() {
+    $this->assertNotNull(Class_PanierNotice::find(23423423));
+  }
+
+
+  /** @test */
+  public function cartMesfavorisShouldExists() {
+    $this->assertNotNull(Class_PanierNotice::find(782374));
+  }
+
+
+  /** @test */
+  public function cartAlireShouldExists() {
+    $this->assertNotNull(Class_PanierNotice::find(12131231));
+  }
+}
+
+
+
+
+class PhasePanierWithMultipleIntegrationLibraryAndOldCartAndUserCartInDbTests extends PhasePanierTestCase {
+  public function _prepareFixtures() {
+    parent::_prepareFixtures();
+
+    $this->fixture('Class_IntBib',
+                   ['id' => 3,
+                    'nom_court' => 'Annexe 3',
+                    'sigb' => 14]);
+
+    $this->fixture('Class_Users',
+                   ['id' => 1,
+                    'login' => 'milou_pro',
+                    'password' => 'secret',
+                    'role_level' => ZendAfi_Acl_AdminControllerRoles::MODO_PORTAIL,
+                    'idabon' => '0006',
+                    'mail' => 'milou@herge.fr']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 78,
+                    'id_sigb' => 898,
+                    'id_int_bib' => 897,
+                    'libelle' => 'ciné',
+                    'notices' => 'COKEENSTOCK']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 23423423,
+                    'id_sigb' => 123,
+                    'id_int_bib' => 3,
+                    'libelle' => 'mes préférés',
+                    'notices' => '']);
+
+    $this->fixture('Class_PanierNotice',
+                   ['id' => 782374,
+                    'id_sigb' => 125,
+                    'id_int_bib' => 2,
+                    'libelle' => 'mes favoris',
+                    'notices' => '']);
+  }
+
+
+  /** @test */
+  public function cartCinéShouldBeDeleted() {
+    Class_PanierNotice::clearCache();
+    $this->assertNull(Class_PanierNotice::find(78));
+  }
+
+
+  /** @test */
+  public function cartMesPréféresShouldExists() {
+    $this->assertNotNull(Class_PanierNotice::find(23423423));
+  }
+}
\ No newline at end of file
diff --git a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php
index d15d2746c3c1ec2ef661daf4c420293e36710cd3..1242b7c831988b7ff6b67315cc37638da1202470 100644
--- a/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php
+++ b/tests/library/Class/Cosmogramme/Integration/PhasePrepareIntegrationsTest.php
@@ -230,7 +230,7 @@ abstract class PhasePrepareIntegrationsWithOAITestCase
                                         'taille_min_import_total' => 10]);
 
 
-    $this->fixture('Class_Cosmogramme_Integration',
+    $this->fixture(Class_Cosmogramme_Integration::class,
                    ['id' => 1,
                     'id_bib' => 2,
                     'type_operation' => Class_Cosmogramme_Integration::TYPE_OPERATION_TOTAL,
@@ -238,6 +238,13 @@ abstract class PhasePrepareIntegrationsWithOAITestCase
                     'traite' => 'oui',
                     'fichier' =>  'http://oai-repository.fr/oai',
                     'pointeur_reprise' => 'SCD01@000195008000000979marc21-18]']);
+
+    $this->fixture(Class_Cosmogramme_Integration::class,
+                   ['id' => 2,
+                    'id_bib' => 2,
+                    'type_operation' => Class_Cosmogramme_Integration::TYPE_OPERATION_TOTAL,
+                    'profil' => 113,
+                    'traite' => 'oui']);
   }
 
 
@@ -261,8 +268,8 @@ class PhasePrepareIntegrationsWithOAITest extends PhasePrepareIntegrationsWithOA
 
 
   /** @test */
-  public function fiveIntegrationsShouldHaveBeenCreated() {
-    $this->assertEquals(5, count(Class_Cosmogramme_Integration::findAll()));
+  public function sixIntegrationsShouldHaveBeenCreated() {
+    $this->assertEquals(6, count(Class_Cosmogramme_Integration::findAll()));
   }
 
 
@@ -275,28 +282,28 @@ class PhasePrepareIntegrationsWithOAITest extends PhasePrepareIntegrationsWithOA
 
   /** @test */
   public function secondIntegrationShouldBeIncremental() {
-    $this->assertTrue(Class_Cosmogramme_Integration::find(3)->isIncrement());
+    $this->assertTrue(Class_Cosmogramme_Integration::find(4)->isIncrement());
   }
 
 
   /** @test */
   public function secondIntegrationFileShouldContainsDate() {
     $this->assertContains('[DATE]',
-                          Class_Cosmogramme_Integration::find(3)->getNomFichier());
+                          Class_Cosmogramme_Integration::find(4)->getNomFichier());
   }
 
 
   /** @test */
   public function thirdIntegrationURIShouldBeOAIRepository() {
     $this->assertEquals('http://oai-repository.fr/oai',
-                        Class_Cosmogramme_Integration::find(5)->getFichier());
+                        Class_Cosmogramme_Integration::find(6)->getFichier());
   }
 
 
   /** @test */
   public function thirdIntegrationTransfertDateShouldBeBar() {
     $this->assertEquals('2015-03-26',
-                        Class_Cosmogramme_Integration::find(4)->getDateTransfert());
+                        Class_Cosmogramme_Integration::find(5)->getDateTransfert());
   }