Bug 38616

Getting cc_group from product description


git-svn-id: svn://svn.office.custis.ru/3rdparty/bugzilla.org/trunk@168 6955db30-a419-402b-8a0d-67ecbb4d7f56
custis
svnuser 2009-06-03 16:44:49 +00:00
parent d65cd8b829
commit 7a18785578
6 changed files with 7 additions and 41 deletions

View File

@ -367,11 +367,11 @@ sub create {
$bug->{creation_ts} = $timestamp;
# Add the CCs
my ($ccg) = $product->description =~ /\[[Có]{2}:\s*([^\]]+)\s*\]/iso;
my $sth_cc = $dbh->prepare('INSERT INTO cc (bug_id, who) VALUES (?,?)');
foreach my $user_id (@$cc_ids)
{
if (!$product->cc_group ||
Bugzilla::User->new($user_id)->in_group($product->cc_group))
if (!$ccg || Bugzilla::User->new($user_id)->in_group($ccg))
{
$sth_cc->execute($bug->bug_id, $user_id);
}
@ -548,9 +548,10 @@ sub update {
}
# CC
my ($ccg) = $self->product_obj->description =~ /\[[Có]{2}:\s*([^\]]+)\s*\]/iso;
my @old_cc = map {$_->id} @{$old_bug->cc_users};
my @new_cc = @{$self->cc_users};
@new_cc = grep {$_->in_group($self->product_obj->cc_group)} @new_cc if $self->product_obj->cc_group;
@new_cc = grep {$_->in_group($ccg)} @new_cc if $ccg;
@new_cc = map {$_->id} @new_cc;
my ($removed_cc, $added_cc) = diff_arrays(\@old_cc, \@new_cc);

View File

@ -1052,8 +1052,6 @@ use constant ABSTRACT_SCHEMA => {
DEFAULT => 0},
defaultmilestone => {TYPE => 'varchar(20)',
NOTNULL => 1, DEFAULT => "'---'"},
cc_group => {TYPE => 'varchar(255)',
NOTNULL => 1},
],
INDEXES => [
products_name_idx => {FIELDS => ['name'],

View File

@ -49,7 +49,6 @@ use constant DB_COLUMNS => qw(
products.maxvotesperbug
products.votestoconfirm
products.defaultmilestone
products.cc_group
);
###############################
@ -261,7 +260,6 @@ sub max_votes_per_bug { return $_[0]->{'maxvotesperbug'}; }
sub votes_to_confirm { return $_[0]->{'votestoconfirm'}; }
sub default_milestone { return $_[0]->{'defaultmilestone'}; }
sub classification_id { return $_[0]->{'classification_id'}; }
sub cc_group { return $_[0]->{'cc_group'}; }
###############################
#### Subroutines ######
@ -315,7 +313,6 @@ Bugzilla::Product - Bugzilla product class.
my votestoconfirm = $product->votes_to_confirm;
my $defaultmilestone = $product->default_milestone;
my $classificationid = $product->classification_id;
my $cc_group = $product->cc_group;
=head1 DESCRIPTION

View File

@ -229,7 +229,6 @@ if ($action eq 'new') {
$cgi->param('maxvotesperbug') : 10000;
my $votestoconfirm = $cgi->param('votestoconfirm') || 0;
my $defaultmilestone = $cgi->param('defaultmilestone') || "---";
my $cc_group = $cgi->param('cc_group') || '';
# The following variables are used in placeholders only.
trick_taint($product_name);
@ -237,7 +236,6 @@ if ($action eq 'new') {
trick_taint($description);
trick_taint($milestoneurl);
trick_taint($defaultmilestone);
trick_taint($cc_group);
detaint_natural($disallownew);
detaint_natural($votesperuser);
detaint_natural($maxvotesperbug);
@ -246,11 +244,11 @@ if ($action eq 'new') {
# Add the new product.
$dbh->do('INSERT INTO products
(name, description, milestoneurl, disallownew, votesperuser,
maxvotesperbug, votestoconfirm, defaultmilestone, classification_id, cc_group)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)',
maxvotesperbug, votestoconfirm, defaultmilestone, classification_id)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)',
undef, ($product_name, $description, $milestoneurl, $disallownew,
$votesperuser, $maxvotesperbug, $votestoconfirm, $defaultmilestone,
$classification_id, $cc_group));
$classification_id));
$product = new Bugzilla::Product({name => $product_name});
@ -813,7 +811,6 @@ if ($action eq 'update') {
my $maxvotesperbug = trim($cgi->param('maxvotesperbug') || 0);
my $votestoconfirm = trim($cgi->param('votestoconfirm') || 0);
my $defaultmilestone = trim($cgi->param('defaultmilestone') || '---');
my $cc_group = trim($cgi->param('cc_group') || '');
my $checkvotes = 0;
@ -898,8 +895,6 @@ if ($action eq 'update') {
}
}
# TODO uzhos, remove this nahren!!!
$disallownew = $disallownew ? 1 : 0;
if ($disallownew ne $product_old->disallow_new) {
$dbh->do('UPDATE products SET disallownew = ? WHERE id = ?',
@ -936,12 +931,6 @@ if ($action eq 'update') {
undef, ($product_name, $product_old->id));
}
if ($cc_group ne $product_old->cc_group) {
trick_taint($cc_group);
$dbh->do('UPDATE products SET cc_group = ? WHERE id = ?',
undef, ($cc_group, $product_old->id));
}
$dbh->bz_commit_transaction();
my $product = new Bugzilla::Product({name => $product_name});

View File

@ -112,14 +112,3 @@
value="[% product.votestoconfirm FILTER html %]">
</td>
</tr>
<tr>
<th align="right">
CC group:
</th>
<td>
If not empty, the CC lists of bugs of this product will be restricted to this group.
<br>
<input size="64" maxlength="255" name="cc_group"
value="[% product.cc_group FILTER html %]">
</td>
</tr>

View File

@ -145,14 +145,6 @@
[% updated = 1 %]
[% END %]
[% IF product.cc_group != old_product.cc_group %]
<p>
Updated product CC group from '[%+ old_product.cc_group FILTER html %]' to
'[%+ product.cc_group FILTER html %]'.
</p>
[% updated = 1 %]
[% END %]
[% UNLESS updated %]
<p>Nothing changed for product '[% product.name FILTER html %]'.</p>
[% END %]