]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Fix for bug 30731 - Reassigning closed bugs from the mass change page caused their...
authorjake%acutex.net <>
Sat, 15 Sep 2001 04:50:07 +0000 (04:50 +0000)
committerjake%acutex.net <>
Sat, 15 Sep 2001 04:50:07 +0000 (04:50 +0000)
r= myk@mozilla.org, zach@zachlipton.com

globals.pl
process_bug.cgi

index af3c26a3de3189207bcddd9b408e06ea511c0c92..6dba9c720479ee407102b3c33c828f50dbeff5f8 100644 (file)
@@ -1171,12 +1171,19 @@ sub GroupIsActive {
 
 sub IsOpenedState {
     my ($state) = (@_);
-    if ($state =~ /^(NEW|REOPENED|ASSIGNED)$/ || $state eq $::unconfirmedstate) {
+    if (grep($_ eq $state, OpenStates())) {
         return 1;
     }
     return 0;
 }
 
+# This sub will return an array containing any status that
+# is considered an open bug.
+
+sub OpenStates {
+    return ('NEW', 'REOPENED', 'ASSIGNED', $::unconfirmedstate);
+}
+
 
 sub RemoveVotes {
     my ($id, $who, $reason) = (@_);
index 70d2625ba125af24b6286c9dd9929779282428a4..0baadda9aca36e92cf4e2935ff2dd72ec582a6ec 100755 (executable)
@@ -507,7 +507,19 @@ sub ChangeStatus {
     my ($str) = (@_);
     if ($str ne $::dontchange) {
         DoComma();
-        if (IsOpenedState($str)) {
+        # Ugly, but functional.  We don't want to change Status if we are
+        # reasigning non-open bugs via the mass change form.
+        if ( ($::FORM{knob} eq 'reassign' || $::FORM{knob} eq 'reassignbycomponent') &&
+             ! defined $::FORM{id} && $str eq 'NEW' ) {
+            # If we got to here, we're dealing with a reassign from the mass
+            # change page.  We don't know (and can't easily figure out) if this
+            # bug is open or closed.  If it's closed, we don't want to change
+            # its status to NEW.  We have to put some logic into the SQL itself
+            # to handle that.
+            my @open_state = map(SqlQuote($_), OpenStates());
+            my $open_state = join(", ", @open_state);
+            $::query .= "bug_status = IF(bug_status IN($open_state), '$str', bug_status)";
+        } elsif (IsOpenedState($str)) {
             $::query .= "bug_status = IF(everconfirmed = 1, '$str', '$::unconfirmedstate')";
         } else {
             $::query .= "bug_status = '$str'";