Skip to content

Commit

Permalink
Fix UpdateModuleSetting in ModuleController (#3360)
Browse files Browse the repository at this point in the history
Ref. issue #2868
  • Loading branch information
engineering87 authored and valadas committed Dec 30, 2019
1 parent cfbac7c commit b1fea62
Showing 1 changed file with 14 additions and 16 deletions.
30 changes: 14 additions & 16 deletions DNN Platform/Library/Entities/Modules/ModuleController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -798,30 +798,28 @@ private void UpdateModuleSettingInternal(int moduleId, string settingName, strin
var currentUser = UserController.Instance.GetCurrentUserInfo();
dr = dataProvider.GetModuleSetting(moduleId, settingName);

var settingExist = false;
string existValue = null;
if (dr.Read())
{
settingExist = true;
existValue = dr.GetString(1);
}

dr.Close();

if (existValue != settingValue)
{
dataProvider.UpdateModuleSetting(moduleId, settingName, settingValue, currentUser.UserID);
EventLogController.AddSettingLog(EventLogController.EventLogType.MODULE_SETTING_UPDATED,
"ModuleId", moduleId, settingName, settingValue,
currentUser.UserID);
}
else if (!settingExist)
{
dataProvider.UpdateModuleSetting(moduleId, settingName, settingValue, currentUser.UserID);
EventLogController.AddSettingLog(EventLogController.EventLogType.MODULE_SETTING_CREATED,
"ModuleId", moduleId, settingName, settingValue,
currentUser.UserID);
}
if (existValue == null)
{
dataProvider.UpdateModuleSetting(moduleId, settingName, settingValue, currentUser.UserID);
EventLogController.AddSettingLog(EventLogController.EventLogType.MODULE_SETTING_CREATED,
"ModuleId", moduleId, settingName, settingValue,
currentUser.UserID);
}
else if (existValue != settingValue)
{
dataProvider.UpdateModuleSetting(moduleId, settingName, settingValue, currentUser.UserID);
EventLogController.AddSettingLog(EventLogController.EventLogType.MODULE_SETTING_UPDATED,
"ModuleId", moduleId, settingName, settingValue,
currentUser.UserID);
}

if (updateVersion)
{
Expand Down

0 comments on commit b1fea62

Please sign in to comment.