Skip to content

Commit

Permalink
Merge branch 'master' of github.com:LimeSurvey/LimeSurvey
Browse files Browse the repository at this point in the history
  • Loading branch information
Shnoulle committed Feb 11, 2016
2 parents b39e2ee + 8a16254 commit e53173f
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions application/models/Survey.php
Expand Up @@ -771,7 +771,7 @@ public function search()

$criteria = new CDbCriteria;

// select
// Answers
$criteria->select = array(
'*',
$this->getCountFullAnswers() . " as full_answers_account",
Expand All @@ -787,17 +787,20 @@ public function search()
$criteria->condition = 'permissions.read_p=1';
$criteria->params=(array(':userid'=>Yii::app()->user->id ));


// Wrong concatenation...
// TODO : subcriterias....
$criteria->compare('t.active', $this->active, true, 'AND');
$criteria->compare('surveys_languagesettings.surveyls_title', $this->searched_value, true, 'AND');
// Search filter
$criteria2 = new CDbCriteria;
$sid_reference = (Yii::app()->db->getDriverName() == 'pgsql' ?' t.sid::varchar' : 't.sid');
$criteria->compare($sid_reference, $this->searched_value, true, 'OR');
$criteria->compare('t.admin', $this->searched_value, true, 'OR');
$criteria2->compare($sid_reference, $this->searched_value, true, 'OR');
$criteria2->compare('surveys_languagesettings.surveyls_title', $this->searched_value, true, 'OR');
$criteria2->compare('t.admin', $this->searched_value, true, 'OR');

// Active filter
if(isset($this->active))
{
$criteria->addCondition("t.active='$this->active'");
}

//!Permission::model()->hasSurveyPermission($params['iSurveyId'], 'survey', 'read');
$criteria->mergeWith($criteria2, 'AND');

$dataProvider=new CActiveDataProvider('Survey', array(
'sort'=>$sort,
Expand Down

0 comments on commit e53173f

Please sign in to comment.