Skip to content

Commit

Permalink
Fixed issue #16782: Survey groups : theme options: same theme name ap…
Browse files Browse the repository at this point in the history
…pear multiple time in list (#1823)
  • Loading branch information
gabrieljenik committed Apr 9, 2021
1 parent 710cb43 commit 6713f7f
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
2 changes: 1 addition & 1 deletion application/config/version.php
Expand Up @@ -12,7 +12,7 @@
*/

$config['versionnumber'] = '4.4.16';
$config['dbversionnumber'] = 443;
$config['dbversionnumber'] = 444;
$config['buildnumber'] = '';
$config['updatable'] = true;
$config['templateapiversion'] = 3;
Expand Down
17 changes: 17 additions & 0 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -3783,12 +3783,29 @@ function ($v) {
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 442), "stg_name='DBVersion'");
$oTransaction->commit();
}

if ($iOldDBVersion < 443) {
$oTransaction = $oDB->beginTransaction();
$oDB->createCommand()->renameColumn('{{users}}', 'lastLogin', 'last_login');
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 443), "stg_name='DBVersion'");
$oTransaction->commit();
}

if ($iOldDBVersion < 444) {
$oTransaction = $oDB->beginTransaction();
// Delete duplicate template configurations
$deleteQuery = "DELETE FROM {{template_configuration}}
WHERE id NOT IN (
SELECT id FROM (
SELECT MIN(id) as id
FROM {{template_configuration}} t
GROUP BY t.template_name, t.sid, t.gsid, t.uid

This comment has been minimized.

Copy link
@Shnoulle

Shnoulle Apr 9, 2021

Collaborator

With PG or MS : GROUP BY part must be in select or something like that. Someone check it work on different SQL than mysql ?

) x
)";
$oDB->createCommand($deleteQuery)->execute();
$oDB->createCommand()->update('{{settings_global}}', array('stg_value' => 444), "stg_name='DBVersion'");
$oTransaction->commit();
}
} catch (Exception $e) {
Yii::app()->setConfig('Updating', false);
$oTransaction->rollback();
Expand Down
2 changes: 1 addition & 1 deletion application/models/TemplateConfiguration.php
Expand Up @@ -345,7 +345,7 @@ public static function checkAndcreateSurveyConfig($iSurveyId)
{
//if a template name is given also check against that
$oSurvey = Survey::model()->findByPk($iSurveyId);
$sTemplateName = $oSurvey->template;
$sTemplateName = $oSurvey->oOptions->template;
$iSurveyGroupId = $oSurvey->gsid;

$criteria = new CDbCriteria();
Expand Down

0 comments on commit 6713f7f

Please sign in to comment.