Skip to content

Commit

Permalink
Fixed issue: Survey list not working properly when a survey has no pr…
Browse files Browse the repository at this point in the history
…oper owner.

Dev On upgrade from an earlier version all invalid owner IDs are fixed
  • Loading branch information
c-schmitz committed May 23, 2012
1 parent a15323e commit 6e7a530
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions application/helpers/update/upgrade-all_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,21 @@ function db_upgrade_all($oldversion) {
);
Yii::app()->db->createCommand()->createTable('{{expression_errors}}',$fields);
}
if ($oldversion < 156)
{
// If a survey has an deleted owner, re-own the survey to the superadmin
$surveys = Survey::model();
$surveys = $surveys->with(array('owner'))->findAll();
foreach ($surveys as $row)
{
if (!isset($row->owner->attributes))
{
Survey::model()->updateByPk($row->sid,array('owner_id'=>1));
}
}

}

}

function upgrade_question_attributes148()
Expand Down

0 comments on commit 6e7a530

Please sign in to comment.