summaryrefslogtreecommitdiffstats
path: root/Bugzilla/Status.pm
diff options
context:
space:
mode:
authorlpsolit%gmail.com <>2007-06-14 23:25:41 +0200
committerlpsolit%gmail.com <>2007-06-14 23:25:41 +0200
commit80c5b6fadda4e77e5a48cd50e55cbe710a31ca83 (patch)
tree3c0e225a4810e080b2bc7f8ff3dc10485b92b267 /Bugzilla/Status.pm
parent836b976e508db4efa1775d0beb0704cb56f28695 (diff)
downloadbugzilla-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar.gz
bugzilla-80c5b6fadda4e77e5a48cd50e55cbe710a31ca83.tar.xz
Bug 344964: enter_bug.cgi should look at the custom status workflow to get the valid initial bug statuses - Patch by Frédéric Buclin <LpSolit@gmail.com> r=gerv a=justdave
Diffstat (limited to 'Bugzilla/Status.pm')
-rw-r--r--Bugzilla/Status.pm19
1 files changed, 15 insertions, 4 deletions
diff --git a/Bugzilla/Status.pm b/Bugzilla/Status.pm
index e83fd3533..e91f83871 100644
--- a/Bugzilla/Status.pm
+++ b/Bugzilla/Status.pm
@@ -58,14 +58,25 @@ sub can_change_to {
my $self = shift;
my $dbh = Bugzilla->dbh;
- if (!defined $self->{'can_change_to'}) {
- my $new_status_ids = $dbh->selectcol_arrayref('SELECT new_status
+ if (!ref($self) || !defined $self->{'can_change_to'}) {
+ my ($cond, @args);
+ if (ref($self)) {
+ $cond = '= ?';
+ push(@args, $self->id);
+ }
+ else {
+ $cond = 'IS NULL';
+ # Let's do it so that the code below works in all cases.
+ $self = {};
+ }
+
+ my $new_status_ids = $dbh->selectcol_arrayref("SELECT new_status
FROM status_workflow
INNER JOIN bug_status
ON id = new_status
WHERE isactive = 1
- AND old_status = ?',
- undef, $self->id);
+ AND old_status $cond",
+ undef, @args);
$self->{'can_change_to'} = Bugzilla::Status->new_from_list($new_status_ids);
}