Skip to content

Commit

Permalink
Merge pull request #127 from mfaber/txtimport_qattrib205
Browse files Browse the repository at this point in the history
Fixed issue #8119: (tsv-import) adv Q-attributes broken
  • Loading branch information
c-schmitz committed Sep 25, 2013
2 parents afc4291 + 99076cd commit 9b202aa
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion application/helpers/admin/import_helper.php
Expand Up @@ -4423,6 +4423,7 @@ function TSVImportSurvey($sFullFilepath)
$handle = fopen($sFullFilepath, 'r');
$bom = fread($handle, 2);
rewind($handle);
$aAttributeList = questionAttributes();

// Excel tends to save CSV as UTF-16, which PHP does not properly detect
if($bom === chr(0xff).chr(0xfe) || $bom === chr(0xfe).chr(0xff)){
Expand Down Expand Up @@ -4694,7 +4695,15 @@ function TSVImportSurvey($sFullFilepath)
{
$insertdata = array();
$insertdata['qid'] = $qid;
$insertdata['language'] = (isset($row['language']) ? $row['language'] : $baselang);
// check if attribute is a i18n attribute. If yes, set language, else set language to null in attribute table
if ($aAttributeList[$qtype][$key]['i18n']==1)
{
$insertdata['language'] = (isset($row['language']) ? $row['language'] : $baselang);
}
else
{
$insertdata['language'] = NULL;
}
$insertdata['attribute'] = $key;
$insertdata['value'] = $val;
$result=QuestionAttribute::model()->insertRecords($insertdata);//
Expand Down

0 comments on commit 9b202aa

Please sign in to comment.