View Issue Details

This bug affects 1 person(s).
 6
IDProjectCategoryView StatusLast Update
08873Bug reportsCentral participant databasepublic2014-03-20 14:52
Reporterreizformation Assigned Toc_schmitz  
PriorityhighSeverityminor 
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary08873: csv export for participants fails if "all attributes" selected - CDbCommand failed to execute the SQL statement
Description

csv export for participants fails if "all attributes" selected. if explicit attributes selected the csv export is functional.

Error:

Internal Server Error

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm' in 'on clause'

An internal error occurred while the Web server was processing your request. Please contact the webmaster to report this problem.

Thank you.

Additional Information

PHP warning

Illegal string offset 'attribute_id'

/var/www/limesurvey/application/models/Participant.php(292)

280 $selectValue[] = "luser.users_name as username";
281
282
283 // Add survey count subquery
284 $subQuery = Yii::app()->db->createCommand()
285 ->select('count(*) survey')
286 ->from('{{survey_links}} sl')
287 ->where('sl.participant_id = p.participant_id');
288 $selectValue[] = sprintf('(%s) survey',$subQuery->getText());
289 array_push($joinValue,"left join {{users}} luser ON luser.uid=p.owner_uid");
290 foreach($attid as $key=>$attid)
291 {
292 $attid = $attid['attribute_id'];
293 $sDatabaseType = Yii::app()->db->getDriverName();
294 if ($sDatabaseType=='mssql' || $sDatabaseType=="sqlsrv" || $sDatabaseType == 'dblib')
295 {
296 $selectValue[]= "cast(attribute".$attid.".value as varchar(max)) as a".$attid;
297 } else {
298 $selectValue[]= "attribute".$attid.".value as a".$attid;
299 }
300 array_push($joinValue,"LEFT JOIN {{participant_attribute}} attribute".$attid." ON attribute".$attid.".participant_id=p.participant_id AND attribute".$attid.".attribute_id=".$attid);
301 }
302
303 $aConditions = array(); // this wil hold all conditions
304 $aParams = array();

Stack Trace
#0
– /var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/application/models/Participant.php(251): Participant->getParticipantsSelectCommand(false, array("multiselect-all", "1", "2", "3", ...), null, null, ...)
246 return $count;
247 }
248
249 function getParticipants($page, $limit,$attid, $order = null, $search = null, $userid = null)
250 {
251 $data = $this->getParticipantsSelectCommand(false, $attid, $search, $userid, $page, $limit, $order);
252
253 $allData = $data->queryAll();
254
255 return $allData;
256 }

#1
/var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/application/controllers/admin/participantsaction.php(105): Participant->getParticipants(0, 0, array("multiselect-all", "1", "2", "3", ...), null, ...)
100 $iUserID = null;
101 } else {
102 $iUserID = Yii::app()->session['loginID'];
103 }
104
105 $query = Participant::model()->getParticipants(0, 0, $aAttributeIDs, null, $search, $iUserID);
106 if (!$query)
107 return false;
108
109 // Field names in the first row
110 $fields = array('participant_id', 'firstname', 'lastname', 'email', 'language', 'blacklisted', 'owner_uid');

#2
– /var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/application/controllers/admin/participantsaction.php(761): participantsaction->csvExport(null, array("multiselect-all", "1", "2", "3", ...))
756 $search = Participant::model()->getParticipantsSearchMultipleCondition($condition);
757 } else {
758 $search = null;
759 }
760 $aAttributes=explode('+',Yii::app()->request->getPost('attributes',''));
761 $this->csvExport($search,$aAttributes);
762 }
763
764 /*
765
Equal to getParticipants_json() but now with a search
766 */

#3
unknown(0): participantsaction->exporttocsv()
#4
– /var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/framework/web/actions/CAction.php(108): ReflectionMethod->invokeArgs(participantsaction, array())
103 elseif($param->isDefaultValueAvailable())
104 $ps[]=$param->getDefaultValue();
105 else
106 return false;
107 }
108 $method->invokeArgs($object,$ps);
109 return true;
110 }
111 }

