Skip to content

Commit

Permalink
Fixed issue #10144: Don't compare int with char - PostgreSQL won't li…
Browse files Browse the repository at this point in the history
…ke it; also some error messages fixes
  • Loading branch information
olleharstedt committed Dec 17, 2015
1 parent ab91d57 commit d9adc97
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 7 deletions.
1 change: 1 addition & 0 deletions application/controllers/AdminController.php
Expand Up @@ -54,6 +54,7 @@ protected function _init()
*/
public function error($message, $sURL = array())
{
define('IMAGE_BASE_URL', Yii::app()->getConfig('adminimagebaseurl'));

$this->_getAdminHeader();
$sOutput = "<div class='messagebox ui-corner-all'>\n";
Expand Down
11 changes: 7 additions & 4 deletions application/controllers/admin/index.php
Expand Up @@ -26,11 +26,12 @@ public function run()
// We get the last survey visited by user
$setting_entry = 'last_survey_'.Yii::app()->user->getId();
$lastsurvey = getGlobalSetting($setting_entry);
if( $lastsurvey != null)
$survey = Survey::model()->findByPk($lastsurvey);
if( $lastsurvey != null && $survey)
{
$aData['showLastSurvey'] = true;
$iSurveyID = $lastsurvey;
$surveyinfo = Survey::model()->findByPk($iSurveyID)->surveyinfo;
$surveyinfo = $survey->surveyinfo;
$aData['surveyTitle'] = $surveyinfo['surveyls_title']."(".gT("ID").":".$iSurveyID.")";
$aData['surveyUrl'] = $this->getController()->createUrl("admin/survey/sa/view/surveyid/{$iSurveyID}");
}
Expand All @@ -51,9 +52,9 @@ public function run()
$setting_entry = 'last_question_sid_'.Yii::app()->user->getId();
$lastquestionsid = getGlobalSetting($setting_entry);

if( $lastquestion != null && $lastquestiongroup != null)
if( $lastquestion != null && $lastquestiongroup != null && $survey)
{
$baselang = Survey::model()->findByPk($iSurveyID)->language;
$baselang = $survey->language;
$aData['showLastQuestion'] = true;
$qid = $lastquestion;
$gid = $lastquestiongroup;
Expand All @@ -62,7 +63,9 @@ public function run()

$aData['last_question_name'] = $qrrow['title'];
if($qrrow['question'])
{
$aData['last_question_name'] .= ' : '.$qrrow['question'];
}

$aData['last_question_link'] = $this->getController()->createUrl("admin/questions/sa/view/surveyid/$iSurveyID/gid/$gid/qid/$qid");
}
Expand Down
2 changes: 1 addition & 1 deletion application/controllers/admin/surveyadmin.php
Expand Up @@ -934,7 +934,7 @@ public function delete($iSurveyID)
$lastQuestionGidUser = 'last_question_gid_'.Yii::app()->user->getId();
$lastQuestionUser = 'last_question_'.Yii::app()->user->getId();
SettingGlobal::model()->deleteAll(
"stg_name LIKE :stg_name OR stg_name = :last_question_gid_user OR stg_name = :last_question_user OR stg_value = :stg_value",
"stg_name LIKE ':stg_name' OR stg_name = ':last_question_gid_user' OR stg_name = ':last_question_user' OR stg_value = ':stg_value'",
array(':stg_name' => $lastLikeSurvey, ':last_question_gid_user' => $lastQuestionGidUser, ':last_question_user' => $lastQuestionUser , ':stg_value' => $iSurveyID )
);

Expand Down
6 changes: 4 additions & 2 deletions application/core/Survey_Common_Action.php
Expand Up @@ -66,11 +66,13 @@ public function runWithParams($params)
{
if(!Survey::model()->findByPk($params['iSurveyId']))
{
$this->getController()->error('Invalid A survey id');
Yii::app()->setFlashMessage(gT("Invalid survey id"),'error');
$this->getController()->redirect(array("admin/index"));
}
elseif (!Permission::model()->hasSurveyPermission($params['iSurveyId'], 'survey', 'read'))
{
$this->getController()->error('No permission');
Yii::app()->setFlashMessage(gT("No permission"), 'error');
$this->getController()->redirect(array("admin/index"));
}
else
{
Expand Down

0 comments on commit d9adc97

Please sign in to comment.