Skip to content

Commit

Permalink
Fixed issue #10952: Conditions do not show up in conditions designer …
Browse files Browse the repository at this point in the history
…after creation if using MSSQL and connecting from Linux using FreeTDS
  • Loading branch information
c-schmitz committed Jun 10, 2016
1 parent 51812ba commit cc4b29d
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions application/controllers/admin/conditionsaction.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
*
*/
/**
* Condition Controller
* Condition Controller
*
* This controller performs token actions
*
Expand Down Expand Up @@ -1192,7 +1192,6 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
$aData['scenariocount'] = $scenariocount;

$aViewUrls['conditionslist_view'][] = $aData;

if ($scenariocount > 0)
{
$this->registerScriptFile( 'ADMIN_SCRIPT_PATH', 'checkgroup.js');
Expand Down Expand Up @@ -1265,6 +1264,7 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
->bindValue(":lang2", $sLanguage, PDO::PARAM_STR)
->queryRow();
$conditionscount=(int)$result['recordcount'];

$query = "SELECT c.cid, c.scenario, c.cqid, c.cfieldname, c.method, c.value, q.type
FROM {{conditions}} c, {{questions}} q, {{groups}} g
WHERE c.cqid=q.qid "
Expand All @@ -1277,13 +1277,13 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
."AND c.cfieldname NOT LIKE '{%' " // avoid catching SRCtokenAttr conditions
."ORDER BY g.group_order, q.question_order, c.cfieldname";
$sLanguage=Survey::model()->findByPk($iSurveyID)->language;
$result=Yii::app()->db->createCommand($query)
$result2=Yii::app()->db->createCommand($query)
->bindValue(":scenario", $scenarionr['scenario'])
->bindValue(":qid", $qid, PDO::PARAM_INT)
->bindValue(":lang1", $sLanguage, PDO::PARAM_STR)
->bindValue(":lang2", $sLanguage, PDO::PARAM_STR)
->query() or safeDie ("Couldn't get other conditions for question $qid<br />$query<br />");

$result2=$result2->readAll();
$querytoken = "SELECT count(*) as recordcount "
."FROM {{conditions}} "
."WHERE "
Expand Down Expand Up @@ -1326,11 +1326,10 @@ function index($subaction, $iSurveyID=null, $gid=null, $qid=null)
{
$aConditionsMerged[]=$arow;
}
foreach ($result->readAll() as $arow)
foreach ($result2 as $arow)
{
$aConditionsMerged[]=$arow;
}

foreach ($aConditionsMerged as $rows)
{
if($rows['method'] == "") {$rows['method'] = "==";} //Fill in the empty method from previous versions
Expand Down

0 comments on commit cc4b29d

Please sign in to comment.