diff --git a/api-platform/api/src/DataFixtures/AppFixtures.php b/api-platform/api/src/DataFixtures/AppFixtures.php index 1cbb2c272696c06f466f876020c87ad39ee72657..96e5733ee31f379e4d45588f65cbb69be1775865 100644 --- a/api-platform/api/src/DataFixtures/AppFixtures.php +++ b/api-platform/api/src/DataFixtures/AppFixtures.php @@ -210,6 +210,8 @@ class AppFixtures extends Fixture $tauxCFE = floatval(self::decoderExcelHex($data[$tauxCFECol - 1] ?? '')); $volCFE = floatval(self::decoderExcelHex($data[$volCFECol - 1] ?? '')); + $comNum = $comNum * 1000 + $depNum; + $args = [ $annee, $depNum, $depNom, $regNom, $comNum, $comNom, $tauxTFPNB, $volTFPNB, $tauxTFPB, $volTFPB, $tauxTH, $volTH, $tauxCFE, $volCFE @@ -217,9 +219,9 @@ class AppFixtures extends Fixture $departement = $departements[$depNum] ?? null; $commune = $communes[$comNum] ?? null; + $region = $regions[$regNom] ?? null; if(is_null($departement)) { - $region = $regions[$regNom] ?? null; if(is_null($region)) { $region = new Region(); @@ -246,19 +248,11 @@ class AppFixtures extends Fixture $commune->setDepartement($departement); $manager->persist($commune); - $manager->flush(); $communes[$comNum] = $commune; } $lineUseful = false; - if(in_array(null, [ - $typeTFPNB->getId(), - $typeTFPB->getId(), - $typeTH->getId(), - $typeCFE->getId(), - ])) { - } if($tauxTFPNB > 0 && $volTFPNB > 0) { $taxeTFPNB = new Taxe(); @@ -324,7 +318,7 @@ class AppFixtures extends Fixture private static function decoderExcelHex($chaine) { // Le regex cherche le motif : _x suivi de 4 caractères hexadécimaux (0-9, A-F), suivi de _ - return trim(preg_replace_callback( + return trim(mb_convert_encoding(preg_replace_callback( '/_x([0-9A-Fa-f]{4})_/', function ($matches) { // $matches[1] contient le code hexadécimal (ex: "0020") @@ -333,6 +327,6 @@ class AppFixtures extends Fixture return mb_chr(hexdec($matches[1])); }, $chaine - )); + ), 'UTF-8', 'Windows-1252')); } } diff --git a/api-platform/api/src/Entity/Taxe.php b/api-platform/api/src/Entity/Taxe.php index d402c2aa783d7e8ff3eaa26fa47b416d179c2dd4..3653e67618ecd356febcf170d6fb9d8e54c0777c 100644 --- a/api-platform/api/src/Entity/Taxe.php +++ b/api-platform/api/src/Entity/Taxe.php @@ -18,6 +18,7 @@ use Doctrine\ORM\Mapping as ORM; new GetCollection() ], paginationClientEnabled: true, + paginationClientItemsPerPage: true, )] #[ApiFilter(SearchFilter::class, properties: [ 'type' => 'exact', @@ -33,7 +34,7 @@ class Taxe #[ORM\Column] private ?int $id = null; - #[ORM\ManyToOne()] + #[ORM\ManyToOne(cascade: ['persist'])] #[ORM\JoinColumn(nullable: false)] private ?Commune $commune = null; diff --git a/front/src/pages/Dashboard.tsx b/front/src/pages/Dashboard.tsx index 793b7856768204c00cd491250061e6c37f750b13..33a7a3ce9238d01816aac9da5391975e07b659d5 100644 --- a/front/src/pages/Dashboard.tsx +++ b/front/src/pages/Dashboard.tsx @@ -120,9 +120,10 @@ export default function DashboardPage() { const query = new URLSearchParams({ annee: String(scYear), - "commune.departement": `/api/departements/${scDeptId}`, + "commune.departement": `${scDeptId}`, "type.code": typeObj.code, - pagination: "false", + pagination: "true", + itemsPerPage: "535955", }); const fetchData = async () => {