summaryrefslogtreecommitdiffstats
path: root/process_bug.cgi
diff options
context:
space:
mode:
authorjake%bugzilla.org <>2004-12-21 18:04:00 +0100
committerjake%bugzilla.org <>2004-12-21 18:04:00 +0100
commitc068e2b90f06f898217dc9919371a583517d985e (patch)
treedc5845ff868e095bfe6d7c075a5eeebba781a702 /process_bug.cgi
parentf21cae35b182db1feccab05c3c2ad57357342dbe (diff)
downloadbugzilla-c068e2b90f06f898217dc9919371a583517d985e.tar.gz
bugzilla-c068e2b90f06f898217dc9919371a583517d985e.tar.xz
Bug 264601 - Bugzilla will now tell a user which field contained an "invalid bug number or alias."
Patch by Frédéric Buclin <LpSolit@netscape.net> r=myk, a=justdave
Diffstat (limited to 'process_bug.cgi')
-rwxr-xr-xprocess_bug.cgi52
1 files changed, 18 insertions, 34 deletions
diff --git a/process_bug.cgi b/process_bug.cgi
index 47957d193..6fb94711a 100755
--- a/process_bug.cgi
+++ b/process_bug.cgi
@@ -120,23 +120,13 @@ foreach my $field ("dependson", "blocked") {
my @validvalues;
foreach my $id (split(/[\s,]+/, $::FORM{$field})) {
next unless $id;
- ValidateBugID($id, 1);
+ ValidateBugID($id, $field);
push(@validvalues, $id);
}
$::FORM{$field} = join(",", @validvalues);
}
}
-# If we are duping bugs, let's also make sure that we can change
-# the original. This takes care of issue A on bug 96085.
-if (defined $::FORM{'dup_id'} && $::FORM{'knob'} eq "duplicate") {
- ValidateBugID($::FORM{'dup_id'});
-
- # Also, let's see if the reporter has authorization to see the bug
- # to which we are duping. If not we need to prompt.
- DuplicateUserConfirm();
-}
-
# do a match on the fields if applicable
# The order of these function calls is important, as both Flag::validate
@@ -490,8 +480,8 @@ sub DuplicateUserConfirm {
return;
}
- my $dupe = trim($::FORM{'id'});
- my $original = trim($::FORM{'dup_id'});
+ my $dupe = $::FORM{'id'};
+ my $original = $::FORM{'dup_id'};
SendSQL("SELECT reporter FROM bugs WHERE bug_id = " . SqlQuote($dupe));
my $reporter = FetchOneColumn();
@@ -520,7 +510,7 @@ sub DuplicateUserConfirm {
$template->process("bug/process/confirm-duplicate.html.tmpl", $vars)
|| ThrowTemplateError($template->error());
exit;
-} # end DuplicateUserConfirm()
+}
if (defined $::FORM{'id'}) {
# since this means that we were called from show_bug.cgi, now is a good
@@ -976,28 +966,22 @@ SWITCH: for ($::FORM{'knob'}) {
last SWITCH;
};
/^duplicate$/ && CheckonComment( "duplicate" ) && do {
- ChangeStatus('RESOLVED');
- ChangeResolution('DUPLICATE');
- CheckFormFieldDefined(\%::FORM,'dup_id');
- my $num = trim($::FORM{'dup_id'});
- SendSQL("SELECT bug_id FROM bugs WHERE bug_id = " . SqlQuote($num));
- $num = FetchOneColumn();
- if (!$num) {
- ThrowUserError("dupe_invalid_bug_id")
- }
- if (!defined($::FORM{'id'}) || $num == $::FORM{'id'}) {
+ # Make sure we can change the original bug (issue A on bug 96085)
+ CheckFormFieldDefined(\%::FORM, 'dup_id');
+ ValidateBugID($::FORM{'dup_id'}, 'dup_id');
+
+ # Also, let's see if the reporter has authorization to see
+ # the bug to which we are duping. If not we need to prompt.
+ DuplicateUserConfirm();
+
+ $duplicate = $::FORM{'dup_id'};
+ if (!defined($::FORM{'id'}) || $duplicate == $::FORM{'id'}) {
ThrowUserError("dupe_of_self_disallowed");
}
- my $checkid = trim($::FORM{'id'});
- SendSQL("SELECT bug_id FROM bugs where bug_id = " . SqlQuote($checkid));
- $checkid = FetchOneColumn();
- if (!$checkid) {
- ThrowUserError("invalid_bug_id",
- { bug_id => $checkid });
- }
- $::FORM{'comment'} .= "\n\n*** This bug has been marked as a duplicate of $num ***";
- $duplicate = $num;
-
+ ChangeStatus('RESOLVED');
+ ChangeResolution('DUPLICATE');
+ $::FORM{'comment'} .= "\n\n*** This bug has been marked " .
+ "as a duplicate of $duplicate ***";
last SWITCH;
};