Dependency Graph

Dependency Graph
related to related to child of child of duplicate of duplicate of

View Issue Details

This bug affects 1 person(s).
IDProjectCategoryView StatusLast Update
09208Bug reportsRemoteControlpublic2014-09-11 01:36
ReporterAccel Assigned Toc_schmitz  
Status closedResolutionfixed 
Product Version2.05+ 
Fixed in Version2.05+ 
Summary09208: function export_responses_by_token sometimes returns no data (empty Response) instead of completed surveyresponse

although the survey was completed, only an empty answer may be be returned
depending on user behavior

Steps To Reproduce

add a participant
invite this participant
participant clicks on link in invitation email
participant clicks next page
participant leaves without saving!
participant closes browser
participant clicks on link in invitation email 2nd time
now survey will be completed with saving

Additional Information

doing above steps, function export_responses
will respond this surveyresponse with appropriate token

using: export_responses_by_token (applying this token, DocumentType='doc')
will respond no Data! empty response

In survey-table there are 2 rows for this token:
First is not completed corresponding to above steps
Second with higher primary-id is completed

function export_responses returns correctly token and the second (higher) tid (primary id)

function export_responses_by_token seems to return the values of the first entry found, which is not completed. It should expand the where clause with 'completed <> null' (not null)

for my usage i made the following extension:
I added a changed function in remotecontrol_handle.php
function export_responses_by_id

It is a copy of function export_responses_by_token
and uses the tid instead of the token.
The tid is always unique and so it was the better way to retrieve a single response.

 * RPC Routine to export token response in a survey.
 * Returns the requested file as base64 encoded string
 * @access public
 * @param string $sSessionKey Auth credentials
 * @param int $iSurveyID Id of the Survey
 * @param string $sDocumentType pdf,csv,xls,doc,json
 * @param string $iTid Primary-Table-ID
 * @param string $sLanguageCode The language to be used
 * @param string $sCompletionStatus Optional 'complete','incomplete' or 'all' - defaults to 'all'
 * @param string $sHeadingType 'code','full' or 'abbreviated' Optional defaults to 'code'
 * @param string $sResponseType 'short' or 'long' Optional defaults to 'short'
 * @param array $aFields Optional Selected fields
 * @return array|string On success: Requested file as base 64-encoded string. On failure array with error information
public function export_responses_by_id($sSessionKey, $iSurveyID, $sDocumentType, $iTid, $sLanguageCode=null, $sCompletionStatus='all', $sHeadingType='code', $sResponseType='short', $aFields=null)
    if (!$this->_checkSessionKey($sSessionKey)) return array('status' => 'Invalid session key');
    if (!Permission::model()->hasSurveyPermission($iSurveyID, 'responses', 'export')) return array('status' => 'No permission');
    if (!tableExists('{{survey_' . $iSurveyID . '}}')) return array('status' => 'No Data');
    if(!$oResult = SurveyDynamic::model($iSurveyID)->findByAttributes(array('id' => $iTid))) return array('status' => 'No Response found for Tid');
    if ($oResult['id'])
        return $this->export_responses($sSessionKey, $iSurveyID, $sDocumentType, $sLanguageCode, $sCompletionStatus, $sHeadingType, $sResponseType, $oResult['id'], $oResult['id'], $aFields);
TagsNo tags attached.
Bug heat2
Complete LimeSurvey version number (& build)Build 140811
I will donate to the project if issue is resolvedNo
Database type & versionna
Server OS (if known)na
Webserver software & version (if known)na
PHP Versionna


related to 09209 closedc_schmitz JSON-RPC API : export_responses_by_token 




2014-09-11 01:20

administrator   ~30546

Fix committed to master branch:;id=14477



2014-09-11 01:36

administrator   ~30547

2.05 Build 140911 released.

Related Changesets

LimeSurvey: master f8d5d614

2014-09-10 23:19:56


Details Diff
Fixed issue 09208: RemoteControl function export_responses_by_token ignores completion status when several responses for the same token exist Affected Issues
mod - application/helpers/remotecontrol/remotecontrol_handle.php Diff File

Issue History

Date Modified Username Field Change
2014-09-03 12:25 Accel New Issue
2014-09-08 10:51 DenisChenu Relationship added related to 09209
2014-09-11 01:18 c_schmitz Assigned To => c_schmitz
2014-09-11 01:18 c_schmitz Status new => assigned
2014-09-11 01:20 c_schmitz Changeset attached => LimeSurvey master f8d5d614
2014-09-11 01:20 c_schmitz Note Added: 30546
2014-09-11 01:20 c_schmitz Resolution open => fixed
2014-09-11 01:20 c_schmitz Status assigned => resolved
2014-09-11 01:20 c_schmitz Fixed in Version => 2.05+
2014-09-11 01:36 c_schmitz Note Added: 30547
2014-09-11 01:36 c_schmitz Status resolved => closed