Skip to content

Commit

Permalink
Fixed issue #18351: Extra token placeholder show as invalid in expres…
Browse files Browse the repository at this point in the history
…sion (#2601)

Dev: add completed to fixed columns
Dev: use all in expression validator since Script use all token->attributes
  • Loading branch information
Shnoulle committed Sep 21, 2022
1 parent 00268b4 commit 10fcdca
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 15 deletions.
26 changes: 16 additions & 10 deletions application/helpers/common_helper.php
Expand Up @@ -2955,10 +2955,11 @@ function getTokenFieldsAndNames($surveyid, $bOnlyAttributes = false)
{


$aBasicTokenFields = array('firstname'=>array(
'description'=>gT('First name'),
'mandatory'=>'N',
'showregister'=>'Y'
$aBasicTokenFields = array(
'firstname'=>array(
'description'=>gT('First name'),
'mandatory'=>'N',
'showregister'=>'Y'
),
'lastname'=>array(
'description'=>gT('Last name'),
Expand All @@ -2978,32 +2979,37 @@ function getTokenFieldsAndNames($surveyid, $bOnlyAttributes = false)
'token'=>array(
'description'=>gT('Token'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N',
),
'language'=>array(
'description'=>gT('Language code'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N'
),
'sent'=>array(
'description'=>gT('Invitation sent date'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N'
),
'remindersent'=>array(
'description'=>gT('Last reminder sent date'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N'
),
'remindercount'=>array(
'description'=>gT('Total numbers of sent reminders'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N'
),
'usesleft'=>array(
'description'=>gT('Uses left'),
'mandatory'=>'N',
'showregister'=>'Y'
'showregister'=>'N'
),
'completed' => array(
'description' => gT('Completed'),
'mandatory' => 'N',
'showregister' => 'N'
),
);

Expand Down
7 changes: 2 additions & 5 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -4324,13 +4324,10 @@ public function setVariableAndTokenMappingsForExpressionManager($surveyid,$force
'jsName'=>'',
'readWrite'=>'N',
);
// DON'T set $this->knownVars['TOKEN'] = $blankVal; becuase optout/optin can need it, then don't replace this from templatereplace
// DON'T set $this->knownVars['TOKEN'] = $blankVal; because optout/optin can need it, then don't replace this from templatereplace
foreach ($attrs as $key)
{
if (preg_match('/^(firstname|lastname|email|usesleft|token|attribute_\d+)$/',$key))
{
$this->knownVars['TOKEN:' . strtoupper($key)] = $blankVal;
}
$this->knownVars['TOKEN:' . strtoupper($key)] = $blankVal;
}
}
// set default value for reserved 'this' variable
Expand Down

0 comments on commit 10fcdca

Please sign in to comment.