From 054cee0e0689b002893a6e0781c3b4612811ff54 Mon Sep 17 00:00:00 2001 From: Manus Date: Fri, 5 Jun 2026 09:56:12 -0400 Subject: [PATCH] =?UTF-8?q?fix:=20lignes=20FreePro=20sans=20structure=20af?= =?UTF-8?q?fect=C3=A9es=20=C3=A0=203069UDA=20(au=20lieu=20de=20vide)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/freeproService.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/freeproService.ts b/server/freeproService.ts index 9de73b1..421175f 100644 --- a/server/freeproService.ts +++ b/server/freeproService.ts @@ -129,23 +129,25 @@ export function processFreeproExcel( const description = String(row.description || ""); const labelClient = String(row.label_client || ""); - const structure = row.structure ? String(row.structure) : null; + // Les lignes sans structure sont affectées à 3069UDA par convention + const structureRaw = row.structure ? String(row.structure).trim() : ""; + const structure = structureRaw !== "" ? structureRaw : "3069UDA"; const totalHt = parseFloat(String(row.total || "0").replace(",", ".")) || 0; const script = getScript(description); const ttc = getTtc(totalHt); const type = getType(labelClient, script); - const key = `${structure ?? ""}|||${type}`; + const key = `${structure}|||${type}`; aggregation.set(key, (aggregation.get(key) || 0) + Math.round(ttc * 100)); } // Construire les lignes de résultat const lines: FreeproVentilationResult["lines"] = []; for (const [key, centimes] of Array.from(aggregation.entries())) { - const [structureRaw, type] = key.split("|||"); + const [structureVal, type] = key.split("|||"); lines.push({ - structure: structureRaw === "" ? null : structureRaw, + structure: structureVal || null, type, montant: centimes / 100, });