coerce record fields to string in sanitize

This commit is contained in:
jetsparrow 2025-09-16 01:39:25 +03:00
parent 9716f2c5b1
commit 08f9d1b0bf

View File

@ -41,13 +41,13 @@ function sanitizeRecord(record)
const noData="нет данных"; const noData="нет данных";
for (var i = 0; i < record.length; ++i) for (var i = 0; i < record.length; ++i)
{ {
if ((""+record[i]).trim().toLowerCase() == noData) if (!record[i] || (""+record[i]).trim().toLowerCase() == noData)
{ {
record[i] = ""; record[i] = "";
} }
else if(!record[i]) else
{ {
record[i] = ""; record[i] = ""+record[i];
} }
} }
return record; return record;
@ -69,23 +69,23 @@ async function populateBallot(template, record){
patches: { patches: {
APT_NUM: { APT_NUM: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[2])], children: [ new TextRun(record[2])],
}, },
FIO: { FIO: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[3])], children: [ new TextRun(record[3])],
}, },
APT_AREA: { APT_AREA: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[5])], children: [ new TextRun(record[5])],
}, },
SHARE: { SHARE: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[6])], children: [ new TextRun(record[6])],
}, },
DOCUMENT_NUM: { DOCUMENT_NUM: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[8])], children: [ new TextRun(record[8])],
}, },
DOCUMENT_DATE: { DOCUMENT_DATE: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
@ -93,7 +93,7 @@ async function populateBallot(template, record){
}, },
SNILS: { SNILS: {
type: PatchType.PARAGRAPH, type: PatchType.PARAGRAPH,
children: [ new TextRun(""+record[10])], children: [ new TextRun(record[10])],
} }
}, },
}); });