Skip to content

Commit

Permalink
Fixed issue # 14253: Copying survey does not copy survey group (#1170)
Browse files Browse the repository at this point in the history
  • Loading branch information
TonisOrmisson authored and c-schmitz committed Dec 13, 2018
1 parent db7b7fe commit 72f99e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions application/helpers/admin/import_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ function importSurveyFile($sFullFilePath, $bTranslateLinksFields, $sNewSurveyNam
*/
function XMLImportSurvey($sFullFilePath, $sXMLdata = null, $sNewSurveyName = null, $iDesiredSurveyId = null, $bTranslateInsertansTags = true, $bConvertInvalidQuestionCodes = true)
{
$isCopying = ($sNewSurveyName != null);
Yii::app()->loadHelper('database');
$results = [];
$aGIDReplacements = array();
Expand Down Expand Up @@ -851,8 +852,8 @@ function XMLImportSurvey($sFullFilePath, $sXMLdata = null, $sNewSurveyName = nul
$insertdata = array();

foreach ($row as $key=>$value) {
// Set survey group id to 1. Makes no sense to import it without the actual survey group.
if ($key == 'gsid') {
// Set survey group id to default if not a copy
if ($key == 'gsid' & !$isCopying) {
$value = 1;
}
if ($key == 'template') {
Expand Down Expand Up @@ -940,7 +941,7 @@ function XMLImportSurvey($sFullFilePath, $sXMLdata = null, $sNewSurveyName = nul
$insertdata['surveyls_survey_id'] = $iNewSID;

// Assign new survey name (if a copy)
if ($sNewSurveyName != null) {
if ($isCopying) {
$insertdata['surveyls_title'] = $sNewSurveyName;
}

Expand Down Expand Up @@ -1683,7 +1684,6 @@ function GetNewSurveyID($iDesiredSurveyId)
}
}


/**
* @param string $sFullFilePath
* @return mixed
Expand Down

0 comments on commit 72f99e2

Please sign in to comment.