Skip to content

Commit

Permalink
Fixed #7885: Multiple issues with excel/tsv export and subsequent import
Browse files Browse the repository at this point in the history
dev: Fixed for 2.05 only
dev: it would be best to solve backward compatibility in the model so we don't have to do it for all import/exports separately, check my comment in the survey.php to keep track of changes
  • Loading branch information
mennodekker committed Aug 12, 2013
1 parent 792fac2 commit 17e03c4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 10 deletions.
11 changes: 1 addition & 10 deletions application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -3469,15 +3469,6 @@ function XMLImportSurvey($sFullFilepath,$sXMLdata=NULL,$sNewSurveyName=NULL,$iDe
$insertdata['wishSID']=$iOldSID;
}

if ($iDBVersion < 169)
{
if (isset($insertdata['allowjumps']))
{
$insertdata['questionindex'] = $insertdata['allowjumps'] == 'Y' ? 1 : 0;
unset($insertdata['allowjumps']);
}
}

if ($iDBVersion<145)
{
if(isset($insertdata['private'])) $insertdata['anonymized']=$insertdata['private'];
Expand Down Expand Up @@ -4811,7 +4802,7 @@ function TSVImportSurvey($sFullFilepath)
$insertdata['answer'] = (isset($row['text']) ? $row['text'] : '');
$insertdata['scale_id'] = (isset($row['type/scale']) ? $row['type/scale'] : 0);
$insertdata['language']= (isset($row['language']) ? $row['language'] : $baselang);
$insertdata['assessment_value'] = (isset($row['relevance']) ? $row['relevance'] : '');
$insertdata['assessment_value'] = (int) (isset($row['relevance']) ? $row['relevance'] : '');
$insertdata['sortorder'] = ++$aseq;
$result = Answer::model()->insertRecords($insertdata); // or safeDie("Error: Failed to insert answer<br />");
if(!$result){
Expand Down
14 changes: 14 additions & 0 deletions application/models/Survey.php
Original file line number Diff line number Diff line change
Expand Up @@ -402,4 +402,18 @@ public function findByPk($pk, $condition = '', $params = array()) {
public function resetCache() {
$this->findByPkCache = array();
}

/**
* Attribute renamed to questionindex in dbversion 169
* Y maps to 1 otherwise 0;
* @param type $value
*/
public function setAllowjumps($value)
{
if ($value === 'Y') {
$this->questionindex = 1;
} else {
$this->questionindex = 0;
}
}
}

0 comments on commit 17e03c4

Please sign in to comment.