From 7cf7cc5687ddcfbce41755627731c6cd20891d49 Mon Sep 17 00:00:00 2001
From: Brice Werry <bwerry@open-dsi.fr>
Date: Mon, 10 Feb 2025 14:34:06 +0100
Subject: [PATCH 1/4] =?UTF-8?q?Compatibilit=C3=A9=20V21?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 .easya_info.json | 2 +-
 ChangeLog.md     | 6 +++++-
 VERSION          | 2 +-
 3 files changed, 7 insertions(+), 3 deletions(-)

diff --git a/.easya_info.json b/.easya_info.json
index 23c39c0..694b688 100644
--- a/.easya_info.json
+++ b/.easya_info.json
@@ -1,6 +1,6 @@
 {
     "dlb_min_version": 10,
-    "dlb_max_version": 20,
+    "dlb_max_version": 21,
     "php_min_version": 7.0,
     "php_max_version": 8.2
 }
diff --git a/ChangeLog.md b/ChangeLog.md
index b3af7fc..ce353c5 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,9 @@
 # Changelog
 Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.com/fr/1.0.0/).
 
+## [10.2.5] - 13-02-2025
+- Compatibilité V21
+
 ## [10.2.4] - 12-02-2025
 - Correction compatibility Dolibarr 10
 
@@ -328,7 +331,8 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 
 
 
-[Non Distribué]: http://git.open-dsi.fr/dolibarr-extension/sirene/compare/10.2.4...HEAD
+[Non Distribué]: http://git.open-dsi.fr/dolibarr-extension/sirene/compare/10.2.5...HEAD
+[10.2.5]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.5
 [10.2.4]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.4
 [10.2.3]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.3
 [10.2.2]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.2
diff --git a/VERSION b/VERSION
index 06bcad3..9b36ab7 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.2.4
+10.2.5
-- 
GitLab


From b9b97762b833b855187bd66c66cb22086fb2fcf7 Mon Sep 17 00:00:00 2001
From: uvaldenaire-opendsi <uvaldenaire@easya.solutions>
Date: Wed, 12 Feb 2025 16:12:26 +0100
Subject: [PATCH 2/4] FIX check sirene form

---
 ChangeLog.md                   | 16 ++++++++++------
 VERSION                        |  2 +-
 class/actions_sirene.class.php | 30 ++++++++++++++++--------------
 3 files changed, 27 insertions(+), 21 deletions(-)

diff --git a/ChangeLog.md b/ChangeLog.md
index ce353c5..21c6fc2 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -1,6 +1,9 @@
 # Changelog
 Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.com/fr/1.0.0/).
 
+## [10.2.6] - 13-02-2025
+- Correction remplissage formulaire "Vérification Sirene"
+
 ## [10.2.5] - 13-02-2025
 - Compatibilité V21
 
@@ -59,7 +62,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 
 ## [10.0.76] - 07-06-2024
 - Ajout version php.
-  
+
 ## [10.0.75] - 30-05-2024
 - Changement pour CI.
 
@@ -146,7 +149,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 - Remove duplicates entry from pre-existing table in case a fields has duplicate when creating a unique index
 
 ## [7.0.51] - 24-03-2023
-- Forcer la mise à jour des ids du dictionnaire d'association des pays Sirene avec ceux de Dolibarr 
+- Forcer la mise à jour des ids du dictionnaire d'association des pays Sirene avec ceux de Dolibarr
 
 ## [7.0.50] - 23/03/2023
 - Mise à jour des identifiants du dictionnaire sirene country pour les faire correspondre avec ceux du dictionnaire country de Dolibarr
@@ -219,7 +222,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 - Intégration d'un patch core pour les versions 13.0.0 à 13.0.3.
   Problème de sélecteur lors d'une recherche Sirene avec plusieurs résultats, uniquement le 1er résultat est repris même si on sélectionne un autre résultat.
   Patch : https://github.com/Dolibarr/dolibarr/pull/17701
-  
+
   Problème réglé si vous êtes en version 13.0.4. Les autres branches de Dolibarr ne sont pas concernées par ce problème
 
 ## [7.0.29] - 09-07-2021
@@ -227,7 +230,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 - Désactivation par défaut de la tâche planifiée lors de l'activation du module
 
 ## [7.0.28] - 05-07-2021
-- Correction affichage z-index pour la fenêtre de vérification des tiers 
+- Correction affichage z-index pour la fenêtre de vérification des tiers
 
 ## [7.0.27] - 30-06-2021
 - Données APE récupérées au niveau de l'établissement secondaire plutôt qu'au niveau de l'établissement principal
@@ -236,7 +239,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 - Correction des droits d'accès pour la mise à jour des données d'un tiers provenant de l'API Sirene
 
 ## [7.0.25] - 08-06-2021
-- Correction erreur SQL pour l'accès au dictionnaire des codes Naf 
+- Correction erreur SQL pour l'accès au dictionnaire des codes Naf
 
 ## [7.0.24] - 01-06-2021
 - Affichage et correction du dictionnaire dans la configuration du module
