diff options
Diffstat (limited to 'Bugzilla/Bug.pm')
-rwxr-xr-x | Bugzilla/Bug.pm | 34 |
1 files changed, 30 insertions, 4 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm index e8f90dfdf..03a28bf5d 100755 --- a/Bugzilla/Bug.pm +++ b/Bugzilla/Bug.pm @@ -114,10 +114,12 @@ use constant VALIDATORS => { alias => \&_check_alias, bug_file_loc => \&_check_bug_file_loc, bug_severity => \&_check_bug_severity, + cc => \&_check_cc, deadline => \&_check_deadline, estimated_time => \&_check_estimated_time, op_sys => \&_check_op_sys, priority => \&_check_priority, + product => \&_check_product, remaining_time => \&_check_remaining_time, rep_platform => \&_check_rep_platform, short_desc => \&_check_short_desc, @@ -223,12 +225,34 @@ sub new { # user is not a member of the timetrackinggroup. # C<deadline> - For time-tracking. Will be ignored for the same # reasons as C<estimated_time>. +sub create { + my $class = shift; + my $dbh = Bugzilla->dbh; + + $class->check_required_create_fields(@_); + my $params = $class->run_create_validators(@_); + + # "cc" is not a field in the bugs table, so we don't pass it to + # insert_create_data. + my $cc_ids = $params->{cc}; + delete $params->{cc}; + + my $bug = $class->insert_create_data($params); + + my $sth_cc = $dbh->prepare('INSERT INTO cc (bug_id, who) VALUES (?,?)'); + foreach my $user_id (@$cc_ids) { + $sth_cc->execute($bug->bug_id, $user_id); + } + + return $bug; +} + sub run_create_validators { my $class = shift; - my $params = shift; + my $params = $class->SUPER::run_create_validators(@_); - my $product = $class->_check_product($params->{product}); + my $product = $params->{product}; $params->{product_id} = $product->id; delete $params->{product}; @@ -254,8 +278,10 @@ sub run_create_validators { $params->{delta_ts} = $params->{creation_ts}; $params->{remaining_time} = $params->{estimated_time}; - unshift @_, $params; - return $class->SUPER::run_create_validators(@_); + $class->_check_strict_isolation($product, $params->{cc}, + $params->{assigned_to}, $params->{qa_contact}); + + return $params; } # This is the correct way to delete bugs from the DB. |