View Issue Details

This bug affects 1 person(s).
 2
IDProjectCategoryView StatusLast Update
08596Feature requestsRemoteControlpublic2014-09-11 22:46
ReporterSpydre13 Assigned Toc_schmitz  
PrioritynormalSeverityfeature 
Status closedResolutionfixed 
Summary08596: Use add_response to prefill answers (submitdate should be null)
Description

I would like to do this instead of passing in answers on the URL. This currently doesn't work because in the add_response() function in application/helpers/remotecontrol/remotecontrol_handle.php (around line 2186) it checks if 'submitdate' is not set, and if it's not it gets set to the current time assuming the response is completed.

In order to do this it seems like there are a couple options:
1) Don't assume the response has been submitted if it isn't specified
2) Still set submitdate to current time if it isn't specified, but if 'submitdate' is passed as null or empty it should be removed from $aResponseData

Currently if you pass in null or '' for the value, the submitdate gets set to all zeros. I think this code could work instead, which would be option #2:

if (array_key_exists('submitdate', $aResponseData) && empty($aResponseData['submitdate']))
unset($aResponseData['submitdate'];
else if (!isset($aResponseData['submitdate']))
$aResponseData['submitdate'] = date("Y-m-d H:i:s");

I have tested this code and it seems to work fine. Same could be done for datestamp and startdate, although those don't matter as much to me. Does this sound reasonable?

TagsNo tags attached.
Attached Files
remotecontrol_handle.diff (866 bytes)   
--- application/helpers/remotecontrol/remotecontrol_handle.php.bak	2014-01-16 10:33:30.000000000 -0500
+++ application/helpers/remotecontrol/remotecontrol_handle.php	2014-01-25 00:46:08.668829243 -0500
@@ -2183,7 +2183,9 @@
             //set required values if not set
 
             // @todo: Some of this is part of the validation and should be done in the model instead
-            if (!isset($aResponseData['submitdate']))
+            if (array_key_exists('submitdate', $aResponseData) && empty($aResponseData['submitdate']))
+                unset($aResponseData['submitdate']);
+            else if (!isset($aResponseData['submitdate']))
                 $aResponseData['submitdate'] = date("Y-m-d H:i:s");
             if (!isset($aResponseData['startlanguage']))
                 $aResponseData['startlanguage'] = getBaseLanguageFromSurveyID($iSurveyID);
remotecontrol_handle.diff (866 bytes)   
Bug heat2
Story point estimate
Users affected %

Users monitoring this issue

Spydre13

Activities

Issue History

Date Modified Username Field Change
2014-01-25 06:40 Spydre13 New Issue
2014-01-25 06:52 Spydre13 File Added: remotecontrol_handle.diff
2014-02-01 06:08 Spydre13 Issue Monitored: Spydre13
2014-03-26 20:48 c_schmitz Assigned To => c_schmitz
2014-03-26 20:48 c_schmitz Status new => assigned
2014-09-11 22:46 c_schmitz Status assigned => closed
2014-09-11 22:46 c_schmitz Resolution open => fixed
2014-09-11 22:46 c_schmitz Fixed in Version => 2.05+
2021-08-02 17:20 guest Bug heat 0 => 2