Skip to content

Commit

Permalink
Fixed issue #6626: Editing of question groups not possible after addi…
Browse files Browse the repository at this point in the history
…ng a language to the survey and using MSSQL
  • Loading branch information
c-schmitz committed Oct 3, 2012
1 parent 670f352 commit 33f8bc1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 2 additions & 0 deletions application/controllers/admin/questiongroup.php
Expand Up @@ -309,7 +309,9 @@ public function edit($surveyid, $gid)
$group = new Groups;
foreach ($basesettings as $k => $v)
$group->$k = $v;
switchMSSQLIdentityInsert('groups', true);
$group->save();
switchMSSQLIdentityInsert('groups', false);
}
}
$first = true;
Expand Down
6 changes: 4 additions & 2 deletions application/helpers/common_helper.php
Expand Up @@ -6724,11 +6724,13 @@ function switchMSSQLIdentityInsert($table,$state)
{
if ($state == true)
{
Yii::app()->db->createCommand('SET IDENTITY_INSERT {{'.$table.'}} ON')->execute();
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' ON');
}
else
{
Yii::app()->db->createCommand('SET IDENTITY_INSERT {{'.$table.'}} OFF')->execute();
// This needs to be done directly on the PDO object because when using CdbCommand or similar it won't have any effect
Yii::app()->db->pdoInstance->exec('SET IDENTITY_INSERT '.Yii::app()->db->tablePrefix.$table.' OFF');
}
}
}
Expand Down

0 comments on commit 33f8bc1

Please sign in to comment.