View Issue Details

This issue affects 1 person(s).
 4
IDProjectCategoryView StatusLast Update
05340Bug reportsRemoteControlpublic2012-07-19 23:36
Reporterpdedou Assigned To 
PrioritynormalSeverityblock 
Status closedResolutionfixed 
Product Version1.91+ 
Summary05340: fSendStatistic function crashes when there is at least one array type question in the survey you need to have statistics for.
Description

The following error comes up, when u use fSendStatistic via LSRC so as to send statistics for a survey that contains at least one array type question:

Couldn't do count of values
SELECT count(*) FROM lime_survey_15377 WHERE ( 15377X36X271 = '' OR 15377X36X271 = ' ')
Unknown column '15377X36X271' in 'where clause'

Steps To Reproduce
  1. Create a sample survey with one group that contains one Array (5 point choice) question.
  2. Configure config.php to use smtp relaying (and the rest of the smtp related options).
  3. Use fSendStatistic function like: fSendStatistic('username', 'password', 1000, 'reporter@limesurvey.org', 'html', '0').
TagsNo tags attached.
Attached Files
statistics_function.php.diff (1,526 bytes)   
Index: statistics_function.php
===================================================================
--- statistics_function.php	(revision 10404)
+++ statistics_function.php	(working copy)
@@ -142,14 +142,17 @@
 
     if($q2show=='all' )
     {
-        $summarySql=" SELECT gid, parent_qid, qid, type "
-        ." FROM {$dbprefix}questions WHERE parent_qid=0"
-        ." AND sid=$surveyid ";
+        $summarySql=" SELECT gid, parent_qid, qid, type, title "
+        ." FROM {$dbprefix}questions"
+        ." WHERE sid=$surveyid ";
 
         $summaryRs = db_execute_assoc($summarySql);
 
         foreach($summaryRs as $field)
         {
+        if ($field['parent_qid'] == 0) {
+          // Not array type
+          if (($field['type'] != "A") && ($field['type'] != "B") && ($field['type'] != "C") && ($field['type'] != "D") && ($field['type'] != "E") && ($field['type'] != "F")) {  
             $myField = $surveyid."X".$field['gid']."X".$field['qid'];
 
             // Multiple choice get special treatment
@@ -181,11 +184,20 @@
 
 
             }
-            if($q2show=='all')
-            $summary[]=$myField;
 
-            //$allfields[]=$myField;
+
         }
+      }
+      else {
+        $myField = $surveyid."X".$field['gid']."X".$field['parent_qid'].$field['title'];
+      }
+  
+      if($q2show=='all' && $myField!=null) {
+        $summary[]=$myField;
+      }
+      //$allfields[]=$myField;
+      $myField = null;
+      }
     }
     else
     {
statistics_function.php.diff (1,526 bytes)   
Bug heat4
Complete LimeSurvey version number (& build)10377
I will donate to the project if issue is resolvedNo
Browser
Database type & versionMySQL 5.5.12
Server OS (if known)Windows 7 Home Premium 64-bit
Webserver software & version (if known)JBOSS 4.2.2.G.A.
PHP Version5.3.6
Git branch / Pull Request URL

Users monitoring this issue

There are no users monitoring this issue.

Activities

pdedou

pdedou

2011-08-08 17:14

reporter   ~15990

I have done the attached patch, which gives you the opportunity to send statistics via LSRC even if you use array type questions in your survey. However, the statistics of each question appear in a random position.

pdedou

pdedou

2011-08-23 20:03

reporter   ~16124

It seems to work fine with the second patch (statistics_function.php.diff2). The statistics of each question appear in the right position now.

c_schmitz

c_schmitz

2012-07-19 23:36

administrator   ~19851

Fixed in 2.00RC6

2.00RC6 released.

Issue History

Date Modified Username Field Change
2011-07-12 00:04 pdedou New Issue
2011-07-12 14:59 c_schmitz Assigned To => elameno
2011-07-12 14:59 c_schmitz Status new => assigned
2011-07-12 14:59 c_schmitz Priority immediate => normal
2011-08-08 17:13 pdedou File Added: statistics_function.php.diff
2011-08-08 17:14 pdedou Note Added: 15990
2011-08-23 20:01 pdedou File Added: statistics_function.php.diff2
2011-08-23 20:03 pdedou Note Added: 16124
2011-08-23 20:03 pdedou Issue Monitored: pdedou
2011-08-23 20:04 pdedou Issue End Monitor: pdedou
2011-10-08 22:37 c_schmitz Status assigned => confirmed
2011-10-20 18:29 c_schmitz Category RemoteControl => (No Category)
2012-06-21 14:33 c_schmitz Assigned To elameno =>
2012-06-21 14:33 c_schmitz Category (No Category) => RemoteControl
2012-07-19 23:36 c_schmitz Note Added: 19851
2012-07-19 23:36 c_schmitz Status confirmed => closed
2026-10-25 16:41 c_schmitz Resolution open => fixed