Loading...
 
Skip to main content

Survey text entries are not registered correctly

Status
Pending
Subject
Survey text entries are not registered correctly
Version
1.9.x
Category
  • Error
  • Patch
Feature
Survey
Submitted by
mikaelk
Rating
(0)
Description
A text entry to a survey question is not registered correctly if the same entry has already been registered to some other question. For example, if there is a survey on ID 1 with a text question and someone has answered "foobar" to that question and then another person takes survey on ID 2 and answers "foobar" to a text question in that survey no entry is registered. The problem can be replicated most easily but creating a survey with multiple text questions and answering for example "test" to all those questions. Only the first "text" is registered and the rest omitted.
Solution

If I was able to track down the problem correctly the problem is the following line in /lib/surveys/surveylib.php:

Image
Copy to clipboard
$cant = $this->getOne("select count(*) from `tiki_survey_question_options` where `qoption`=?",array($value));


which should be changed to read:

Image
Copy to clipboard
$cant = $this->getOne("select count(*) from `tiki_survey_question_options` where `questionId`=? and `qoption`=?",array((int)$questionId,$value));
Importance
5
Priority
25
Demonstrate Bug on Tiki 19+
Demonstrate Bug (older Tiki versions)
Ticket ID
1648
Created
Thursday 20 March, 2008 21:12:48 UTC
by Unknown
LastModif
Thursday 20 March, 2008 21:24:36 UTC


Show PHP error messages