Skip to content

Commit

Permalink
Fixed issue : datestamp on not date stamped survey.
Browse files Browse the repository at this point in the history
Dev: use 1980-01-01 for 'All database same value'
  • Loading branch information
Shnoulle committed May 14, 2012
1 parent 1a9fdcb commit f8baf03
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions classes/expressions/LimeExpressionManager.php
Expand Up @@ -3880,19 +3880,25 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false,$setSub
}

$message = '';
$_SESSION['datestamp']=date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $this->surveyOptions['timeadjust']);
if($this->surveyOptions['datestamp']=='Y')
{
$datestamp=date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $this->surveyOptions['timeadjust']);
}
else
{
$datestamp=date("Y-m-d H:i:s",mktime(0,0,0,1,1,1980));
}
$_SESSION['datestamp']=$datestamp;
if ($this->surveyOptions['active'] && !isset($_SESSION['srid']))
{
// Create initial insert row for this record
$today = date_shift(date("Y-m-d H:i:s"), "Y-m-d H:i:s", $this->surveyOptions['timeadjust']);
$sdata = array(
"datestamp"=>$today,
"datestamp"=>$datestamp,
"ipaddr"=>(($this->surveyOptions['ipaddr'] && !$this->surveyOptions['anonymized']) ? getIPAddress() : ''),
"startlanguage"=>$this->surveyOptions['startlanguage'],
"token"=>($this->surveyOptions['token']),
"datestamp"=>($this->surveyOptions['datestamp'] ? $_SESSION['datestamp'] : NULL),
"refurl"=>(($this->surveyOptions['refurl'] && !$this->surveyOptions['anonymized']) ? getenv("HTTP_REFERER") : NULL),
"startdate"=>($this->surveyOptions['datestamp'] ? $_SESSION['datestamp'] : date("Y-m-d H:i:s",0)),
"startdate"=>$datestamp,
);
//One of the strengths of ADOdb's AutoExecute() is that only valid field names for $table are updated
if ($connect->AutoExecute($this->surveyOptions['tablename'], $sdata,'INSERT')) // Checked
Expand Down Expand Up @@ -4040,7 +4046,7 @@ private function _UpdateValuesInDatabase($updatedValues, $finished=false,$setSub
{
if ($finished) {
$sQuery = 'UPDATE '.$this->surveyOptions['tablename'] . " SET "
.db_quote_id('submitdate') . "=" . db_quoteall($_SESSION['datestamp'])
.db_quote_id('submitdate') . "=" . db_quoteall($datestamp)
." WHERE ID=".$_SESSION['srid'];
$connect->Execute($sQuery); // Checked
}
Expand Down

0 comments on commit f8baf03

Please sign in to comment.