From 7d2c8aa09f8515c35edcf2c29d0e19afe3bd663c Mon Sep 17 00:00:00 2001 From: Tony Valle <79843014+superskip@users.noreply.github.com> Date: Thu, 25 Aug 2022 09:47:19 +0200 Subject: [PATCH] fix: use only the first two characters of `ai` to determine fixed length (#1506) --- d2-tracker/dhis2.d2GS1DataMatrix.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/d2-tracker/dhis2.d2GS1DataMatrix.js b/d2-tracker/dhis2.d2GS1DataMatrix.js index ffa13af34..86d535df8 100644 --- a/d2-tracker/dhis2.d2GS1DataMatrix.js +++ b/d2-tracker/dhis2.d2GS1DataMatrix.js @@ -222,7 +222,7 @@ const aiFixedLengthMap = { '34': 10, '35': 10, '36': 10, - '41': 10, + '41': 16, }; const removeGS1Identifier = value => value.substring(3); @@ -267,7 +267,7 @@ const handleGroupData = (gs1Group) => { if (gs1Group) { const gs1GroupLength = gs1Group.length; const ai = getApplicationIdentifier(gs1Group); - let nextValueLength = aiFixedLengthMap[ai]; + let nextValueLength = aiFixedLengthMap[ai.substring(0, 2)]; if (nextValueLength == null) { nextValueLength = gs1GroupLength; }