diff --git a/application/helpers/update/updatedb_helper.php b/application/helpers/update/updatedb_helper.php index 2d1b6d10844..d7f7370c428 100644 --- a/application/helpers/update/updatedb_helper.php +++ b/application/helpers/update/updatedb_helper.php @@ -3570,18 +3570,58 @@ function createSurveysGroupSettingsTable(CDbConnection $oDB) $oDB->createCommand()->insert("{{surveys_groupsettings}}", $attributes); + //this will fail because of using model in updatedb_helper ... // insert settings for default survey group - $settings2 = new SurveysGroupsettings; - $settings2->setToInherit(); - $settings2->gsid = 1; - - // Quick hack to remote ipanonymize. - // TODO: Don't use models in updatedb_helper. ok - $attributes = $settings2->attributes; - unset($attributes['ipanonymize']); - - $oDB->createCommand()->insert("{{surveys_groupsettings}}", $attributes); - + //$settings2 = new SurveysGroupsettings; + //$settings2->gsid = 1; + //$settings2->setToInherit(); //we can not use this function because of ipanonymize (again: never use models in update_helper) + + $attributes2 = array( + "gsid" => 1, + "owner_id" => -1, + "admin" => "inherit", + "adminemail" => "inherit", + "anonymized" => "I", + "format" => "I", + "savetimings" => "I", + "template" => "inherit", + "datestamp" => "I", + "usecookie" => "I", + "allowregister" => "I", + "allowsave" => "I", + "autonumber_start" => 0, + "autoredirect" => "I", + "allowprev" => "I", + "printanswers" => "I", + "ipaddr" => "I", + "refurl" => "I", + "showsurveypolicynotice" => 0, + "publicstatistics" => "I", + "publicgraphs" => "I", + "listpublic" => "I", + "htmlemail" => "I", + "sendconfirmation" => "I", + "tokenanswerspersistence" => "I", + "assessments" => "I", + "usecaptcha" => "E", + "bounce_email" => "inherit", + "attributedescriptions" => NULL, + "emailresponseto" => "inherit", + "emailnotificationto" => "inherit", + "tokenlength" => -1, + "showxquestions" => "I", + "showgroupinfo" => "I", + "shownoanswer" => "I", + "showqnumcode" => "I", + "showwelcome" => "I", + "showprogress" => "I", + "questionindex" => -1, + "navigationdelay" => -1, + "nokeyboard" => "I", + "alloweditaftercompletion" => "I", + ); + + $oDB->createCommand()->insert("{{surveys_groupsettings}}", $attributes2); } /** * @param CDbConnection $oDB diff --git a/application/models/SurveysGroupsettings.php b/application/models/SurveysGroupsettings.php index 6228d512548..324ae8277d4 100644 --- a/application/models/SurveysGroupsettings.php +++ b/application/models/SurveysGroupsettings.php @@ -437,7 +437,11 @@ public function setToInherit() $this->$attribute = -1; } foreach ($this->optionAttributesChar as $attribute){ - $this->$attribute = 'I'; + //fix for 16179 + $dbversion = GetGlobalSetting('DBVersion'); + if( !($attribute==='ipanonymize' && ( $dbversion < 412 ))){ + $this->$attribute = 'I'; + } } foreach ($this->optionAttributesText as $attribute){ $this->$attribute = 'inherit';