Skip to content

Commit

Permalink
Fixed issue #13973: Non-anonymous survey - {FIRSTNAME} in assessments
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikvitt committed Aug 17, 2018
1 parent 91d1432 commit a6b553a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions application/helpers/frontend_helper.php
Expand Up @@ -1661,6 +1661,14 @@ function doAssessment($surveyid)

$assessment['subtotal_score'] = (isset($subtotal)) ? $subtotal : '';
$assessment['total_score'] = (isset($total)) ? $total : '';
// token data for placeholder replacements
$token = Token::model($surveyid)->findByAttributes(array('token' => $_SESSION['survey_'.$surveyid]['token']));
if ($token !== null){
$assessment['token']['email'] = $survey->anonymized === 'N'?$token->email:'';
$assessment['token']['firstname'] = $survey->anonymized === 'N'?$token->firstname:'';
$assessment['token']['lastname'] = $survey->anonymized === 'N'?$token->lastname:'';
$assessment['token']['token'] = $survey->anonymized === 'N'?$token->token:'';
}
//$aDatas = array('total' => $total, 'assessment' => $assessment, 'subtotal' => $subtotal, );
return array('show'=>($assessment['subtotal']['show'] || $assessment['total']['show']), 'datas' => $assessment);

Expand Down
Expand Up @@ -47,7 +47,7 @@

<tr {{ aSurveyInfo.attr.assessmentstabletr }} >
<td {{ aSurveyInfo.attr.assessmentstabletd }} >
{{ str_replace( [ "{PERC}", "{TOTAL}", "{ASSESSMENT_CURRENT_TOTAL}" ], [ val, aAssessments.total_score, aAssessments.total_score ], assessed.message) }}
{{ str_replace( [ "{PERC}", "{TOTAL}", "{ASSESSMENT_CURRENT_TOTAL}", "{TOKEN:EMAIL}", "{TOKEN:FIRSTNAME}", "{TOKEN:LASTNAME}", "{TOKEN:TOKEN}" ], [ val, aAssessments.total_score, aAssessments.total_score, aAssessments.token.email, aAssessments.token.firstname, aAssessments.token.lastname, aAssessments.token.token ], assessed.message) }}
</td>
</tr>
</table>
Expand All @@ -73,7 +73,7 @@
</tr>
<tr {{ aSurveyInfo.attr.assessmentstablettr }}>
<td {{ aSurveyInfo.attr.assessmentstablettd }}>
{{ str_replace( [ "{PERC}", "{TOTAL}", "{ASSESSMENT_CURRENT_TOTAL}" ], [ val, aAssessments.total_score, aAssessments.total_score ], assessed.message) }}
{{ str_replace( [ "{PERC}", "{TOTAL}", "{ASSESSMENT_CURRENT_TOTAL}", "{TOKEN:EMAIL}", "{TOKEN:FIRSTNAME}", "{TOKEN:LASTNAME}", "{TOKEN:TOKEN}" ], [ val, aAssessments.total_score, aAssessments.total_score, aAssessments.token.email, aAssessments.token.firstname, aAssessments.token.lastname, aAssessments.token.token ], assessed.message) }}
</td>
</tr>
</table>
Expand Down

1 comment on commit a6b553a

@Shnoulle
Copy link
Collaborator

@Shnoulle Shnoulle commented on a6b553a Aug 17, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we use

public static function processString($string,$static=false,$numRecursionLevels=3,$aReplacement = array())
directly ?

Adding PERC,TOTAL and ASSESSMENT_CURRENT_TOTAL to $aReplacement ?

Please sign in to comment.