Skip to content

Commit

Permalink
dev: fixed problem on import
Browse files Browse the repository at this point in the history
  • Loading branch information
mennodekker committed Dec 4, 2012
1 parent 7178354 commit 4f63f8a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 14 deletions.
2 changes: 1 addition & 1 deletion application/helpers/common_helper.php
Expand Up @@ -6245,7 +6245,7 @@ function translateInsertansTags($newsid,$oldsid,$fieldnames)
'surveyls_language' => $language
);

Surveys_languagesettings::model()->update($data,$where);
Surveys_languagesettings::model()->updateRecords($data,$where);

} // Enf if modified
} // end while qentry
Expand Down
35 changes: 22 additions & 13 deletions application/models/Surveys_languagesettings.php
Expand Up @@ -42,7 +42,7 @@ public function primaryKey()
* @static
* @access public
* @param string $class
* @return CActiveRecord
* @return Surveys_languagesettings
*/
public static function model($class = __CLASS__)
{
Expand Down Expand Up @@ -209,13 +209,21 @@ function getSurveyNames($surveyid)
return Yii::app()->db->createCommand()->select('surveyls_title')->from('{{surveys_languagesettings}}')->where('surveyls_language = :adminlang AND surveyls_survey_id = :surveyid')->bindParam(":adminlang", $lang, PDO::PARAM_STR)->bindParam(":surveyid", $surveyid, PDO::PARAM_INT)->queryAll();
}

function updateRecords($data,$condition=FALSE, $xssfiltering = false)
{
if ($condition != FALSE)
{
$this->db->where($condition);
}
/**
* Updates a single record identified by $condition with the
* key/value pairs in the $data array.
*
* @param type $data
* @param type $condition
* @param type $xssfiltering
* @return boolean
*/
function updateRecord($data,$condition='', $xssfiltering = false)
{
if (isset($data['surveyls_url']) && $data['surveyls_url']== 'http://') {$data['surveyls_url']="";}

/*
* Mdekker: don't think we need this anymore
if($xssfiltering)
{
$filter = new CHtmlPurifier();
Expand All @@ -232,14 +240,15 @@ function updateRecords($data,$condition=FALSE, $xssfiltering = false)
if (isset($data["endtext"]))
$data["endtext"] = $filter->purify($data["endtext"]);
}

$this->db->update('surveys_languagesettings',$data);

if ($this->db->affected_rows() <= 0)
*/

$record = $this->findByPk($condition);
foreach ($data as $key => $value)
{
return false;
$record->$key = $value;
}

$record->save($xssfiltering);

return true;
}

Expand Down

0 comments on commit 4f63f8a

Please sign in to comment.