@@ -331,7 +334,8 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 
 
 
-[Non Distribué]: http://git.open-dsi.fr/dolibarr-extension/sirene/compare/10.2.5...HEAD
+[Non Distribué]: http://git.open-dsi.fr/dolibarr-extension/sirene/compare/10.2.6...HEAD
+[10.2.6]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.6
 [10.2.5]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.5
 [10.2.4]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.4
 [10.2.3]: https://git.open-dsi.fr/dolibarr-extension/sirene/commits/10.2.3
diff --git a/VERSION b/VERSION
index 9b36ab7..2f54d0f 100644
--- a/VERSION
+++ b/VERSION
@@ -1 +1 @@
-10.2.5
+10.2.6
\ No newline at end of file
diff --git a/class/actions_sirene.class.php b/class/actions_sirene.class.php
index b3272b7..0f6c608 100755
--- a/class/actions_sirene.class.php
+++ b/class/actions_sirene.class.php
@@ -282,7 +282,7 @@ class ActionsSirene
                 $object->array_options['options_sirene_status'] = 0;
                 $object->array_options['options_sirene_update_date'] = dol_now();
                 $object->array_options['options_sirene_company_admin_status'] = 'A';
-                
+
                 if ($this->updateObjectFields($modified, $object, $user) === -1) {
                     return -1;
                 }
@@ -833,27 +833,27 @@ SCRIPT;
                                 $table_choices .= '<tr class="displaygridonsmartphone">' . "\n";
 
                                 $sireneExName = "ex. " . (empty($object->name) ? (empty($mysoc->name) ? "Association dolibarr" : $mysoc->name) : $object->name);
-                                $table_choices .= '<td><label for="sirene_company_name">' . $langs->trans("SireneCompanyName") . '</label><br><input type="text" id="sirene_company_name" name="sirene_company_name" placeholder="' . $sireneExName . '" value=""></td>' . "\n";
+                                $table_choices .= '<td><label for="sirene_company_name">' . $langs->trans("SireneCompanyName") . '</label><br><input type="text" id="sirene_company_name" name="sirene_company_name" placeholder="' . $sireneExName . '" value="'.$object->name.'"></td>' . "\n";
 
                                 $sireneExSiren = "ex. " . (empty($object->idprof1) ? (empty($mysoc->idprof1) ? "520339938" : str_replace(' ', '', $mysoc->idprof1)) : str_replace(' ', '', $object->idprof1));
                                 $table_choices .= '<td><label for="sirene_siren_siret">' . $langs->trans("SireneSiren") . ' / '.$langs->trans("SireneSiret") . '</label><br><input type="text" id="sirene_siren_siret" name="sirene_siren_siret" placeholder="' . $sireneExSiren . '" value="'.$object->idprof1.'"></td>' . "\n";
 
                                 $sireneExRna = "ex. " . (empty($object->idprof6) ? (empty($mysoc->idprof6) ? "rna" : str_replace(' ', '', $mysoc->idprof6)) : str_replace(' ', '', $object->idprof6));
-                                $table_choices .= '<td><label for="sirene_naf">' . $langs->trans("SireneRna") . ' ' . $form->textwithpicto('', $langs->trans("SireneSearchCodeNafHelp"), 2) . '</label><br><input type="text" id="sirene_rna" name="sirene_rna" placeholder="' . $sireneExRna . '" value=""></td>' . "\n";
+                                $table_choices .= '<td><label for="sirene_naf">' . $langs->trans("SireneRna") . ' ' . $form->textwithpicto('', $langs->trans("SireneSearchCodeNafHelp"), 2) . '</label><br><input type="text" id="sirene_rna" name="sirene_rna" placeholder="' . $sireneExRna . '" value="'.$object->idprof6.'"></td>' . "\n";
 
                                 $sireneExNaf = "ex. " . (empty($object->idprof3) ? (empty($mysoc->idprof3) ? "94.99Z" : substr($mysoc->idprof3, 0, 2) . '.' . substr($mysoc->idprof3, 2, 3)) : substr($object->idprof3, 0, 2) . '.' . substr($object->idprof3, 2, 3));
-                                $table_choices .= '<td><label for="sirene_naf">' . $langs->trans("SireneNaf") . ' ' . $form->textwithpicto('', $langs->trans("SireneSearchCodeNafHelp"), 2) . '</label><br><input type="text" id="sirene_naf" name="sirene_naf" placeholder="' . $sireneExNaf . '" value=""></td>' . "\n";
+                                $table_choices .= '<td><label for="sirene_naf">' . $langs->trans("SireneNaf") . ' ' . $form->textwithpicto('', $langs->trans("SireneSearchCodeNafHelp"), 2) . '</label><br><input type="text" id="sirene_naf" name="sirene_naf" placeholder="' . $sireneExNaf . '" value="'.$object->idprof3.'"></td>' . "\n";
 
                                 $table_choices .= '</tr>' . "\n";
                                 $table_choices .= '<tr class="displaygridonsmartphone" id="second_line_inputs_siren" style="display:none">' . "\n";
