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