Skip to content

Commit

Permalink
Fixed issue #13904: UTF-8 characters not correctly saved in survey te…
Browse files Browse the repository at this point in the history
…xts when using MSSQL DB
  • Loading branch information
c-schmitz committed May 23, 2019
1 parent 29adfaa commit 64ba8d4
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 18 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -13,7 +13,7 @@


$config['versionnumber'] = '3.17.3';
$config['dbversionnumber'] = 358;
$config['dbversionnumber'] = 359;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['assetsversionnumber'] = '30084';
Expand Down
23 changes: 23 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -2393,6 +2393,29 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
$oDB->createCommand()->update('{{settings_global}}', ['stg_value'=>358], "stg_name='DBVersion'");
$oTransaction->commit();
}

if ($iOldDBVersion < 359) {
$oTransaction = $oDB->beginTransaction();
alterColumn('{{notifications}}','message',"text",false);
alterColumn('{{settings_user}}','stg_value',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_description',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_welcometext',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_endtext',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_policy_notice',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_policy_error',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_url',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_email_invite',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_email_remind',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_email_register',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_email_confirm',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_attributecaptions',"text",true);
alterColumn('{{surveys_languagesettings}}','email_admin_notification',"text",true);
alterColumn('{{surveys_languagesettings}}','email_admin_responses',"text",true);
alterColumn('{{surveys_languagesettings}}','surveyls_numberformat',"integer",false,'0');
alterColumn('{{user_groups}}','description',"text",false);
$oDB->createCommand()->update('{{settings_global}}', ['stg_value'=>359], "stg_name='DBVersion'");
$oTransaction->commit();
}

} catch (Exception $e) {
Yii::app()->setConfig('Updating', false);
Expand Down
34 changes: 17 additions & 17 deletions installer/create-database.php
Expand Up @@ -166,7 +166,7 @@ function createDatabase($oDB){
'entity' => "string(15) NOT NULL ",
'entity_id' => "integer NOT NULL",
'title' => "string(255) NOT NULL",
'message' => "TEXT NOT NULL",
'message' => "text NOT NULL",
'status' => "string(15) NOT NULL DEFAULT 'new' ",
'importance' => "integer NOT NULL DEFAULT 1",
'display_class' => "string(31) DEFAULT 'default' ",
Expand Down Expand Up @@ -421,7 +421,7 @@ function createDatabase($oDB){
'entity' => "string(15) NULL",
'entity_id' => "string(31) NULL",
'stg_name' => "string(63) NOT NULL",
'stg_value' => "TEXT NULL",
'stg_value' => "text NULL",
));

$oDB->createCommand()->createIndex('{{idx1_settings_user}}', '{{settings_user}}', 'uid', false);
Expand Down Expand Up @@ -606,29 +606,29 @@ function createDatabase($oDB){
'surveyls_survey_id' => "integer NOT NULL",
'surveyls_language' => "string(45) NOT NULL DEFAULT 'en'",
'surveyls_title' => "string(200) NOT NULL",
'surveyls_description' => "TEXT NULL",
'surveyls_welcometext' => "TEXT NULL",
'surveyls_endtext' => "TEXT NULL",
'surveyls_policy_notice' => "TEXT NULL",
'surveyls_policy_error' => "TEXT NULL",
'surveyls_description' => "text NULL",
'surveyls_welcometext' => "text NULL",
'surveyls_endtext' => "text NULL",
'surveyls_policy_notice' => "text NULL",
'surveyls_policy_error' => "text NULL",
'surveyls_policy_notice_label' => 'string(192) NULL',
'surveyls_url' => "TEXT NULL",
'surveyls_url' => "text NULL",
'surveyls_urldescription' => "string(255) NULL",
'surveyls_email_invite_subj' => "string(255) NULL",
'surveyls_email_invite' => "TEXT NULL",
'surveyls_email_invite' => "text NULL",
'surveyls_email_remind_subj' => "string(255) NULL",
'surveyls_email_remind' => "TEXT NULL",
'surveyls_email_remind' => "text NULL",
'surveyls_email_register_subj' => "string(255) NULL",
'surveyls_email_register' => "TEXT NULL",
'surveyls_email_register' => "text NULL",
'surveyls_email_confirm_subj' => "string(255) NULL",
'surveyls_email_confirm' => "TEXT NULL",
'surveyls_email_confirm' => "text NULL",
'surveyls_dateformat' => "integer NOT NULL DEFAULT 1",
'surveyls_attributecaptions' => "TEXT NULL",
'surveyls_attributecaptions' => "text NULL",
'email_admin_notification_subj' => "string(255) NULL",
'email_admin_notification' => "TEXT NULL",
'email_admin_notification' => "text NULL",
'email_admin_responses_subj' => "string(255) NULL",
'email_admin_responses' => "TEXT NULL",
'surveyls_numberformat' => "INT NOT NULL DEFAULT 0",
'email_admin_responses' => "text NULL",
'surveyls_numberformat' => "integer NOT NULL DEFAULT 0",
'attachments' => "text NULL",
));

Expand Down Expand Up @@ -808,7 +808,7 @@ function createDatabase($oDB){
$oDB->createCommand()->createTable('{{user_groups}}', array(
'ugid' => "pk",
'name' => "string(20) NOT NULL",
'description' => "TEXT NOT NULL",
'description' => "text NOT NULL",
'owner_id' => "integer NOT NULL",
));

Expand Down

3 comments on commit 64ba8d4

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question : this depend on MSSQL version or First install version ? Because i don't have this issue in MSSQL 12 and 3.X install

@c-schmitz
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Depends on first install version. You can tell if the language settings fields are 'text' in MSSQL (which they should not be - they should be nvarchar(max) )

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok thank you :).
I know about nvarchar :) (now …) but don't have a real access to mssql test DB …

Please sign in to comment.