# Extract a list of flag type IDs from field names.
my @flagtype_ids = map(/^flag_type-(\d+)$/ ? $1 : (), $cgi->param());
- @flagtype_ids = grep($cgi->param("flag_type-$_") ne 'X', @flagtype_ids);
# Extract a list of existing flag IDs.
my @flag_ids = map(/^flag-(\d+)$/ ? $1 : (), $cgi->param());
# We are only interested in flags the user tries to create.
next unless scalar(grep { $_ == $type_id } @flagtype_ids);
- # Get the number of flags of this type already set for this target.
- my $has_flags = $class->count({
+ # Get the current flags of this type already set for this target.
+ my $current_flags = $class->match({
'type_id' => $type_id,
'target_type' => $attachment ? 'attachment' : 'bug',
'bug_id' => $bug->bug_id,
'attach_id' => $attachment ? $attachment->id : undef
});
- # Do not create a new flag of this type if this flag type is
- # not multiplicable and already has a flag set.
- next if (!$flag_type->is_multiplicable && $has_flags);
-
my $status = $cgi->param("flag_type-$type_id");
trick_taint($status);
last unless $flag_type->is_multiplicable;
}
}
+ elsif (!$flag_type->is_multiplicable && scalar @$current_flags) {
+ # Update or delete the current flag if the type is not multiplicable.
+ push(@new_flags, {id => @$current_flags[0]->id, status => $status});
+ }
else {
push(@new_flags, {type_id => $type_id, status => $status});
}
= [map($_->name, grep($_->is_active, @{$one_product->milestones}))];
}
}
+
+ # Allow to edit flags as well
+ $vars->{'flag_types'} = Bugzilla::FlagType::match({target_type => 'bug'});
}
# If we're editing a stored query, use the existing query name as default for
}
}
-if (defined $cgi->param('id')) {
-
- # Flags should be set AFTER the bug has been moved into another
- # product/component. The structure of flags code doesn't currently
- # allow them to be set using set_all.
+# Flags should be set AFTER the bug has been moved into another
+# product/component. The structure of flags code doesn't currently
+# allow them to be set using set_all.
+foreach my $bug (@bug_objects) {
my ($flags, $new_flags)
- = Bugzilla::Flag->extract_flags_from_cgi($first_bug, undef, $vars);
- $first_bug->set_flags($flags, $new_flags);
+ = Bugzilla::Flag->extract_flags_from_cgi($bug, undef, $vars);
+ $bug->set_flags($flags, $new_flags);
}
##############################
class="flag_select flag_type-[% type.id %]"
data-id="[% type.id %]" data-name="[% type.name FILTER html FILTER no_break %]"
[% IF !can_edit_flag %] disabled="disabled"[% END %]>
+ [% IF dontchange %]
+ <option value="[% dontchange FILTER html %]" selected>[% dontchange FILTER html %]</option>
+ [% END %]
[%# Only display statuses the user is allowed to set. %]
[% IF !flag
|| (can_edit_flag && user.can_unset_flag(type, flag.status) && user.can_request_flag(type))
</table>
+[% PROCESS "flag/list.html.tmpl" any_flags_requesteeble = 1 %]
+
<b><label for="comment">Additional Comments:</label></b>
[% IF user.is_insider %]
<input type="checkbox" name="comment_is_private" value="1"