From 69db5e2d913f0d4271de795e673499e883f163a6 Mon Sep 17 00:00:00 2001
From: Henri-Damien LAURENT <hdlaurent@afi-sa.net>
Date: Mon, 10 Feb 2025 11:56:07 +0100
Subject: [PATCH] hotline#218307 : CVS2 : Importing records failure fixed

---
 VERSIONS_HOTLINE/218307                                       | 1 +
 library/digital_resources/Cvs2/Service/Parser/Catalogue.php   | 4 ++--
 library/digital_resources/Cvs2/tests/Cvs2Test.php             | 2 +-
 .../digital_resources/Cvs2/tests/catalogue_tout_page_3.xml    | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
 create mode 100644 VERSIONS_HOTLINE/218307

diff --git a/VERSIONS_HOTLINE/218307 b/VERSIONS_HOTLINE/218307
new file mode 100644
index 00000000000..dce3219eb68
--- /dev/null
+++ b/VERSIONS_HOTLINE/218307
@@ -0,0 +1 @@
+ - correctif #218307 : Connecteur Cvs : Correction d'une erreur au moissonage
\ No newline at end of file
diff --git a/library/digital_resources/Cvs2/Service/Parser/Catalogue.php b/library/digital_resources/Cvs2/Service/Parser/Catalogue.php
index 8dd27c9eb4a..efa1c31b57c 100644
--- a/library/digital_resources/Cvs2/Service/Parser/Catalogue.php
+++ b/library/digital_resources/Cvs2/Service/Parser/Catalogue.php
@@ -177,8 +177,8 @@ class Cvs2_Service_Parser_Catalogue extends Cvs2_Service_Parser_Abstract  {
   }
 
 
-  public function endTotalalbums(int $data) :self {
-    $this->_total_ressources = $data;
+  public function endTotalalbums(string $data) :self {
+    $this->_total_ressources = (int) $data;
     return $this;
   }
 
diff --git a/library/digital_resources/Cvs2/tests/Cvs2Test.php b/library/digital_resources/Cvs2/tests/Cvs2Test.php
index f6b951b36d9..a4b175ab320 100644
--- a/library/digital_resources/Cvs2/tests/Cvs2Test.php
+++ b/library/digital_resources/Cvs2/tests/Cvs2Test.php
@@ -599,7 +599,7 @@ class Cvs2HarvesterTest extends Cvs2ActivatedTestCase
 
   protected function _setXmlContent()
   {
-    $this->_xml_content = file_get_contents(__DIR__ . '/catalogue_tout_page_1.xml');
+    $this->_xml_content = file_get_contents(__DIR__ . '/catalogue_tout_page_3.xml');
   }
 
 
diff --git a/library/digital_resources/Cvs2/tests/catalogue_tout_page_3.xml b/library/digital_resources/Cvs2/tests/catalogue_tout_page_3.xml
index 72ef1b4a398..7873a3454d0 100644
--- a/library/digital_resources/Cvs2/tests/catalogue_tout_page_3.xml
+++ b/library/digital_resources/Cvs2/tests/catalogue_tout_page_3.xml
@@ -15,7 +15,7 @@
     <albumsmin>100</albumsmin>
     <albumsmax>200</albumsmax>
     <albumspagesize>100</albumspagesize>
-    <totalalbums>29449</totalalbums>
+    <totalalbums></totalalbums>
     <albums>
       <album>
         <pilier>4</pilier>
-- 
GitLab