From 2a9db67806fbc2483afce36e0660f03a99b5ec5f Mon Sep 17 00:00:00 2001 From: Simon Green Date: Tue, 2 Sep 2014 00:35:21 +0800 Subject: Bug 880097: Only retrieve database fetched values if requested --- Bugzilla/WebService/Bug.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'Bugzilla') diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm index f3e075fd2..319df7578 100644 --- a/Bugzilla/WebService/Bug.pm +++ b/Bugzilla/WebService/Bug.pm @@ -1261,8 +1261,6 @@ sub _bug_to_hash { # database call to get the info. my %item = %{ filter $params, { alias => $self->type('string', $bug->alias), - classification => $self->type('string', $bug->classification), - component => $self->type('string', $bug->component), creation_time => $self->type('dateTime', $bug->creation_ts), id => $self->type('int', $bug->bug_id), is_confirmed => $self->type('boolean', $bug->everconfirmed), @@ -1270,7 +1268,6 @@ sub _bug_to_hash { op_sys => $self->type('string', $bug->op_sys), platform => $self->type('string', $bug->rep_platform), priority => $self->type('string', $bug->priority), - product => $self->type('string', $bug->product), resolution => $self->type('string', $bug->resolution), severity => $self->type('string', $bug->bug_severity), status => $self->type('string', $bug->bug_status), @@ -1292,6 +1289,12 @@ sub _bug_to_hash { my @blocks = map { $self->type('int', $_) } @{ $bug->blocked }; $item{'blocks'} = \@blocks; } + if (filter_wants $params, 'classification') { + $item{classification} = $self->type('string', $bug->classification); + } + if (filter_wants $params, 'component') { + $item{component} = $self->type('string', $bug->component); + } if (filter_wants $params, 'cc') { my @cc = map { $self->type('email', $_) } @{ $bug->cc || [] }; $item{'cc'} = \@cc; @@ -1321,6 +1324,9 @@ sub _bug_to_hash { @{ $bug->keyword_objects }; $item{'keywords'} = \@keywords; } + if (filter_wants $params, 'product') { + $item{product} = $self->type('string', $bug->product); + } if (filter_wants $params, 'qa_contact') { my $qa_login = $bug->qa_contact ? $bug->qa_contact->login : ''; $item{'qa_contact'} = $self->type('email', $qa_login); -- cgit v1.2.3-24-g4f1b