From b06a56e99c623093a15921546f68f8bc8f7ba75e Mon Sep 17 00:00:00 2001 From: "mkanat%bugzilla.org" <> Date: Wed, 2 Aug 2006 17:32:13 +0000 Subject: Bug 346932: Move settings creation/maintenance into Bugzilla::Install Patch By Max Kanat-Alexander (module owner) a=myk --- Bugzilla/User/Setting.pm | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) (limited to 'Bugzilla/User') diff --git a/Bugzilla/User/Setting.pm b/Bugzilla/User/Setting.pm index 450d20a7f..71aeb2ef4 100644 --- a/Bugzilla/User/Setting.pm +++ b/Bugzilla/User/Setting.pm @@ -130,9 +130,10 @@ sub add_setting { my $sth = $dbh->prepare(q{INSERT INTO setting_value (name, value, sortindex) VALUES (?, ?, ?)}); - my @values_list = keys %{$values}; - foreach my $key (@values_list){ - $sth->execute($name, $key, $values->{$key}); + my $sortindex = 5; + foreach my $key (@$values){ + $sth->execute($name, $key, $sortindex); + $sortindex += 5; } } @@ -307,17 +308,19 @@ $settings->{$setting_name} = new Bugzilla::User::Setting( =over 4 -=item C +=item C Description: Checks for the existence of a setting, and adds it to the database if it does not yet exist. + Params: C<$name> - string - the name of the new setting - C<$values> - hash - contains the new values (key) and - sortindexes for the new setting + C<$values> - arrayref - contains the new choices + for the new Setting. C<$default_value> - string - the site default + Returns: a pointer to a hash of settings -# -# + + =item C Description: Provides the user's choices for each setting in the -- cgit v1.2.3-24-g4f1b