From 14d7441b73d32614aa0e086c5f69ac087b939a48 Mon Sep 17 00:00:00 2001 From: Julien Heyman Date: Tue, 7 Aug 2012 23:59:18 +0200 Subject: Bug 319598: Add support for saved tabular and graphical reports r/a=LpSolit --- Bugzilla/User.pm | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) (limited to 'Bugzilla/User.pm') diff --git a/Bugzilla/User.pm b/Bugzilla/User.pm index 9c869dc63..708d12c64 100644 --- a/Bugzilla/User.pm +++ b/Bugzilla/User.pm @@ -578,6 +578,25 @@ sub save_last_search { return $search; } +sub reports { + my $self = shift; + return $self->{reports} if defined $self->{reports}; + return [] unless $self->id; + + my $dbh = Bugzilla->dbh; + my $report_ids = $dbh->selectcol_arrayref( + 'SELECT id FROM reports WHERE user_id = ?', undef, $self->id); + require Bugzilla::Report; + $self->{reports} = Bugzilla::Report->new_from_list($report_ids); + return $self->{reports}; +} + +sub flush_reports_cache { + my $self = shift; + + delete $self->{reports}; +} + sub settings { my ($self) = @_; @@ -2275,6 +2294,17 @@ Should only be called by C, for the most part. Returns the disable text of the user, if any. +=item C + +Returns an arrayref of the user's own saved reports. The array contains +L objects. + +=item C + +Some code modifies the set of stored reports. Because C does +not handle these modifications, but does cache the result of calling C +internally, such code must call this method to flush the cached result. + =item C Returns a hash of hashes which holds the user's settings. The first key is -- cgit v1.2.3-24-g4f1b