mirror of
https://github.com/R0m1k3/LogiFlow.git
synced 2026-10-11 17:27:31 +02:00
Merge pull request #457 from R0m1k3/1.1
Improve reconciliation filtering and remove debugging logs
This commit is contained in:
3 files changed
+14
-37
No files matched your search
@@ -15,6 +15,10 @@ run = ["npm", "run", "start"]
|
||||
localPort = 5000
|
||||
externalPort = 80
|
||||
|
||||
[[ports]]
|
||||
localPort = 37321
|
||||
externalPort = 3003
|
||||
|
||||
[[ports]]
|
||||
localPort = 38343
|
||||
externalPort = 3000
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 406 KiB |
@@ -628,24 +628,8 @@ export default function BLReconciliation() {
|
||||
|
||||
// Filtrage des livraisons par recherche et statut de validation
|
||||
const filterDeliveries = (deliveries: any[]) => {
|
||||
// Debug temporaire pour identifier le problème
|
||||
if (deliveries.length > 0 && filterStatus !== "all") {
|
||||
console.log('🔍 DEBUG Filtre:', {
|
||||
filterStatus,
|
||||
totalDeliveries: deliveries.length,
|
||||
exemples: deliveries.slice(0, 3).map(d => ({
|
||||
id: d.id,
|
||||
reconciled: d.reconciled,
|
||||
type: typeof d.reconciled,
|
||||
rawValue: JSON.stringify(d.reconciled),
|
||||
supplier: d.supplier?.name
|
||||
}))
|
||||
});
|
||||
}
|
||||
|
||||
return deliveries.filter((delivery: any) => {
|
||||
// Conversion sûre de reconciled - gestion de tous les cas possibles
|
||||
// PostgreSQL peut retourner : true/false, 1/0, "t"/"f", "true"/"false", null, undefined
|
||||
const isReconciled =
|
||||
delivery.reconciled === true ||
|
||||
delivery.reconciled === 1 ||
|
||||
@@ -653,31 +637,20 @@ export default function BLReconciliation() {
|
||||
delivery.reconciled === "true" ||
|
||||
(typeof delivery.reconciled === 'string' && delivery.reconciled.toLowerCase() === 'true');
|
||||
|
||||
// Filtre par statut validé - avec debug pour chaque élément filtré
|
||||
// Vérifier aussi si une facture a été trouvée ET validée automatiquement
|
||||
// (certaines livraisons ont une coche verte mais reconciled = false)
|
||||
const hasVerifiedInvoice = verificationResults[delivery.id]?.exists === true;
|
||||
const isValidated = isReconciled || (hasVerifiedInvoice && verificationResults[delivery.id]?.reconciled === true);
|
||||
|
||||
// Filtre par statut validé
|
||||
if (filterStatus === "validated") {
|
||||
const keep = isReconciled;
|
||||
if (!keep && delivery.blNumber) {
|
||||
console.log(`❌ Filtré (non validé):`, {
|
||||
id: delivery.id,
|
||||
bl: delivery.blNumber,
|
||||
reconciled: delivery.reconciled,
|
||||
isReconciled
|
||||
});
|
||||
}
|
||||
return keep;
|
||||
// Afficher seulement les livraisons vraiment validées (reconciled = true)
|
||||
return isReconciled;
|
||||
}
|
||||
|
||||
if (filterStatus === "not_validated") {
|
||||
const keep = !isReconciled;
|
||||
if (!keep && delivery.blNumber) {
|
||||
console.log(`❌ Filtré (validé):`, {
|
||||
id: delivery.id,
|
||||
bl: delivery.blNumber,
|
||||
reconciled: delivery.reconciled,
|
||||
isReconciled
|
||||
});
|
||||
}
|
||||
return keep;
|
||||
// Afficher seulement les livraisons non validées (reconciled = false)
|
||||
return !isReconciled;
|
||||
}
|
||||
|
||||
// Filtre par recherche
|
||||
|
||||
Reference in new issue
Block a user