Skip to content

Commit

Permalink
Fixed issue #6727: Button continue does not send next batch of remind…
Browse files Browse the repository at this point in the history
…ers but returns to Token Summary
  • Loading branch information
c-schmitz committed Oct 19, 2012
1 parent 27fcc86 commit a5086ee
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
4 changes: 2 additions & 2 deletions application/controllers/admin/globalsettings.php
Expand Up @@ -139,8 +139,8 @@ private function _saveSettings()

if (returnGlobal('bounceaccountpass') != 'enteredpassword') setGlobalSetting('bounceaccountpass', strip_tags(returnGlobal('bounceaccountpass')));

setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(returnGlobal('emailsmtpssl')));
setGlobalSetting('emailsmtpdebug', sanitize_int(returnGlobal('emailsmtpdebug')));
setGlobalSetting('emailsmtpssl', sanitize_paranoid_string(Yii::app()->request->getPost('emailsmtpssl','')));
setGlobalSetting('emailsmtpdebug', sanitize_int(Yii::app()->request->getPost('emailsmtpdebug','0')));
setGlobalSetting('emailsmtpuser', strip_tags(returnGlobal('emailsmtpuser')));
setGlobalSetting('filterxsshtml', strip_tags($_POST['filterxsshtml']));
setGlobalSetting('siteadminbounce', strip_tags($_POST['siteadminbounce']));
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/tokens.php
Expand Up @@ -997,7 +997,7 @@ function addDummies($iSurveyId, $subaction = '')
'validuntil' => Yii::app()->request->getPost('validuntil'));

// add attributes
$attrfieldnames = Survey::model()->findByPk($iSurveyId)->tokenAttributes;
$attrfieldnames = getTokenFieldsAndNames($iSurveyId,true);
foreach ($attrfieldnames as $attr_name => $desc)
{
$value = Yii::app()->request->getPost($attr_name);
Expand Down Expand Up @@ -1087,7 +1087,7 @@ function addDummies($iSurveyId, $subaction = '')
$aData['surveyid'] = $iSurveyId;
$aData['tokenlength'] = $tokenlength;
$aData['dateformatdetails'] = getDateFormatData(Yii::app()->session['dateformat'],$clang->langcode);

$aData['aAttributeFields']=GetParticipantAttributes($iSurveyId);
$this->_renderWrappedTemplate('token', array('tokenbar', 'dummytokenform'), $aData);
}
}
Expand Down
20 changes: 19 additions & 1 deletion application/helpers/common_helper.php
Expand Up @@ -5384,6 +5384,25 @@ function GetAttributeFieldNames($iSurveyID,$filter=true)
return array_keys($table->columns);
}

/**
* Returns the full list of attribute token fields including the properties for each field
* Use this instead of plain Survey::model()->findByPk($iSurveyID)->tokenAttributes calls because Survey::model()->findByPk($iSurveyID)->tokenAttributes may contain old descriptions where the fields does not physically exist
*
* @param integer $iSurveyID The Survey ID
*/
function GetParticipantAttributes($iSurveyID)
{
if (!tableExists("{{tokens_{$iSurveyID}}}") || !$table = Yii::app()->db->schema->getTable('{{tokens_'.$iSurveyID.'}}'))
return Array();
$aFields= array_filter(array_keys($table->columns), 'filterForAttributes');
$aTokenAttributes=Survey::model()->findByPk($iSurveyID)->tokenAttributes;
return array_intersect_key($aTokenAttributes,array_flip($aFields));
}





/**
* Retrieves the token field names usable for conditions from the related token table
*
Expand All @@ -5402,7 +5421,6 @@ function getTokenConditionsFieldNames($surveyid)
*
* @param mixed $surveyid The survey ID
* @param boolean $onlyAttributes Set this to true if you only want the fieldnames of the additional attribue fields - defaults to false
* Use Survey::model()->findByPk($surveyid)->tokenAttributes instead
* @return array The fieldnames as key and names as value in an Array
*/
function getTokenFieldsAndNames($surveyid, $onlyAttributes = false)
Expand Down
3 changes: 1 addition & 2 deletions application/views/admin/token/dummytokenform.php
Expand Up @@ -39,8 +39,7 @@
</li>
<?php
// now the attribute fieds
$attrfieldnames = $thissurvey['attributedescriptions'];
foreach ($attrfieldnames as $attr_name => $attr_description)
foreach ($aAttributeFields as $attr_name => $attr_description)
{
?>
<li>
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/token/emailwarning.php
@@ -1,6 +1,6 @@
<div class='messagebox ui-corner-all'>
<div class='warningheader'><?php $clang->eT("Warning"); ?></div><br />
<form method='post' action='<?php echo $this->createUrl("/admin/tokens/{$sSubAction}/surveyid/{$surveyid}"); ?>'>
<form method='post' action='<?php echo $this->createUrl("/admin/tokens/email/action/{$sSubAction}/surveyid/{$surveyid}"); ?>'>
<?php $clang->eT("There are more emails pending than can be sent in one batch. Continue sending emails by clicking below."); ?><br /><br />
<?php echo str_replace("{EMAILCOUNT}", (string) $lefttosend, $clang->gT("There are {EMAILCOUNT} emails still to be sent.")); ?>
<br /><br />
Expand Down

0 comments on commit a5086ee

Please sign in to comment.