Skip to content

Commit

Permalink
Fixed issue #09533 : TSV export/import multiple with other add a othe…
Browse files Browse the repository at this point in the history
…r sub-question

Dev: Beter count for default value
Dev: Potential notice for import survey (seems not happen actually).
  • Loading branch information
Shnoulle committed Feb 19, 2015
1 parent 8deeb95 commit 7653489
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -910,7 +910,7 @@ public function copy()
$aImportResults=importSurveyFile($sFullFilepath,(isset($_POST['translinksfields'])));
if (is_null($aImportResults) || !empty($aImportResults['error']))
{
$aData['sErrorMessage']=$aImportResults['error'];
$aData['sErrorMessage']=isset($aImportResults['error']) ? $aImportResults['error'] : gt("Unknow error.");
$aData['bFailed'] = true;
}
}
Expand Down
14 changes: 8 additions & 6 deletions application/helpers/admin/import_helper.php
Expand Up @@ -2289,7 +2289,7 @@ function TSVImportSurvey($sFullFilePath)
$insertdata['help'] = (isset($row['help']) ? $row['help'] : '');
$insertdata['language'] = (isset($row['language']) ? $row['language'] : $baselang);
$insertdata['mandatory'] = (isset($row['mandatory']) ? $row['mandatory'] : '');
$insertdata['other'] = (isset($row['other']) ? $row['other'] : 'N');
$lastother = $insertdata['other'] = (isset($row['other']) ? $row['other'] : 'N'); // Keep trace of other settings for sub question
$insertdata['same_default'] = (isset($row['same_default']) ? $row['same_default'] : 0);
$insertdata['parent_qid'] = 0;

Expand Down Expand Up @@ -2389,11 +2389,12 @@ function TSVImportSurvey($sFullFilePath)
{
; // these are fake rows to show naming of comment and filecount fields
}
elseif ($sqname == 'other' && ($qtype == '!' || $qtype == 'L'))
elseif ($sqname == 'other' && $lastother=="Y") // If last question have other to Y : it's not a real SQ row
{
if($qtype=="!" || $qtype=="L")
{
// only want to set default value for 'other' in these cases - not a real SQ row
// TODO - this isn't working
if (isset($row['default']))
// only used to set default value for 'other' in these cases
if (isset($row['default']) && $row['default']!="")
{
$insertdata=array();
$insertdata['qid'] = $qid;
Expand All @@ -2407,6 +2408,7 @@ function TSVImportSurvey($sFullFilePath)
}
$results['defaultvalues']++;
}
}
}
else
{
Expand Down Expand Up @@ -2452,7 +2454,7 @@ function TSVImportSurvey($sFullFilePath)
}

// insert default value
if (isset($row['default']))
if (isset($row['default']) && $row['default']!="")
{
$insertdata=array();
$insertdata['qid'] = $qid;
Expand Down

0 comments on commit 7653489

Please sign in to comment.