Improve the reliability of the task management system by fixing errors

Update database schema to allow nullable fields for invoice reference and amount, adjust React components for safe access to optional data, and remove obsolete client-side debugging scripts.

Replit-Commit-Author: Agent
Replit-Commit-Session-Id: 9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869
Replit-Commit-Checkpoint-Type: intermediate_checkpoint
Replit-Commit-Screenshot-Url: https://storage.googleapis.com/screenshot-production-us-central1/1957c339-2757-4d1f-8e92-e9f71a1ce58e/9fcf4b21-eb0c-4e53-a567-e2ce4a6ad869/mpVybiP
This commit is contained in:
michaelschal committed 2025-09-08 15:09:07 +00:00
1 parent 083dca5e71
commit 8baf071c17
4 files changed
+13 -704

No files matched your search

+11 -11
View File
@@ -159,14 +159,14 @@ export default function Avoirs() {
createAvoirMutation.mutate(data);
};
// Filter avoirs based on search term
// Filter avoirs based on search term - ACCÈS SÉCURISÉ
const filteredAvoirs = avoirs.filter(avoir =>
avoir.invoiceReference?.toLowerCase().includes(searchTerm.toLowerCase()) ||
avoir.supplier.name.toLowerCase().includes(searchTerm.toLowerCase()) ||
avoir.comment?.toLowerCase().includes(searchTerm.toLowerCase()) ||
(avoir.creator.firstName && avoir.creator.lastName
(avoir.invoiceReference?.toLowerCase() || '').includes(searchTerm.toLowerCase()) ||
(avoir.supplier?.name?.toLowerCase() || '').includes(searchTerm.toLowerCase()) ||
(avoir.comment?.toLowerCase() || '').includes(searchTerm.toLowerCase()) ||
(avoir.creator?.firstName && avoir.creator?.lastName
? `${avoir.creator.firstName} ${avoir.creator.lastName}`.toLowerCase().includes(searchTerm.toLowerCase())
: avoir.creator.username.toLowerCase().includes(searchTerm.toLowerCase())
: (avoir.creator?.username?.toLowerCase() || '').includes(searchTerm.toLowerCase())
)
);
@@ -460,9 +460,9 @@ export default function Avoirs() {
<div className="flex items-center">
<div
className="w-3 h-3 rounded-full mr-2"
style={{ backgroundColor: avoir.group.color }}
style={{ backgroundColor: avoir.group?.color || '#ccc' }}
/>
{avoir.group.name}
{avoir.group?.name || 'Non défini'}
</div>
</CardDescription>
</CardHeader>
@@ -470,7 +470,7 @@ export default function Avoirs() {
<div className="space-y-2">
<div className="flex justify-between items-center">
<span className="text-sm text-muted-foreground">Fournisseur:</span>
<span className="font-medium">{avoir.supplier.name}</span>
<span className="font-medium">{avoir.supplier?.name || 'Non défini'}</span>
</div>
<div className="flex justify-between items-center">
@@ -489,9 +489,9 @@ export default function Avoirs() {
<div className="pt-2 border-t">
<div className="flex justify-between text-xs text-muted-foreground">
<span>
Par {avoir.creator.firstName && avoir.creator.lastName
Par {avoir.creator?.firstName && avoir.creator?.lastName
? `${avoir.creator.firstName} ${avoir.creator.lastName}`
: avoir.creator.username
: avoir.creator?.username || 'Utilisateur inconnu'
}
</span>
<span>