Skip to content

Commit

Permalink
Fixed issue #9164: Error when adding participant to exported and impo…
Browse files Browse the repository at this point in the history
…rted survey
  • Loading branch information
c-schmitz committed Aug 13, 2014
1 parent b178032 commit 0e6ed05
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions application/helpers/admin/import_helper.php
Expand Up @@ -4313,7 +4313,10 @@ function XMLImportTokens($sFullFilePath,$iSurveyID,$sCreateMissingAttributeField
$results['tokens']++;
}
switchMSSQLIdentityInsert('tokens_'.$iSurveyID,false);

if (Yii::app()->db->getDriverName() == 'pgsql')
{
try {Yii::app()->db->createCommand("SELECT pg_catalog.setval(pg_get_serial_sequence('{{tokens_".$iSurveyID."}}', 'tid'), (SELECT MAX(tid) FROM {{tokens_".$iSurveyID."}}))")->execute();} catch(Exception $oException){};
}
return $results;
}

Expand Down Expand Up @@ -4374,7 +4377,10 @@ function XMLImportResponses($sFullFilePath,$iSurveyID,$aFieldReMap=array())
}

switchMSSQLIdentityInsert('survey_'.$iSurveyID,false);

if (Yii::app()->db->getDriverName() == 'pgsql')
{
try {Yii::app()->db->createCommand("SELECT pg_catalog.setval(pg_get_serial_sequence('{{survey_".$iSurveyID."}}', 'id'), (SELECT MAX(id) FROM {{survey_".$iSurveyID."}}))")->execute();} catch(Exception $oException){};
}
return $results;
}

Expand Down

0 comments on commit 0e6ed05

Please sign in to comment.