Skip to content

Commit

Permalink
Dev: Fixed some mistakes in previous commit
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/limesurvey_yii@11944 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
Gaurav Narula committed Jan 8, 2012
1 parent d735025 commit 816d25e
Showing 1 changed file with 13 additions and 9 deletions.
22 changes: 13 additions & 9 deletions application/controllers/admin/question.php
Expand Up @@ -452,13 +452,13 @@ public function _editsubquestion($surveyid, $gid, $qid)

for ($iScale = 0; $iScale < $iScaleCount; $iScale++)
{
$subquestiondata = Questions::model()->findByAttributes(array(
$subquestiondata = Questions::model()->findAllByAttributes(array(
'parent_qid' => $qid,
'language' => $baselang,
'scale_id' => $iScale
));

if (is_null($subquestiondata))
if (empty($subquestiondata))
{
Questions::model()->insert(array(
'sid' => $surveyid,
Expand All @@ -471,7 +471,7 @@ public function _editsubquestion($surveyid, $gid, $qid)
'scale_id' => $iScale,
));

$subquestiondata = Questions::model()->findByAttributes(array(
$subquestiondata = Questions::model()->findAllByAttributes(array(
'parent_qid' => $qid,
'language' => $baselang,
'scale_id' => $iScale
Expand All @@ -480,14 +480,18 @@ public function _editsubquestion($surveyid, $gid, $qid)

// Check that there are subquestions for every language supported by the survey
foreach ($anslangs as $language)
{
{
foreach ($subquestiondata as $row)
{
$qrow = Questions::model()->count(array(
'parent_qid' => $qid,
'language' => $language,
'qid' => $row->qid,
'scale_id' => $iScale
$qrow = Questions::model()->count('
parent_qid = :qid AND
language = :language AND
qid = '.$row->qid.' AND
scale_id = :iScale',
array(
':qid' => $qid,
':language' => $language,
':iScale' => $iScale
));

// Means that no record for the language exists in the questions table
Expand Down

0 comments on commit 816d25e

Please sign in to comment.