Skip to content

Commit

Permalink
Fixed issue: Replacing @@SURVEYURL@@ incorrectly in RPC
Browse files Browse the repository at this point in the history
When using the value `@@SURVEYURL@@` in an email, `SURVEYURL` will be replaced by calling `ReplaceFields` as it's a part of the `$fieldsarray`.
This way, the barebone_link is never replaced correctly.

To fix this, we need to replace the barebone_link before caling `ReplaceFields`.

To reproduce:

- Add `@@SURVEYURL@@` to an email template (invite or remind in my case)
- Send a mail using the RPC.
  • Loading branch information
frederikprijck authored and LouisGac committed Jan 20, 2017
1 parent e3ff9ef commit 02be40a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions application/helpers/admin/token_helper.php
Expand Up @@ -129,17 +129,14 @@ function emailTokens($iSurveyID,$aResultTokens,$sType)
$sMessage = $aSurveyLocaleData[$sTokenLanguage]['surveyls_email_remind'];
}

$modsubject = Replacefields($sSubject, $fieldsarray);
$modmessage = Replacefields($sMessage, $fieldsarray);

if (isset($barebone_link))
{
$modsubject = str_replace("@@SURVEYURL@@", $barebone_link, $modsubject);
$modmessage = str_replace("@@SURVEYURL@@", $barebone_link, $modmessage);
}



$modsubject = Replacefields($sSubject, $fieldsarray);
$modmessage = Replacefields($sMessage, $fieldsarray);

if (isset($aTokenRow['validfrom']) && trim($aTokenRow['validfrom']) != '' && convertDateTimeFormat($aTokenRow['validfrom'], 'Y-m-d H:i:s', 'U') * 1 > date('U') * 1)
{
Expand Down

0 comments on commit 02be40a

Please sign in to comment.