Skip to content

Commit

Permalink
dev: when language added but not saved it there is no record and surv…
Browse files Browse the repository at this point in the history
…eyinfo fails
  • Loading branch information
mennodekker committed Jan 25, 2013
1 parent f0844ba commit b5027a1
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions application/helpers/common_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1402,6 +1402,12 @@ function getSurveyInfo($surveyid, $languagecode='')
else
{
$result = Surveys_languagesettings::model()->with('survey')->findByPk(array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $languagecode));
if (is_null($result)) {
// When additional language was added, but not saved it does not exists
// We should revert to the base language then
$languagecode=Survey::model()->findByPk($surveyid)->language;
$result = Surveys_languagesettings::model()->with('survey')->findByPk(array('surveyls_survey_id' => $surveyid, 'surveyls_language' => $languagecode));
}
if($result)
{
$thissurvey=array_merge($result->survey->attributes,$result->attributes);
Expand Down

0 comments on commit b5027a1

Please sign in to comment.