diff options
author | Tiago Mello <timello@bugzilla.org> | 2011-11-28 23:50:15 +0100 |
---|---|---|
committer | Frédéric Buclin <LpSolit@gmail.com> | 2011-11-28 23:50:15 +0100 |
commit | 29256fc79c74982f688f791fcaee8180504711dd (patch) | |
tree | 20b636fcc5075d69cb8ca562ebbced04cdd83b1e /Bugzilla/BugUrl | |
parent | Bug 705393: Improve the error message thrown by Update.pm when updates.bugzil... (diff) | |
download | bugzilla-29256fc79c74982f688f791fcaee8180504711dd.tar.gz bugzilla-29256fc79c74982f688f791fcaee8180504711dd.tar.bz2 bugzilla-29256fc79c74982f688f791fcaee8180504711dd.zip |
Bug 687725: Adding a local bug ID in the See Also field isn't logged in the bug history of that bug
r/a=LpSolit
Diffstat (limited to 'Bugzilla/BugUrl')
-rw-r--r-- | Bugzilla/BugUrl/Bugzilla/Local.pm | 47 |
1 files changed, 3 insertions, 44 deletions
diff --git a/Bugzilla/BugUrl/Bugzilla/Local.pm b/Bugzilla/BugUrl/Bugzilla/Local.pm index 9260ba1cb..ba15f7d25 100644 --- a/Bugzilla/BugUrl/Bugzilla/Local.pm +++ b/Bugzilla/BugUrl/Bugzilla/Local.pm @@ -42,56 +42,15 @@ sub ref_bug_url { if (!exists $self->{ref_bug_url}) { my $ref_bug_id = new URI($self->name)->query_param('id'); + my $ref_bug = Bugzilla::Bug->check($ref_bug_id); my $ref_value = $self->local_uri($self->bug_id); $self->{ref_bug_url} = - new Bugzilla::BugUrl::Bugzilla::Local({ bug_id => $ref_bug_id, + new Bugzilla::BugUrl::Bugzilla::Local({ bug_id => $ref_bug->id, value => $ref_value }); } return $self->{ref_bug_url}; } -sub insert_create_data { - my ($class, $field_values) = @_; - - my $ref_bug = delete $field_values->{ref_bug}; - my $bug_url = $class->SUPER::insert_create_data($field_values); - my $url = $class->local_uri($bug_url->bug_id); - - # Check if the ref bug has already the url and then, - # update the ref bug to point to the current bug. - if (!grep { $_->name eq $url } @{ $ref_bug->see_also }) { - $class->SUPER::insert_create_data({ value => $url, - bug_id => $ref_bug->id, - class => ref($class) || $class }); - } - - return $bug_url; -} - -sub remove_from_db { - my $self = shift; - - my $dbh = Bugzilla->dbh; - my $ref_bug_url = $self->ref_bug_url; - - $dbh->bz_start_transaction(); - - # We remove the current see also first so then we - # avoid infinite loop later. - $self->SUPER::remove_from_db(); - - # We also remove the referenced bug url. - if (defined $ref_bug_url) { - my $ref_bug = Bugzilla::Bug->check($ref_bug_url->bug_id); - my $product = $ref_bug->product_obj; - if (Bugzilla->user->can_edit_product($product->id)) { - $ref_bug_url->remove_from_db(); - } - } - - $dbh->bz_commit_transaction(); -} - sub should_handle { my ($class, $uri) = @_; @@ -126,7 +85,7 @@ sub _check_value { } my $ref_bug_id = $uri->query_param('id'); - my $ref_bug = Bugzilla::Bug->check_for_edit($ref_bug_id); + my $ref_bug = Bugzilla::Bug->check($ref_bug_id); my $self_bug_id = $params->{bug_id}; $params->{ref_bug} = $ref_bug; |