Skip to content

Commit

Permalink
Fixed issue #09877: Possible issue with activation of token with malf…
Browse files Browse the repository at this point in the history
…ormed attributedescriptions
  • Loading branch information
Shnoulle committed Sep 10, 2015
1 parent df55564 commit c5d12ac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions application/models/Survey.php
Expand Up @@ -527,13 +527,16 @@ public function getTokenAttributes()
$aCompleteData=array();
foreach ($attdescriptiondata as $sKey=>$aValues)
{
if (!is_array($aValues)) $aValues=array();
$aCompleteData[$sKey]= array_merge(array(
'description' => '',
'mandatory' => 'N',
'show_register' => 'N',
'cpdbmap' =>''
),$aValues);
if(preg_match("/^attribute_[0-9]$/",$sKey))
{
if (!is_array($aValues)) $aValues=array();
$aCompleteData[$sKey]= array_merge(array(
'description' => '',
'mandatory' => 'N',
'show_register' => 'N',
'cpdbmap' =>''
),$aValues);
}
}
return $aCompleteData;
}
Expand Down Expand Up @@ -1049,4 +1052,4 @@ public function deleteDependent() {



}
}
2 changes: 1 addition & 1 deletion application/models/Token.php
Expand Up @@ -107,7 +107,7 @@ public static function createTable($surveyId, array $extraFields = [])
}

// create fields for the custom token attributes associated with this survey
$tokenattributefieldnames = Survey::model()->findByPk($surveyId)->tokenAttributes;
$tokenattributefieldnames = Survey::model()->findByPk($surveyId)->getTokenAttributes();
foreach($tokenattributefieldnames as $attrname=>$attrdetails)
{
if (!isset($fields[$attrname])) {
Expand Down

0 comments on commit c5d12ac

Please sign in to comment.