From 34960a63fd692b7268e0033c7f0d6f5908e10ab1 Mon Sep 17 00:00:00 2001 From: Menno Dekker Date: Thu, 29 Nov 2012 15:57:27 +0100 Subject: [PATCH] Fixed #6984: Can't save edits to a response with MSSQL Server (Field Name's not wrapped) dev: also updated link to browse response --- application/controllers/admin/dataentry.php | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/application/controllers/admin/dataentry.php b/application/controllers/admin/dataentry.php index 37220754aa2..8b15701e31a 100644 --- a/application/controllers/admin/dataentry.php +++ b/application/controllers/admin/dataentry.php @@ -766,25 +766,25 @@ public function update() { if (isset($_POST['completed']) && ($_POST['completed']== "N")) { - $updateqr .= $q->fieldname." = NULL, \n"; //dbQuoteID($q->fieldname)." = NULL, \n"; + $updateqr .= dbQuoteID($q->fieldname) . " = NULL, \n"; } elseif (isset($_POST['completed']) && $thisvalue=="") { - $updateqr .= $q->fieldname." = '" . $_POST['completed'] . "', \n";// dbQuoteID($q->fieldname)." = " . dbQuoteAll($_POST['completed'],true) . ", \n"; + $updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($_POST['completed']) . ", \n"; } else { - $updateqr .= $q->fieldname." = '" . $thisvalue . "', \n"; //dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n"; + $updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue) . ", \n"; } } elseif(!is_a($q, 'QuestionModule')) { $thisvalue = $q->filter($thisvalue, 'dataentry'); - $updateqr .= $q->fieldname . ' = ' . $thisvalue == null ? 'NULL' : $thisvalue . ', \n'; + $updateqr .= dbQuoteID($q->fieldname) . ' = ' . $thisvalue == null ? 'NULL' : dbQuoteAll($thisvalue) . ', \n'; } else { - $updateqr .= $q->fieldname." = '" . $thisvalue . "', \n"; // dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue,true) . ", \n"; + $updateqr .= dbQuoteID($q->fieldname)." = " . dbQuoteAll($thisvalue) . ", \n"; } } $updateqr = substr($updateqr, 0, -3); @@ -792,7 +792,7 @@ public function update() $updateres = dbExecuteAssoc($updateqr) or safeDie("Update failed:
\n
$updateqr"); - $onerecord_link = $this->getController()->createUrl('/').'/admin/responses/index/surveyid/'.$surveyid.'/id/'.$id; + $onerecord_link = $this->getController()->createUrl('/').'/admin/responses/view/surveyid/'.$surveyid.'/id/'.$id; $allrecords_link = $this->getController()->createUrl('/').'/admin/responses/index/surveyid/'.$surveyid; $aDataentryoutput .= "
".$clang->gT("Success")."
\n" .$clang->gT("Record has been updated.")."

\n"