diff options
author | lpsolit%gmail.com <> | 2006-12-12 03:00:46 +0100 |
---|---|---|
committer | lpsolit%gmail.com <> | 2006-12-12 03:00:46 +0100 |
commit | 32f3ff65a8019fded30601f59f37306312576547 (patch) | |
tree | 3a5a3df17a0f49ab2b4dc32906238eaeb02eafbf /Bugzilla/User/Setting.pm | |
parent | 36540893adb1efd1a1fce5f2e115754f93442ca5 (diff) | |
download | bugzilla-32f3ff65a8019fded30601f59f37306312576547.tar.gz bugzilla-32f3ff65a8019fded30601f59f37306312576547.tar.xz |
Bug 297186: Send emails in the recipient's locale, not the current user's - Patch by Frédéric Buclin <LpSolit@gmail.com> r=bkor a=justdave
Diffstat (limited to 'Bugzilla/User/Setting.pm')
-rw-r--r-- | Bugzilla/User/Setting.pm | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm index ad39d194b..bdc653b97 100644 --- a/Bugzilla/User/Setting.pm +++ b/Bugzilla/User/Setting.pm @@ -15,7 +15,7 @@ # Contributor(s): Shane H. W. Travis <travis@sedsystems.ca> # Max Kanat-Alexander <mkanat@bugzilla.org> # Marc Schumann <wurblzap@gmail.com> -# +# Frédéric Buclin <LpSolit@gmail.com> package Bugzilla::User::Setting; @@ -128,15 +128,28 @@ sub new { ############################### sub add_setting { - my ($name, $values, $default_value, $subclass) = @_; + my ($name, $values, $default_value, $subclass, $force_check) = @_; my $dbh = Bugzilla->dbh; - return if _setting_exists($name); + my $exists = _setting_exists($name); + return if ($exists && !$force_check); ($name && $default_value) || ThrowCodeError("setting_info_invalid"); - print get_text('install_setting_new', { name => $name }) . "\n"; + if ($exists) { + # If this setting exists, we delete it and regenerate it. + $dbh->do('DELETE FROM setting_value WHERE name = ?', undef, $name); + $dbh->do('DELETE FROM setting WHERE name = ?', undef, $name); + # Remove obsolete user preferences for this setting. + my $list = join(', ', map {$dbh->quote($_)} @$values); + $dbh->do("DELETE FROM profile_setting + WHERE setting_name = ? AND setting_value NOT IN ($list)", + undef, $name); + } + else { + print get_text('install_setting_new', { name => $name }) . "\n"; + } $dbh->do(q{INSERT INTO setting (name, default_value, is_enabled, subclass) VALUES (?, ?, 1, ?)}, undef, ($name, $default_value, $subclass)); |