}
my $component;
+my (%cc_add, %cc_remove);
+
if ($cgi->param('component') ne $cgi->param('dontchange')) {
if (scalar(@newprod_ids) > 1) {
ThrowUserError("no_component_change_for_multiple_products");
DoComma();
$::query .= "component_id = ?";
push(@values, $component->id);
+
+ # Add in the default CC list for the component if we are moving bugs.
+ if (!$cgi->param('id') || $component->id != $bug->component_id) {
+ foreach my $cc (@{$component->initial_cc}) {
+ # NewCC must be defined or the code below won't insert
+ # any CCs.
+ $cgi->param('newcc') || $cgi->param('newcc', "");
+ $cc_add{$cc->id} = $cc->login;
+ }
+ }
}
# If this installation uses bug aliases, and the user is changing the alias,
}
}
-my $duplicate;
-
# We need to check the addresses involved in a CC change before we touch any bugs.
# What we'll do here is formulate the CC data into two hashes of ID's involved
# in this CC change. Then those hashes can be used later on for the actual change.
-my (%cc_add, %cc_remove);
if (defined $cgi->param('newcc')
|| defined $cgi->param('addselfcc')
|| defined $cgi->param('removecc')
my %usercache = ();
-if (defined $cgi->param('qa_contact')
- && $cgi->param('knob') ne "reassignbycomponent")
+if (defined $cgi->param('assigned_to')
+ && !$cgi->param('set_default_assignee')
+ && trim($cgi->param('assigned_to')) ne $cgi->param('dontchange'))
{
+ my $name = trim($cgi->param('assigned_to'));
+ if ($name ne "") {
+ $assignee = login_to_id($name, THROW_ERROR);
+ if (Bugzilla->params->{"strict_isolation"}) {
+ $usercache{$assignee} ||= Bugzilla::User->new($assignee);
+ my $assign_user = $usercache{$assignee};
+ foreach my $product_id (@newprod_ids) {
+ if (!$assign_user->can_edit_product($product_id)) {
+ my $product_name = Bugzilla::Product->new($product_id)->name;
+ ThrowUserError('invalid_user_group',
+ {'users' => $assign_user->login,
+ 'product' => $product_name,
+ 'bug_id' => (scalar(@idlist) > 1)
+ ? undef : $idlist[0]
+ });
+ }
+ }
+ }
+ } else {
+ ThrowUserError("reassign_to_empty");
+ }
+ DoComma();
+ $::query .= "assigned_to = ?";
+ push(@values, $assignee);
+ $assignee_checked = 1;
+};
+
+if (defined $cgi->param('qa_contact') && !$cgi->param('set_default_qa_contact')) {
my $name = trim($cgi->param('qa_contact'));
# The QA contact cannot be deleted from show_bug.cgi for a single bug!
if ($name ne $cgi->param('dontchange')) {
}
}
+if ($cgi->param('set_default_assignee') || $cgi->param('set_default_qa_contact')) {
+ CheckonComment('reassignbycomponent');
+}
+
+my $duplicate; # It will store the ID of the bug we are pointing to, if any.
+
SWITCH: for ($cgi->param('knob')) {
/^none$/ && do {
last SWITCH;
}
last SWITCH;
};
- /^reassign$/ && CheckonComment( "reassign" ) && do {
- if ($cgi->param('andconfirm')) {
- DoConfirm($bug);
- }
- if (defined $cgi->param('assigned_to')
- && trim($cgi->param('assigned_to')) ne "") {
- $assignee = login_to_id(trim($cgi->param('assigned_to')), THROW_ERROR);
- if (Bugzilla->params->{"strict_isolation"}) {
- $usercache{$assignee} ||= Bugzilla::User->new($assignee);
- my $assign_user = $usercache{$assignee};
- foreach my $product_id (@newprod_ids) {
- if (!$assign_user->can_edit_product($product_id)) {
- my $product_name = Bugzilla::Product->new($product_id)->name;
- ThrowUserError('invalid_user_group',
- {'users' => $assign_user->login,
- 'product' => $product_name,
- 'bug_id' => (scalar(@idlist) > 1)
- ? undef : $idlist[0]
- });
- }
- }
- }
- } else {
- ThrowUserError("reassign_to_empty");
- }
- DoComma();
- $::query .= "assigned_to = ?";
- push(@values, $assignee);
- $assignee_checked = 1;
- last SWITCH;
- };
- /^reassignbycomponent$/ && CheckonComment( "reassignbycomponent" ) && do {
- if ($cgi->param('compconfirm')) {
- DoConfirm($bug);
- }
- last SWITCH;
- };
/^reopen$/ && CheckonComment( "reopen" ) && do {
last SWITCH;
};
$comma = ',';
}
- if ($cgi->param('knob') eq 'reassignbycomponent') {
- # We have to check whether the bug is moved to another product
- # and/or component before reassigning. If $component is defined,
- # use it; else use the product/component the bug is already in.
+ # We have to check whether the bug is moved to another product
+ # and/or component before reassigning. If $component is defined,
+ # use it; else use the product/component the bug is already in.
+ if ($cgi->param('set_default_assignee')) {
my $new_comp_id = $component ? $component->id : $old_bug_obj->{'component_id'};
$assignee = $dbh->selectrow_array('SELECT initialowner
FROM components
$query .= "$comma assigned_to = ?";
push(@bug_values, $assignee);
$comma = ',';
- if (Bugzilla->params->{"useqacontact"}) {
- $qacontact = $dbh->selectrow_array('SELECT initialqacontact
- FROM components
- WHERE components.id = ?',
- undef, $new_comp_id);
- if ($qacontact) {
- $query .= "$comma qa_contact = ?";
- push(@bug_values, $qacontact);
- }
- else {
- $query .= "$comma qa_contact = NULL";
- }
- }
+ }
- # And add in the Default CC for the Component.
- my $comp_obj = $component || new Bugzilla::Component($new_comp_id);
- my @new_init_cc = @{$comp_obj->initial_cc};
- foreach my $cc (@new_init_cc) {
- # NewCC must be defined or the code below won't insert
- # any CCs.
- $cgi->param('newcc') || $cgi->param('newcc', []);
- $cc_add{$cc->id} = $cc->login;
+ if (Bugzilla->params->{'useqacontact'} && $cgi->param('set_default_qa_contact')) {
+ my $new_comp_id = $component ? $component->id : $old_bug_obj->{'component_id'};
+ $qacontact = $dbh->selectrow_array('SELECT initialqacontact
+ FROM components
+ WHERE components.id = ?',
+ undef, $new_comp_id);
+ if ($qacontact) {
+ $query .= "$comma qa_contact = ?";
+ push(@bug_values, $qacontact);
}
+ else {
+ $query .= "$comma qa_contact = NULL";
+ }
+ $comma = ',';
}
my %dependencychanged;
}
$oldhash{$col} = $oldvalues[$i];
$formhash{$col} = $cgi->param($col) if defined $cgi->param($col);
- # The status and resolution are defined by the workflow.
- $formhash{$col} = $status if $col eq 'bug_status';
- $formhash{$col} = $resolution if $col eq 'resolution';
$i++;
}
- # If the user is reassigning bugs, we need to:
- # - convert $newhash{'assigned_to'} and $newhash{'qa_contact'}
- # email addresses into their corresponding IDs;
+ # The status and resolution are defined by the workflow.
+ $formhash{'bug_status'} = $status;
+ $formhash{'resolution'} = $resolution;
+
+ # We need to convert $newhash{'assigned_to'} and $newhash{'qa_contact'}
+ # email addresses into their corresponding IDs;
$formhash{'qa_contact'} = $qacontact if Bugzilla->params->{'useqacontact'};
- if ($cgi->param('knob') eq 'reassignbycomponent'
- || $cgi->param('knob') eq 'reassign') {
- $formhash{'assigned_to'} = $assignee;
- }
+ $formhash{'assigned_to'} = $assignee;
+
# This hash is required by Bug::check_can_change_field().
- my $cgi_hash = {
- 'dontchange' => scalar $cgi->param('dontchange'),
- 'knob' => scalar $cgi->param('knob')
- };
+ my $cgi_hash = {'dontchange' => scalar $cgi->param('dontchange')};
foreach my $col (@editable_bug_fields) {
if (exists $formhash{$col}
&& !$old_bug_obj->check_can_change_field($col, $oldhash{$col}, $formhash{$col},
[%############################################################################%]
[% BLOCK section_people %]
- <table cellpadding="1" cellspacing="1">
+ <table cellpadding="3" cellspacing="1">
<tr>
<td align="right">
<b>Reporter</b>:
</tr>
<tr>
- <td align="right">
- <b><a href="page.cgi?id=fields.html#assigned_to">Assigned To</a></b>:
+ <td align="right" valign="top">
+ <b><a href="page.cgi?id=fields.html#assigned_to">Assignee</a></b>:
</td>
<td>
- [% INCLUDE user_identity user => bug.assigned_to %]
+ [% IF bug.check_can_change_field("assigned_to", 0, 1) %]
+ [% INCLUDE global/userselect.html.tmpl
+ id => "assigned_to"
+ name => "assigned_to"
+ value => bug.assigned_to.login
+ size => 30
+ %]
+ <br>
+ <input type="checkbox" id="set_default_assignee" name="set_default_assignee" value="1">
+ <label for="set_default_assignee">Reset Assignee to default</label>
+ [% ELSE %]
+ <input type="hidden" name="assigned_to" id="assigned_to"
+ value="[% bug.assigned_to.login FILTER html %]">
+ [% INCLUDE user_identity user => bug.assigned_to %]
+ [% END %]
</td>
</tr>
[% IF Param('useqacontact') %]
<tr>
- <td align="right">
+ <td align="right" valign="top">
<label for="qa_contact" accesskey="q"><b><u>Q</u>A Contact</b></label>:
</td>
- <td colspan="7">
+ <td>
[% IF bug.check_can_change_field("qa_contact", 0, 1) %]
[% INCLUDE global/userselect.html.tmpl
id => "qa_contact"
size => 30
emptyok => 1
%]
+ <br>
+ <input type="checkbox" id="set_default_qa_contact" name="set_default_qa_contact" value="1">
+ <label for="set_default_qa_contact">Reset QA Contact to default</label>
[% ELSE %]
<input type="hidden" name="qa_contact" id="qa_contact"
value="[% bug.qa_contact.login FILTER html %]">