Skip to content

Commit

Permalink
Fixed issue #7212: Config parameter deletenonvalues not working
Browse files Browse the repository at this point in the history
  • Loading branch information
c-schmitz committed Jan 19, 2013
1 parent 7916a17 commit b6a0d6d
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
1 change: 1 addition & 0 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -56,6 +56,7 @@ function run($surveyid,$args) {
'anonymized' => ($thissurvey['anonymized'] != 'N'),
'assessments' => ($thissurvey['assessments'] == 'Y'),
'datestamp' => ($thissurvey['datestamp'] == 'Y'),
'deletenonvalues'=>Yii::app()->getConfig('deletenonvalues'),
'hyperlinkSyntaxHighlighting' => (($LEMdebugLevel & LEM_DEBUG_VALIDATION_SUMMARY) == LEM_DEBUG_VALIDATION_SUMMARY), // TODO set this to true if in admin mode but not if running a survey
'ipaddr' => ($thissurvey['ipaddr'] == 'Y'),
'radix'=>$radix,
Expand Down
17 changes: 17 additions & 0 deletions application/helpers/expressions/em_manager_helper.php
Expand Up @@ -3952,6 +3952,7 @@ static function StartSurvey($surveyid,$surveyMode='group',$options=NULL,$forceRe
$LEM->surveyOptions['anonymized'] = (isset($options['anonymized']) ? $options['anonymized'] : false);
$LEM->surveyOptions['assessments'] = (isset($options['assessments']) ? $options['assessments'] : false);
$LEM->surveyOptions['datestamp'] = (isset($options['datestamp']) ? $options['datestamp'] : false);
$LEM->surveyOptions['deletenonvalues'] = (isset($options['deletenonvalues']) ? ($options['deletenonvalues']=='1') : true);
$LEM->surveyOptions['hyperlinkSyntaxHighlighting'] = (isset($options['hyperlinkSyntaxHighlighting']) ? $options['hyperlinkSyntaxHighlighting'] : false);
$LEM->surveyOptions['ipaddr'] = (isset($options['ipaddr']) ? $options['ipaddr'] : false);
$LEM->surveyOptions['radix'] = (isset($options['radix']) ? $options['radix'] : '.');
Expand Down Expand Up @@ -4419,6 +4420,22 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false)
// TODO - now that using $this->updatedValues, may be able to remove local copies of it (unless needed by other sub-systems)
$updatedValues = $this->updatedValues;

if (!$this->surveyOptions['deletenonvalues'])
{
$nonNullValues = array();
foreach($updatedValues as $key=>$value)
{
if (!is_null($value))
{
if (isset($value['value']) && !is_null($value['value']))
{
$nonNullValues[$key] = $value;
}
}
}
$updatedValues = $nonNullValues;
}

$message = '';
$_SESSION[$this->sessid]['datestamp']=dateShift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $this->surveyOptions['timeadjust']);
if ($this->surveyOptions['active'] && !isset($_SESSION[$this->sessid]['srid']))
Expand Down
3 changes: 3 additions & 0 deletions application/views/admin/expressions/test/navigation_test.php
Expand Up @@ -36,6 +36,7 @@
<li><input type='checkbox' name='LEM_DEBUG_VALIDATION_SUMMARY' id='LEM_DEBUG_VALIDATION_SUMMARY' value='Y' checked="checked"/>Validation Summary</li>
<li><input type='checkbox' name='LEM_DEBUG_VALIDATION_DETAIL' id='LEM_DEBUG_VALIDATION_DETAIL' value='Y' checked="checked"/>Validation Detail (Validation Summary must also be checked to see detail)</li>
<li><input type='checkbox' name='LEM_PRETTY_PRINT_ALL_SYNTAX' id='LEM_PRETTY_PRINT_ALL_SYNTAX' value='Y' checked="checked"/>Pretty Print Syntax</li>
<li><input type='checkbox' name='deletenonvalues' id='deletenonvalues' value='Y' checked="checked"/>Delete non-relevant values</li>
</ul></td>
</tr>
<tr><td colspan='2'><input type='submit'/></td></tr>
Expand All @@ -58,13 +59,15 @@
((isset($_POST['LEM_DEBUG_VALIDATION_DETAIL']) && $_POST['LEM_DEBUG_VALIDATION_DETAIL'] == 'Y') ? LEM_DEBUG_VALIDATION_DETAIL : 0) +
((isset($_POST['LEM_PRETTY_PRINT_ALL_SYNTAX']) && $_POST['LEM_PRETTY_PRINT_ALL_SYNTAX'] == 'Y') ? LEM_PRETTY_PRINT_ALL_SYNTAX : 0)
);
$deletenonvalues = ((isset($_POST['deletenonvalues']) && $_POST['deletenonvalues']=='Y') ? 1 : 0);

$surveyOptions = array(
'active'=>false,
'allowsave'=>true,
'anonymized'=>false,
'assessments'=>$assessments,
'datestamp'=>true,
'deletenonvalues'=>$deletenonvalues,
'hyperlinkSyntaxHighlighting'=>true,
'ipaddr'=>true,
'rooturl'=>'../../..',
Expand Down

0 comments on commit b6a0d6d

Please sign in to comment.