Skip to content

Commit

Permalink
dev Fixed issue #3321: VV import throws lots of errors
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@7105 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
c-schmitz committed Jun 13, 2009
1 parent 5d25bac commit 583904f
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions admin/vvimport.php
Expand Up @@ -184,6 +184,22 @@
$importcount=0;
$recordcount=0;
$fieldnames=array_map('db_quote_id',$fieldnames);

//now find out which fields are datefields, these have to be null if the imported string is empty
$fieldmap=createFieldMap($surveyid);
$datefields=array();
$numericfields=array();
foreach ($fieldmap as $field)
{
if ($field['type']=='D')
{
$datefields[]=$field['fieldname'];
}
if ($field['type']=='N' || $field['type']=='K')
{
$numericfields[]=$field['fieldname'];
}
}
foreach($bigarray as $row)
{
if (trim($row) != "")
Expand Down Expand Up @@ -229,6 +245,21 @@

$fielddata=array_combine($fieldnames,$fieldvalues);

foreach ($datefields as $datefield)
{
if ($fielddata[db_quote_id($datefield)]=='')
{
unset($fielddata[db_quote_id($datefield)]);
}
}

foreach ($numericfields as $numericfield)
{
if ($fielddata[db_quote_id($numericfield)]=='')
{
unset($fielddata[db_quote_id($numericfield)]);
}
}
if ($fielddata[db_quote_id('submitdate')]=='NULL') unset ($fielddata[db_quote_id('submitdate')]);

$recordexists=false;
Expand Down

0 comments on commit 583904f

Please sign in to comment.