fix: robustify suspended product filter using ::text cast

The previous ::boolean cast caused query failure when suspendu column
is not a native boolean type. Casting to ::text first handles all
column types (char, varchar, int, boolean).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
MichaelandClaude Sonnet 4.6 committed 2026-04-03 12:07:07 +02:00
1 parent a60e21eb04
commit de46e056d2
1 file changed
+2 -2
+2 -2
View File
@@ -151,8 +151,8 @@ export async function pgGetArticlesByFournisseur(codefou: string): Promise<PgArt
) last_fournisseur ON true
WHERE af.code = ${codefou}
AND a.codein IS NOT NULL
AND NOT COALESCE(af.suspendu::boolean, false)
AND NOT COALESCE(a.suspendu::boolean, false)
AND (af.suspendu IS NULL OR af.suspendu::text NOT IN ('1', 'true', 't', 'yes', 'y', 'on'))
AND (a.suspendu IS NULL OR a.suspendu::text NOT IN ('1', 'true', 't', 'yes', 'y', 'on'))
ORDER BY a.no_id, af.no_id
`);