]> git.ipfire.org Git - thirdparty/bugzilla.git/commitdiff
Bug 880097 - Only retrieve database fetched values if requested
authorSimon Green <sgreen@redhat.com>
Mon, 17 Jun 2013 04:24:06 +0000 (14:24 +1000)
committerSimon Green <sgreen@redhat.com>
Mon, 17 Jun 2013 04:24:06 +0000 (14:24 +1000)
r=glob, a=LpSolit

Bugzilla/WebService/Bug.pm

index 2c88232ac454e0537f26403f2245c313f44839f5..84e4403d826d43c744075e15f82de5b96eab2d7a 100644 (file)
@@ -866,8 +866,6 @@ sub _bug_to_hash {
     # database call to get the info.
     my %item = (
         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),
@@ -875,7 +873,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),
@@ -897,6 +894,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('string', $_) } @{ $bug->cc };
         $item{'cc'} = \@cc;
@@ -924,6 +927,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('string', $qa_login);
@@ -964,7 +970,10 @@ sub _bug_to_hash {
         # No need to format $bug->deadline specially, because Bugzilla::Bug
         # already does it for us.
         $item{'deadline'} = $self->type('string', $bug->deadline);
-        $item{'actual_time'} = $self->type('double', $bug->actual_time);
+
+        if (filter_wants $params, 'actual_time') {
+            $item{'actual_time'} = $self->type('double', $bug->actual_time);
+        }
     }
 
     if (Bugzilla->user->id) {