diff options
author | 2006-07-17 06:22:32 +0000 | |
---|---|---|
committer | 2006-07-17 06:22:32 +0000 | |
commit | 6a688141978ccd79300218f48cce9a42e1ad1a91 (patch) | |
tree | d36348c98eae0300a20ce80df04de331ce9cbba9 /editclassifications.cgi | |
parent | Bug 95923: Don't let users change fields they aren't allowed to change - Patc... (diff) | |
download | bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.gz bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.bz2 bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.zip |
Bug 277377: Classifications should support sort keys - Patch by Olav Vitters <bugzilla-mozilla@bkor.dhs.org> r=LpSolit a=justdave
Diffstat (limited to 'editclassifications.cgi')
-rwxr-xr-x | editclassifications.cgi | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/editclassifications.cgi b/editclassifications.cgi index 706d68918..6d75b67d2 100755 --- a/editclassifications.cgi +++ b/editclassifications.cgi @@ -108,12 +108,15 @@ if ($action eq 'new') { } my $description = trim($cgi->param('description') || ''); + my $sortkey = trim($cgi->param('sortkey') || 0); + trick_taint($description); trick_taint($class_name); + detaint_natural($sortkey); # Add the new classification. - $dbh->do("INSERT INTO classifications (name, description) - VALUES (?, ?)", undef, ($class_name, $description)); + $dbh->do("INSERT INTO classifications (name, description, sortkey) + VALUES (?, ?, ?)", undef, ($class_name, $description, $sortkey)); $vars->{'classification'} = $class_name; @@ -201,6 +204,7 @@ if ($action eq 'update') { my $class_old_name = trim($cgi->param('classificationold') || ''); my $description = trim($cgi->param('description') || ''); + my $sortkey = trim($cgi->param('sortkey') || 0); my $class_old = Bugzilla::Classification::check_classification($class_old_name); @@ -230,6 +234,15 @@ if ($action eq 'update') { $vars->{'updated_description'} = 1; } + if ($sortkey ne $class_old->sortkey) { + detaint_natural($sortkey); + $dbh->do("UPDATE classifications SET sortkey = ? + WHERE id = ?", undef, + ($sortkey, $class_old->id)); + + $vars->{'updated_sortkey'} = 1; + } + $dbh->bz_unlock_tables(); LoadTemplate($action); |