Reworking of Bugzilla::Bug persistence code mostly finished
parent
1656a14cfc
commit
7fdbfd5fa3
1961
Bugzilla/Bug.pm
1961
Bugzilla/Bug.pm
File diff suppressed because it is too large
Load Diff
|
@ -503,7 +503,7 @@ sub is_select
|
|||
|
||||
sub has_activity { $_[0]->{has_activity} }
|
||||
|
||||
sub add_to_deps { $_[0]->{add_to_deps} }
|
||||
sub add_to_deps { $_[0]->type == FIELD_TYPE_BUG_ID && $_[0]->{add_to_deps} }
|
||||
|
||||
sub url { $_[0]->{url} }
|
||||
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
# -*- Mode: perl; indent-tabs-mode: nil -*-
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public
|
||||
# License Version 1.1 (the "License"); you may not use this file
|
||||
# except in compliance with the License. You may obtain a copy of
|
||||
|
@ -35,8 +33,8 @@ use constant ID_FIELD => 'id';
|
|||
use constant LIST_ORDER => NAME_FIELD;
|
||||
|
||||
use constant UPDATE_VALIDATORS => {};
|
||||
use constant NUMERIC_COLUMNS => ();
|
||||
use constant DATE_COLUMNS => ();
|
||||
use constant NUMERIC_COLUMNS => {};
|
||||
use constant DATE_COLUMNS => {};
|
||||
|
||||
# This allows the JSON-RPC interface to return Bugzilla::Object instances
|
||||
# as though they were hashes. In the future, this may be modified to return
|
||||
|
@ -347,8 +345,8 @@ sub update
|
|||
# Use a copy of old object
|
||||
my $old_self = $self->new($self->id);
|
||||
|
||||
my %numeric = map { $_ => 1 } $self->NUMERIC_COLUMNS;
|
||||
my %date = map { $_ => 1 } $self->DATE_COLUMNS;
|
||||
my $numeric = $self->NUMERIC_COLUMNS;
|
||||
my $date = $self->DATE_COLUMNS;
|
||||
my (@update_columns, @values, %changes);
|
||||
foreach my $column ($self->UPDATE_COLUMNS)
|
||||
{
|
||||
|
@ -361,8 +359,8 @@ sub update
|
|||
{
|
||||
next if !defined $new && !defined $old;
|
||||
}
|
||||
elsif ($numeric{$column} && $old == $new ||
|
||||
$date{$column} && str2time($old) == str2time($new) ||
|
||||
elsif ($numeric->{$column} && $old == $new ||
|
||||
$date->{$column} && str2time($old) == str2time($new) ||
|
||||
$old eq $new)
|
||||
{
|
||||
next;
|
||||
|
@ -624,6 +622,8 @@ the L</ID_FIELD> usually can't be updated.)
|
|||
|
||||
=item C<NUMERIC_COLUMNS>
|
||||
|
||||
Hashref (field_name => 1).
|
||||
|
||||
When L</update> is called, it compares each column in the object to its
|
||||
current value in the database. It only updates columns that have changed.
|
||||
|
||||
|
|
|
@ -651,10 +651,11 @@ sub can_edit_bug
|
|||
$bug->assigned_to && $bug->assigned_to->id == $self->id ||
|
||||
Bugzilla->params->{useqacontact} && $bug->qa_contact && $bug->qa_contact->id == $self->id ||
|
||||
$bug->reporter && $bug->reporter->id == $self->id;
|
||||
my $cc = $bug->cc;
|
||||
# FIXME check cc logic
|
||||
my $cc = $bug->cc_users;
|
||||
foreach (@$cc)
|
||||
{
|
||||
return 1 if $_ eq $self->login;
|
||||
return 1 if $_->id eq $self->id;
|
||||
}
|
||||
return 1 if $self->can_edit_product($bug->product_obj->id);
|
||||
ThrowUserError("product_edit_denied", { product => $bug->product }) if $throw_error;
|
||||
|
|
|
@ -830,7 +830,7 @@ sub _bug_to_hash {
|
|||
$item{'blocks'} = \@blocks;
|
||||
}
|
||||
if (filter_wants $params, 'cc') {
|
||||
my @cc = map { $self->type('string', $_) } @{ $bug->cc || [] };
|
||||
my @cc = map { $self->type('string', $_->login) } @{ $bug->cc_users || [] };
|
||||
$item{'cc'} = \@cc;
|
||||
}
|
||||
if (filter_wants $params, 'creator') {
|
||||
|
|
|
@ -495,9 +495,9 @@ if ($cloned_bug_id)
|
|||
{
|
||||
@cc = split /[\s,]+/, $ARGS->{cc};
|
||||
}
|
||||
elsif (defined $cloned_bug->cc)
|
||||
elsif (@{$cloned_bug->cc_users})
|
||||
{
|
||||
@cc = @{$cloned_bug->cc};
|
||||
@cc = map { $_->login } @{$cloned_bug->cc_users};
|
||||
}
|
||||
|
||||
if ($cloned_bug->reporter->id != $user->id)
|
||||
|
|
11
post_bug.cgi
11
post_bug.cgi
|
@ -62,7 +62,7 @@ my $ARGS = $cgi->VarHash({
|
|||
######################################################################
|
||||
|
||||
# redirect to enter_bug if no field is passed.
|
||||
print $cgi->redirect(correct_urlbase() . 'enter_bug.cgi') unless $cgi->param();
|
||||
print $cgi->redirect(correct_urlbase() . 'enter_bug.cgi') unless $cgi->param;
|
||||
|
||||
# Detect if the user already used the same form to submit a bug
|
||||
my $token = trim($ARGS->{token});
|
||||
|
@ -76,7 +76,7 @@ if ($old_bug_id)
|
|||
$vars->{allow_override} = defined $ARGS->{ignore_token} ? 0 : 1;
|
||||
$vars->{new_token} = issue_session_token('createbug:');
|
||||
|
||||
$template->process("bug/create/confirm-create-dupe.html.tmpl", $vars)
|
||||
$template->process('bug/create/confirm-create-dupe.html.tmpl', $vars)
|
||||
|| ThrowTemplateError($template->error);
|
||||
exit;
|
||||
}
|
||||
|
@ -98,8 +98,6 @@ if (defined $ARGS->{maketemplate})
|
|||
exit;
|
||||
}
|
||||
|
||||
umask 0; # FIXME WTF???
|
||||
|
||||
# Group Validation
|
||||
my @selected_groups;
|
||||
for (keys %$ARGS)
|
||||
|
@ -119,9 +117,6 @@ $template->process($format->{template}, $vars, \$comment)
|
|||
|
||||
# Include custom fields editable on bug creation.
|
||||
my @custom_bug_fields = grep { $_->enter_bug } Bugzilla->active_custom_fields;
|
||||
|
||||
# Undefined custom fields are ignored to ensure they will get their default
|
||||
# value (e.g. "---" for custom single select fields).
|
||||
my @bug_fields = grep { defined $ARGS->{$_} } map { $_->name } @custom_bug_fields;
|
||||
|
||||
push(@bug_fields, qw(
|
||||
|
@ -180,7 +175,7 @@ my $bug = new Bugzilla::Bug;
|
|||
|
||||
$bug->set...
|
||||
dependencies => { dependson, blocked }
|
||||
comment => { thetext, work_time, isprivate, type }
|
||||
add_comment => { thetext, work_time, isprivate => commentprivacy, type }
|
||||
keywords => { keywords, descriptions }
|
||||
|
||||
# Get the bug ID back.
|
||||
|
|
|
@ -551,7 +551,8 @@ if ($move_action eq Bugzilla->params->{'move-button-text'})
|
|||
my $new_status = Bugzilla->params->{duplicate_or_move_bug_status};
|
||||
foreach my $bug (@bug_objects)
|
||||
{
|
||||
$bug->set_status($new_status, {resolution => 'MOVED', moving => 1});
|
||||
$bug->{moving} = 1;
|
||||
$bug->set_status($new_status, {resolution => 'MOVED'});
|
||||
}
|
||||
$_->update() foreach @bug_objects;
|
||||
$dbh->bz_commit_transaction();
|
||||
|
@ -571,18 +572,17 @@ if ($move_action eq Bugzilla->params->{'move-button-text'})
|
|||
$from =~ s/@/\@/;
|
||||
my $msg = "To: $to\n";
|
||||
$msg .= "From: Bugzilla <" . $from . ">\n";
|
||||
$msg .= "Subject: Moving bug(s) " . join(', ', map($_->id, @bug_objects))
|
||||
. "\n\n";
|
||||
$msg .= "Subject: Moving bug(s) " . join(', ', map($_->id, @bug_objects)) . "\n\n";
|
||||
|
||||
my @fieldlist = (Bugzilla::Bug->fields, 'group', 'long_desc',
|
||||
'attachment', 'attachmentdata');
|
||||
# FIXME Bug moving definitely does not work with all our changes.
|
||||
my @fieldlist = (Bugzilla::Bug->fields, 'group', 'long_desc', 'attachment', 'attachmentdata');
|
||||
my %displayfields;
|
||||
foreach (@fieldlist)
|
||||
{
|
||||
$displayfields{$_} = 1;
|
||||
}
|
||||
|
||||
$template->process("bug/show.xml.tmpl", {
|
||||
$template->process('bug/show.xml.tmpl', {
|
||||
bugs => $bugs,
|
||||
displayfields => \%displayfields,
|
||||
}, \$msg) || ThrowTemplateError($template->error());
|
||||
|
|
Loading…
Reference in New Issue