summaryrefslogtreecommitdiffstats
path: root/Bugzilla/WebService
diff options
context:
space:
mode:
authormkanat%bugzilla.org <>2009-01-23 04:19:32 +0100
committermkanat%bugzilla.org <>2009-01-23 04:19:32 +0100
commitdb7cfa425147c7dc174050f8cca5870a2696e66b (patch)
tree80da9930d0cecfd6d21b1faac54dc78902ab8b6f /Bugzilla/WebService
parent4c70e508fc19c13e1a6274c388b7da4c31efb846 (diff)
downloadbugzilla-db7cfa425147c7dc174050f8cca5870a2696e66b.tar.gz
bugzilla-db7cfa425147c7dc174050f8cca5870a2696e66b.tar.xz
Bug 474715: Add 'limit', 'offset' and 'changed_since' arguments to WebService::Bug.search()
Patch By Kip Hampton <khampton@totalcinema.com> r=mkanat, a=mkanat
Diffstat (limited to 'Bugzilla/WebService')
-rwxr-xr-xBugzilla/WebService/Bug.pm32
1 files changed, 31 insertions, 1 deletions
diff --git a/Bugzilla/WebService/Bug.pm b/Bugzilla/WebService/Bug.pm
index 04b18fe7c..31f87ba99 100755
--- a/Bugzilla/WebService/Bug.pm
+++ b/Bugzilla/WebService/Bug.pm
@@ -50,6 +50,8 @@ use constant FIELD_MAP => {
summary => 'short_desc',
url => 'bug_file_loc',
whiteboard => 'status_whiteboard',
+ limit => 'LIMIT',
+ offset => 'OFFSET',
};
use constant PRODUCT_SPECIFIC_FIELDS => qw(version target_milestone component);
@@ -218,7 +220,21 @@ sub get_history {
sub search {
my ($self, $params) = @_;
+
+ if ( $params->{offset} and !$params->{limit} ) {
+ ThrowCodeError( 'param_required', { param => 'limit', function => 'Bug.search()'});
+ }
+
$params = _map_fields($params);
+
+ # If the user set the 'last_change_time' param (translated into delta_ts
+ # by the field map), use a custom WHERE to constrain the query to only
+ # those bugs that have a delta_ts greater than or equal to
+ # the specified time.
+ if ( my $bug_when = delete $params->{delta_ts} ) {
+ $params->{WHERE} = {'delta_ts >= ?' => $bug_when};
+ }
+
my $bugs = Bugzilla::Bug->match($params);
my $visible = Bugzilla->user->visible_bugs($bugs);
my @hashes = map { $self->_bug_to_hash($_) } @$visible;
@@ -960,7 +976,21 @@ C<int> The numeric id of the bug.
=item C<last_change_time>
-C<dateTime> The last time the bug was updated.
+C<dateTime> Limit the search to only those bugs which have changed
+in some way since the specified time. It includes all bugs changed
+between the specified time and the present. Note: only a single
+C<dateTime> will accepted, not an array.
+
+=item C<limit>
+
+C<int> Limit the number of results returned to C<int> records.
+
+=item C<offset>
+
+C<int> Used in conjunction with the C<limit> argument, C<offset> defines
+the starting position for the search. For example, given a search that
+would return 100 bugs, setting C<limit> to 10 and C<offset> to 10 would return
+bugs 11 through 20 from the set of 100.
=item C<op_sys>