summaryrefslogtreecommitdiffstats
path: root/Bug.pm
diff options
context:
space:
mode:
authormyk%mozilla.org <>2002-07-04 08:07:09 +0200
committermyk%mozilla.org <>2002-07-04 08:07:09 +0200
commit46c9fb479d36e0a0b3fcbc447d7483ec09666d43 (patch)
tree35b145824f00cee436b84e31de58b4955927aa86 /Bug.pm
parent690839509f1ce985205824e8092d5893a2130ba6 (diff)
downloadbugzilla-46c9fb479d36e0a0b3fcbc447d7483ec09666d43.tar.gz
bugzilla-46c9fb479d36e0a0b3fcbc447d7483ec09666d43.tar.xz
Fix for bug 99203: Implements bug aliases feature.
r=bbaetz,jouni
Diffstat (limited to 'Bug.pm')
-rwxr-xr-xBug.pm13
1 files changed, 8 insertions, 5 deletions
diff --git a/Bug.pm b/Bug.pm
index 7ac2bd101..7e7478c46 100755
--- a/Bug.pm
+++ b/Bug.pm
@@ -33,7 +33,7 @@ package Bug;
use CGI::Carp qw(fatalsToBrowser);
my %ok_field;
-for my $key (qw (bug_id product version rep_platform op_sys bug_status
+for my $key (qw (bug_id alias product version rep_platform op_sys bug_status
resolution priority bug_severity component assigned_to
reporter bug_file_loc short_desc target_milestone
qa_contact status_whiteboard creation_ts groupset
@@ -74,9 +74,12 @@ sub initBug {
my $self = shift();
my ($bug_id, $user_id) = (@_);
+ # If the bug ID isn't numeric, it might be an alias, so try to convert it.
+ $bug_id = &::BugAliasToID($bug_id) if $bug_id !~ /^[1-9][0-9]*$/;
+
my $old_bug_id = $bug_id;
if ((! defined $bug_id) || (!$bug_id) || (!&::detaint_natural($bug_id))) {
- # no bug number given
+ # no bug number given or the alias didn't match a bug
$self->{'bug_id'} = $old_bug_id;
$self->{'error'} = "InvalidBugId";
return $self;
@@ -108,7 +111,7 @@ sub initBug {
my $query = "
select
- bugs.bug_id, product, version, rep_platform, op_sys, bug_status,
+ bugs.bug_id, alias, product, version, rep_platform, op_sys, bug_status,
resolution, priority, bug_severity, component, assigned_to, reporter,
bug_file_loc, short_desc, target_milestone, qa_contact,
status_whiteboard, date_format(creation_ts,'%Y-%m-%d %H:%i'),
@@ -123,7 +126,7 @@ sub initBug {
if (@row = &::FetchSQLData()) {
my $count = 0;
my %fields;
- foreach my $field ("bug_id", "product", "version", "rep_platform",
+ foreach my $field ("bug_id", "alias", "product", "version", "rep_platform",
"op_sys", "bug_status", "resolution", "priority",
"bug_severity", "component", "assigned_to", "reporter",
"bug_file_loc", "short_desc", "target_milestone",
@@ -248,7 +251,7 @@ sub emitXML {
$xml .= "<bug>\n";
- foreach my $field ("bug_id", "bug_status", "product",
+ foreach my $field ("bug_id", "alias", "bug_status", "product",
"priority", "version", "rep_platform", "assigned_to", "delta_ts",
"component", "reporter", "target_milestone", "bug_severity",
"creation_ts", "qa_contact", "op_sys", "resolution", "bug_file_loc",