Skip to content

Commit

Permalink
Fixed issue #3940: PHP error when running a a survey with conditions …
Browse files Browse the repository at this point in the history
…based on Tokens but no token table exists.

Fixed unreported issue: issue when a survey doesn't display any question due to conditions (based on tokens).
Dev: the last issue may not be completely fixed cause there is no end-page after the auto-submit, but at least there is no php error anymore

git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey@8180 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Thibault Le Meur committed Dec 19, 2009
1 parent 651b5b9 commit 71dc62e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
4 changes: 2 additions & 2 deletions common.php
Expand Up @@ -6897,7 +6897,7 @@ function GetAttributeValue($surveyid,$attrName,$token)
{
global $dbprefix, $connect;
$attrName=strtolower($attrName);
if (!in_array($attrName,GetTokenConditionsFieldNames($surveyid)))
if (!tableExists('tokens_'.$surveyid) || !in_array($attrName,GetTokenConditionsFieldNames($surveyid)))
{
return null;
}
Expand Down Expand Up @@ -7208,4 +7208,4 @@ function hasRight($sid, $right = null)
}
if (empty($right)) return true;
if (isset($cache[$sid][$uid][$right]) && $cache[$sid][$uid][$right] == 1) return true; else return false;
}
}
9 changes: 9 additions & 0 deletions save.php
Expand Up @@ -649,6 +649,15 @@ function submitanswer()
$query = "";
if (isset($move) && ($move == "movesubmit") && ($thissurvey['active'] == "Y"))
{
if (!isset($_SESSION['srid']))
{ //due to conditions no answer was displayed and yet we must submit
$query=createinsertquery();
if ($result=$connect->Execute($query))
{
$tempID=$connect->Insert_ID($thissurvey['tablename'],"id");
$_SESSION['srid'] = $tempID;
}
}
$query = "UPDATE {$thissurvey['tablename']} SET ";
$query .= " submitdate = ".$connect->DBDate($mysubmitdate);
$query .= " WHERE id=" . $_SESSION['srid'];
Expand Down

0 comments on commit 71dc62e

Please sign in to comment.