summaryrefslogtreecommitdiffstats
path: root/Bugzilla
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2008-01-20 09:22:25 +0100
committermkanat%bugzilla.org <>2008-01-20 09:22:25 +0100
commitb30573c8373fe6fd6438e161efc9201e680e1285 (patch)
tree6d1be8102f9d2678f1486c5b2b981022030e57fb /Bugzilla
parente4666b62480a4fa2e36493ce0315b76b7b759073 (diff)
downloadbugzilla-b30573c8373fe6fd6438e161efc9201e680e1285.tar.gz
bugzilla-b30573c8373fe6fd6438e161efc9201e680e1285.tar.xz
Bug 412836: Clean up process_bug.cgi now that we have Bugzilla::Bug->update
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> r=LpSolit, a=LpSolit
Diffstat (limited to 'Bugzilla')
-rwxr-xr-xBugzilla/Bug.pm35
-rw-r--r--Bugzilla/User.pm6
2 files changed, 23 insertions, 18 deletions
diff --git a/Bugzilla/Bug.pm b/Bugzilla/Bug.pm
index 227cb1f6e..9f4433263 100755
--- a/Bugzilla/Bug.pm
+++ b/Bugzilla/Bug.pm
@@ -494,11 +494,30 @@ sub update {
# XXX This is just a temporary hack until all updating happens
# inside this function.
my $delta_ts = shift || $dbh->selectrow_array("SELECT NOW()");
- $self->{delta_ts} = $delta_ts;
my $old_bug = $self->new($self->id);
my $changes = $self->SUPER::update(@_);
-
+
+ # Certain items in $changes have to be fixed so that they hold
+ # a name instead of an ID.
+ foreach my $field (qw(product_id component_id)) {
+ my $change = delete $changes->{$field};
+ if ($change) {
+ my $new_field = $field;
+ $new_field =~ s/_id$//;
+ $changes->{$new_field} =
+ [$self->{"_old_${new_field}_name"}, $self->$new_field];
+ }
+ }
+ foreach my $field (qw(qa_contact assigned_to)) {
+ if ($changes->{$field}) {
+ my ($from, $to) = @{ $changes->{$field} };
+ $from = $old_bug->$field->login if $from;
+ $to = $self->$field->login if $to;
+ $changes->{$field} = [$from, $to];
+ }
+ }
+
my %old_groups = map {$_->id => $_} @{$old_bug->groups_in};
my %new_groups = map {$_->id => $_} @{$self->groups_in};
my ($removed_gr, $added_gr) = diff_arrays([keys %old_groups],
@@ -565,16 +584,6 @@ sub update {
my $change = $changes->{$field};
my $from = defined $change->[0] ? $change->[0] : '';
my $to = defined $change->[1] ? $change->[1] : '';
- # Certain fields have their name stored in bugs_activity, not their id.
- if ( grep($_ eq $field, qw(product_id component_id)) ) {
- $field =~ s/_id$//;
- $from = $self->{"_old_${field}_name"};
- $to = $self->$field;
- }
- if (grep ($_ eq $field, qw(qa_contact assigned_to))) {
- $from = $old_bug->$field->login if $from;
- $to = $self->$field->login if $to;
- }
LogActivityEntry($self->id, $field, $from, $to, Bugzilla->user->id,
$delta_ts);
}
@@ -598,6 +607,7 @@ sub update {
if (scalar(keys %$changes) || $self->{added_comments}) {
$dbh->do('UPDATE bugs SET delta_ts = ? WHERE bug_id = ?',
undef, ($delta_ts, $self->id));
+ $self->{delta_ts} = $delta_ts;
}
return $changes;
@@ -745,6 +755,7 @@ sub update_keywords {
$dbh->do('UPDATE bugs SET delta_ts = ? WHERE bug_id = ?',
undef, ($delta_ts, $self->id));
+ $self->{delta_ts} = $delta_ts;
}
return [$removed_keywords, $added_keywords];
diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm
index c983122e4..5f9e2228c 100644
--- a/Bugzilla/User.pm
+++ b/Bugzilla/User.pm
@@ -1151,9 +1151,6 @@ sub match_field {
# prepare default form values
- # What does a "--do_not_change--" field look like (if any)?
- my $dontchange = $cgi->param('dontchange');
-
# Fields can be regular expressions matching multiple form fields
# (f.e. "requestee-(\d+)"), so expand each non-literal field
# into the list of form fields it matches.
@@ -1212,9 +1209,6 @@ sub match_field {
next if !defined $cgi->param($field);
- # Skip it if this is a --do_not_change-- field
- next if $dontchange && $dontchange eq $cgi->param($field);
-
# We need to move the query to $raw_field, where it will be split up,
# modified by the search, and put back into the CGI environment
# incrementally.