-                        
+
                                 $sireneExTown = "ex. " . (empty($object->town) ? (empty($mysoc->town) ? "Lyon" : $mysoc->town) : $object->town);
-                                $table_choices .= '<td colspan="1" class=""><label for="sirene_town_input">' . $langs->trans("SireneTown") . '<br><input type="text" name="sirene_town" id="sirene_town_input" placeholder="' . $sireneExTown . '" value=""></td>' . "\n";
+                                $table_choices .= '<td colspan="1" class=""><label for="sirene_town_input">' . $langs->trans("SireneTown") . '<br><input type="text" name="sirene_town" id="sirene_town_input" placeholder="' . $sireneExTown . '" value="'.$object->town.'"></td>' . "\n";
 
                                 $sireneExZip = "ex. " . (empty($object->zip) ? (empty($mysoc->zip) ? "45160" : $mysoc->zip) : $object->zip);
-                                $table_choices .= '<td colspan="5" class=""><label for="sirene_zipcode_input">' . $langs->trans("CompanyZip") . '<br><input type="text" name="sirene_zipcode" id="sirene_zipcode_input" placeholder="' . $sireneExZip . '" value=""></td>' . "\n";
-                         
-                                $table_choices .= '</tr>' . "\n";		
+                                $table_choices .= '<td colspan="5" class=""><label for="sirene_zipcode_input">' . $langs->trans("CompanyZip") . '<br><input type="text" name="sirene_zipcode" id="sirene_zipcode_input" placeholder="' . $sireneExZip . '" value="'.$object->zip.'"></td>' . "\n";
+
+                                $table_choices .= '</tr>' . "\n";
                                 $script_js_to_display_hidden_inputs = dol_buildpath('/sirene/js/display_hidden_inputs.js', 1);
 
                                 $table_choices .=  '<script src="'.$script_js_to_display_hidden_inputs.'"></script>';
@@ -964,13 +964,15 @@ SCRIPT;
                 }
             }
         }
+
+        return 0;
     }
 
 
     /**
-     *   @param array $company_infos
-    *	@param bool $checked if the radio input is checked
-    *	@return string $table_row. A table row with company infos
+     * @param array $company_infos
+     * @param bool $checked if the radio input is checked
+     * @return string $table_row. A table row with company infos
      */
     private function makeTableRowCompany($company_infos, $checked)
     {
@@ -1161,10 +1163,10 @@ SCRIPT;
      */
     private function calculateIntraCommunityVat(int $siren): int
     {
-            return 12 + 3 * ($siren % 97) % 97;
+        return 12 + 3 * ($siren % 97) % 97;
     }
 
-        /**
+    /**
      * @param bool $modified
      * @param CommonObject $object The object to update
      * @param $user User that updates the object
-- 
GitLab


From b4fd8327fb36f88abe5b282e89244b6cb533e2b3 Mon Sep 17 00:00:00 2001
From: Florian HENRY <florian.henry@open-concept.pro>
Date: Mon, 17 Feb 2025 17:16:49 +0100
Subject: [PATCH 3/4] FIX:PostGresQL Comptability for int(11)

---
 core/dictionaries/sirene.dictionary.php | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/core/dictionaries/sirene.dictionary.php b/core/dictionaries/sirene.dictionary.php
index 1cb24a9..b1cb4dd 100755
--- a/core/dictionaries/sirene.dictionary.php
+++ b/core/dictionaries/sirene.dictionary.php
@@ -134,8 +134,7 @@ class sireneDictionary extends Dictionary
             'type'       => 'int',
             'is_require' => true,
             'database'   => array(
-                'type'   => 'int',
-                'length' => 11,
+                'type'   => 'integer',
             ),
         ),
         'country_code'     => array(
-- 
GitLab


From 0a979d749c7d047ee269b147da9073c00438e96f Mon Sep 17 00:00:00 2001
From: tnegre <tnegre@open-dsi.fr>
Date: Fri, 21 Feb 2025 10:37:10 +0100
Subject: [PATCH 4/4] Update Changelog

---
 ChangeLog.md | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ChangeLog.md b/ChangeLog.md
index 21c6fc2..57c0e32 100755
--- a/ChangeLog.md
+++ b/ChangeLog.md
@@ -3,6 +3,7 @@ Le format du fichier est basé sur [Tenez un ChangeLog](http://keepachangelog.co
 
 ## [10.2.6] - 13-02-2025
 - Correction remplissage formulaire "Vérification Sirene"
+- Compatibilité postgreSQL sur le dictionnaire 'sirene'
 
 ## [10.2.5] - 13-02-2025
 - Compatibilité V21
-- 
GitLab