Index: Bug.pm
===================================================================
RCS file: /cvsroot/mozilla/webtools/bugzilla/Bugzilla/Bug.pm,v
retrieving revision 1.272
diff -u -r1.272 Bug.pm
--- Bug.pm	9 Jan 2009 07:49:36 -0000	1.272
+++ Bug.pm	21 Jan 2009 01:52:00 -0500
@@ -2800,12 +2800,17 @@
 
 # XXX - When Bug::update() will be implemented, we should make this routine
 #       a private method.
+# Join with bug_status and bugs tables to show bugs with open statuses first,
+# and then the others
 sub EmitDependList {
     my ($myfield, $targetfield, $bug_id) = (@_);
     my $dbh = Bugzilla->dbh;
     my $list_ref = $dbh->selectcol_arrayref(
           "SELECT $targetfield FROM dependencies
-            WHERE $myfield = ? ORDER BY $targetfield",
+             INNER JOIN bugs ON $targetfield = bug_id
+             INNER JOIN bug_status ON bug_status = value
+            WHERE $myfield = ?
+            ORDER BY is_open DESC, $targetfield",
             undef, $bug_id);
     return $list_ref;
 }

