Skip to content

Commit

Permalink
Fixed issue #7156: Custom field description not retrieved when import…
Browse files Browse the repository at this point in the history
…ing old token table
  • Loading branch information
c-schmitz committed Jan 22, 2013
1 parent 5313490 commit d1e7597
Showing 1 changed file with 11 additions and 6 deletions.
17 changes: 11 additions & 6 deletions application/controllers/admin/tokens.php
Expand Up @@ -2289,6 +2289,7 @@ function _handletokenform($iSurveyId, $subaction, $iTokenId="")
function _newtokentable($iSurveyId)
{
$clang = $this->getController()->lang;
$aSurveyInfo = getSurveyInfo($iSurveyId);
Yii::import('application.helpers.admin.token_helper', true);
if (Yii::app()->request->getQuery('createtable') == "Y" && hasSurveyPermission($iSurveyId, 'surveyactivation', 'update'))
{
Expand All @@ -2306,7 +2307,8 @@ function _newtokentable($iSurveyId)
//Rebuild attributedescription value for the surveys table
$table = Yii::app()->db->schema->getTable(Yii::app()->request->getPost('oldtable'));
$fields=array_filter(array_keys($table->columns), 'filterForAttributes');
$fieldcontents=array();
$fieldcontents = $aSurveyInfo['attributedescriptions'];
if (!is_array($fieldcontents)) $fieldcontents=array();
foreach ($fields as $fieldname)
{
$name=$fieldname;
Expand All @@ -2315,11 +2317,14 @@ function _newtokentable($iSurveyId)
$data=ParticipantAttributeNames::model()->getAttributeName($cpdbattid, Yii::app()->session['adminlang']);
$name=$data['attribute_name'];
}
$fieldcontents[$fieldname] = array(
'description' => $name,
'mandatory' => 'N',
'show_register' => 'N'
);
if (!isset($fieldcontents[$fieldname]))
{
$fieldcontents[$fieldname] = array(
'description' => $name,
'mandatory' => 'N',
'show_register' => 'N'
);
}
}
Survey::model()->updateByPk($iSurveyId, array('attributedescriptions' => serialize($fieldcontents)));

Expand Down

0 comments on commit d1e7597

Please sign in to comment.