Browse files

Fixed issue #14495: error with P type and comment suffix

Dev: Add rule to prevent comment suffix with P question
  • Loading branch information...
realitix authored and Shnoulle committed Feb 8, 2019
1 parent 450677a commit a47c09d18bf47b1205b5586d451ee6d2002cef4b
Showing with 4 additions and 0 deletions.
  1. +4 −0 application/models/Question.php
@@ -134,6 +134,10 @@ public function rules()
if ($oParentQuestion->other == "Y") {
$aRules[] = array('title', 'LSYii_CompareInsensitiveValidator', 'compareValue'=>'other', 'operator'=>'!=', 'message'=> sprintf(gT("'%s' can not be used if the 'Other' option for this question is activated."), "other"), 'except' => 'archiveimport');
// #14495: comment suffix can't be used with P Question (collapse with table name in database)
if ($oParentQuestion->type == "P") {
$aRules[] = array('title', 'match', 'pattern'=>'/.+comment$/', 'not'=>true, 'message'=> gT("'comment' suffix can not be used with question of type P."));
} else {
// Disallow other if sub question have 'other' for title
$oSubquestionOther = Question::model()->find("parent_qid=:parent_qid and LOWER(title)='other'", array("parent_qid"=>$this->qid));

0 comments on commit a47c09d

Please sign in to comment.