#5
– /var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/application/core/Survey_Common_Action.php(99): CAction->runWithParamsInternal(participantsaction, ReflectionMethod, array("sa" => "exporttocsv"))
094 $oMethod = new ReflectionMethod($this, $sDefault);
095 }
096
097 // We're all good to go, let's execute it
098 // runWithParamsInternal would automatically get the parameters of the method and populate them as required with the params
099 return parent::runWithParamsInternal($this, $oMethod, $params);
100 }
101
102 /*
103
Some functions have different parameters, which are just an alias of the

#6
– /var/www/vhosts/ssc.panel-test.de/ssc4.panel-test.de/application/controllers/admin/participantsaction.php(50): Survey_Common_Action->runWithParams(array("sa" => "exporttocsv"))
45 {
46 if (!Permission::model()->hasGlobalPermission('participantpanel','read'))
47 {
48 die('No permission');
49 }
50 parent::runWithParams($params);
51 }
52
53
54
55 /*
104
usual parameters we're getting in the url. This function just populates

TagsNo tags attached.
Attached Files
exporttocsv_01.png (112,196 bytes)
Bug heat6
Complete LimeSurvey version number (& build)Version 2.05+ Build 140317
I will donate to the project if issue is resolvedYes
BrowserFirefox 27.01, Chrome 32.0.1700.102, Safari 7.0.2 (9537.74.9)
Database type & version5.5.35-0+wheezy1,
Server OS (if known)Debian 3.2.54-2 x86_64
Webserver software & version (if known)Apache/2.2.22 (Debian)
PHP VersionPHP Version 5.4.4-14+deb7u7

Users monitoring this issue

reizformation

Activities

reizformation

reizformation

2014-03-18 17:15

reporter   ~29351

if one attribute explicit selected (functional) mysql.log entry follow:

140318 17:12:53 134 Connect root@localhost on lime02
134 Query SET NAMES 'utf8'
134 Query SELECT FROM lime_plugins t WHERE t.active=1
134 Query SELECT
FROM lime_settings_global t
134 Query SELECT FROM lime_settings_global t WHERE t.stg_name='updatelastcheck' LIMIT 1
134 Query SELECT
FROM lime_permissions t WHERE t.entity_id=0 AND t.entity='global' AND t.uid=1 AND t.permission='superadmin' LIMIT 1
134 Query SELECT lime_participant_attribute_names.
FROM lime_participant_attribute_names
ORDER BY lime_participant_attribute_names.attribute_id
134 Query SELECT p.
, luser.full_name AS ownername, luser.users_name AS username, (SELECT count() survey
FROM lime_survey_links sl
WHERE sl.participant_id = p.participant_id) survey, attribute1.value AS a1
FROM lime_participants p
left join lime_users luser ON luser.uid=p.owner_uid
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
134 Query SELECT

FROM lime_participant_attribute_names_lang
WHERE attribute_id = '1'
134 Quit

reizformation

reizformation

2014-03-18 17:17

reporter   ~29352

when using "select all" (attributes) (not functional) mysql.log shows:

140318 17:15:52 136 Connect root@localhost on lime02
136 Query SET NAMES 'utf8'
136 Query SELECT FROM lime_plugins t WHERE t.active=1
136 Query SELECT
FROM lime_settings_global t
136 Query SELECT FROM lime_settings_global t WHERE t.stg_name='updatelastcheck' LIMIT 1
136 Query SELECT
FROM lime_permissions t WHERE t.entity_id=0 AND t.entity='global' AND t.uid=1 AND t.permission='superadmin' LIMIT 1
136 Query SELECT lime_participant_attribute_names.
FROM lime_participant_attribute_names
ORDER BY lime_participant_attribute_names.attribute_id
136 Query SELECT p.
, luser.full_name AS ownername, luser.users_name AS username, (SELECT count(*) survey
FROM lime_survey_links sl
WHERE sl.participant_id = p.participant_id) survey, attributem.value AS am, attribute1.value AS a1
FROM lime_participants p
left join lime_users luser ON luser.uid=p.owner_uid
LEFT JOIN lime_participant_attribute attributem ON attributem.participant_id=p.participant_id AND attributem.attribute_id=m
LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1
136 Quit

reizformation

reizformation

2014-03-18 17:19

reporter   ~29353

Browser shows:

CDbCommand failed to execute the SQL statement: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'm' in 'on clause'

the difference i found is:

LEFT JOIN lime_participant_attribute attributem ON attributem.participant_id=p.participant_id AND attributem.attribute_id=m

LEFT JOIN lime_participant_attribute attribute1 ON attribute1.participant_id=p.participant_id AND attribute1.attribute_id=1

reizformation

reizformation

2014-03-18 17:34

reporter   ~29355

reproducing the sql-query:

SELECT p., luser.full_name AS ownername, luser.users_name AS username, (SELECT count() survey
FROM lime_survey_links sl
WHERE sl.participant_id = p.participant_id) survey, attributem.value AS am, attribute1.value AS a1
FROM lime_participants p
left join lime_users luser ON luser.uid=p.owner_uid

shows: #1054 - Unknown column 'attributem.value' in 'field list'

reizformation

reizformation

2014-03-18 19:37

reporter   ~29359

$('#exportcsv').dialog({
modal: true,
title: count,
buttons: dialog_buttons,
width : 600,
height : 300,
open: function(event, ui) {
$('#attributes').multiselect({ includeSelectAllOption: true,
selectAllText: sSelectAllText,
nonSelectedText: sNonSelectedText,
nSelectedText: sNSelectedText,
maxHeight: 140 });

c_schmitz

c_schmitz

2014-03-19 12:31

administrator   ~29395

Fix committed to master branch: http://bugs.limesurvey.org/plugin.php?page=Source/view&id=14037

c_schmitz

c_schmitz

2014-03-19 14:34

administrator   ~29401

Thank you for your donation - that's very much appreciated!

c_schmitz

c_schmitz

2014-03-20 14:52

administrator   ~29451

2.05+ Build 140320 released

Related Changesets

LimeSurvey: master c5a4103f

2014-03-19 12:30

c_schmitz


Details Diff
Fixed issue 08873: csv export for participants fails if "all attributes" entry is selected Affected Issues
08873
mod - scripts/admin/participantpanel.js Diff File

Issue History

Date Modified Username Field Change
2014-03-18 12:20 reizformation New Issue
2014-03-18 12:20 reizformation File Added: exporttocsv_01.png
2014-03-18 12:21 reizformation Issue Monitored: reizformation
2014-03-18 17:15 reizformation Note Added: 29351
2014-03-18 17:17 reizformation Note Added: 29352
2014-03-18 17:19 reizformation Note Added: 29353
2014-03-18 17:34 reizformation Note Added: 29355
2014-03-18 19:37 reizformation Note Added: 29359
2014-03-18 20:25 reizformation Issue End Monitor: reizformation
2014-03-18 20:27 reizformation Issue Monitored: reizformation
2014-03-19 12:19 c_schmitz Assigned To => c_schmitz
2014-03-19 12:19 c_schmitz Status new => assigned
2014-03-19 12:31 c_schmitz Changeset attached => LimeSurvey master c5a4103f
2014-03-19 12:31 c_schmitz Note Added: 29395
2014-03-19 12:31 c_schmitz Resolution open => fixed
2014-03-19 12:31 c_schmitz Status assigned => resolved
2014-03-19 12:31 c_schmitz Fixed in Version => 2.05+
2014-03-19 14:34 c_schmitz Note Added: 29401
2014-03-20 14:52 c_schmitz Note Added: 29451
2014-03-20 14:52 c_schmitz Status resolved => closed
2021-08-03 10:29 guest Bug heat 4 => 6