From 6a688141978ccd79300218f48cce9a42e1ad1a91 Mon Sep 17 00:00:00 2001 From: "lpsolit%gmail.com" <> Date: Mon, 17 Jul 2006 06:22:32 +0000 Subject: Bug 277377: Classifications should support sort keys - Patch by Olav Vitters r=LpSolit a=justdave --- editclassifications.cgi | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'editclassifications.cgi') 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); -- cgit v1.2.3-24-g4f1b