Skip to content

Commit

Permalink
Fixed issue: #08036: unable to import 2.0 lss survey
Browse files Browse the repository at this point in the history
Dev: fix googleAnalytics and allowjumps
Dev: return warnings for other
  • Loading branch information
Shnoulle committed Oct 3, 2013
1 parent 9e41c97 commit 938366e
Showing 1 changed file with 27 additions and 0 deletions.
27 changes: 27 additions & 0 deletions application/helpers/admin/import_helper.php
Expand Up @@ -3493,6 +3493,33 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
$insertdata['showxquestions']=$insertdata['showXquestions'];
unset($insertdata['showXquestions']);
}
if (isset($insertdata['googleAnalyticsStyle']))
{
$insertdata['googleanalyticsstyle']=$insertdata['googleAnalyticsStyle'];
unset($insertdata['googleAnalyticsStyle']);
}
if (isset($insertdata['googleAnalyticsAPIKey']))
{
$insertdata['googleanalyticsapikey']=$insertdata['googleAnalyticsAPIKey'];
unset($insertdata['googleAnalyticsAPIKey']);
}
if (isset($insertdata['allowjumps']))
{
if( $insertdata['allowjumps']=="Y")
$insertdata['questionindex ']=1; // 0 is default then need only Y
unset($insertdata['allowjumps']);
}
/* Remove unknow column */
$aSurveyModelsColumns=Survey::model()->attributes;
$aSurveyModelsColumns['wishSID']=null;// To force a sid surely
$aBadData=array_diff_key($insertdata, $aSurveyModelsColumns);
$insertdata=array_intersect_key ($insertdata,$aSurveyModelsColumns);
// Fill a optionnal array of error
foreach($aBadData as $key=>$value)
{
$results['importwarnings'][]=sprintf($clang->gT("This survey setting has not been imported: %s => %s"),$key,$value);
}

$iNewSID = $results['newsid'] = Survey::model()->insertNewSurvey($insertdata) or safeDie($clang->gT("Error").": Failed to insert data [1]<br />");

$results['surveys']++;
Expand Down

0 comments on commit 938366e

Please sign in to comment.