summaryrefslogtreecommitdiffstats
path: root/editclassifications.cgi
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2006-07-17 08:22:32 +0200
committerlpsolit%gmail.com <>2006-07-17 08:22:32 +0200
commit6a688141978ccd79300218f48cce9a42e1ad1a91 (patch)
treed36348c98eae0300a20ce80df04de331ce9cbba9 /editclassifications.cgi
parent324479e5c3f9fb77f85bfedee1e870f11076ee48 (diff)
downloadbugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.gz
bugzilla-6a688141978ccd79300218f48cce9a42e1ad1a91.tar.xz
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-xeditclassifications.cgi17
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);