From d4f308cb21c78dadcfed12615c8c89511162a517 Mon Sep 17 00:00:00 2001 From: Raphael Odini Date: Mon, 6 Jan 2025 21:45:14 +0100 Subject: [PATCH] fix(Assistants): additional cleanup rule for Carrefour wrongly detected barcodes. ref #1204 --- src/utils.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils.js b/src/utils.js index 547702e8d64..07b5fbe62b9 100644 --- a/src/utils.js +++ b/src/utils.js @@ -67,9 +67,10 @@ function isValidBarcode(value) { function cleanBarcode(value) { // keep only digits (remove letters, spaces, special characters) value = value.replace(/\D/g, '') - // special case: 22 digits could be Carrefour + // special case: 19 or 22 digits could be Carrefour + // 182492/3119789831280 -> 1824923119789831280 -> 3119789831280 // 182492/3119789831280/051 -> 1824923119789831280051 -> 3119789831280 - if (value.length === 22) { + if ((value.length === 19) || (value.length === 22)) { value = value.substring(6, 6+13) } // remove leading zeros? no