summaryrefslogtreecommitdiffstats
path: root/Bugzilla/User.pm
diff options
context:
space:
mode:
authorJulien Heyman <jheyman@portaildulibre.fr>2012-08-07 23:59:18 +0200
committerFrédéric Buclin <LpSolit@gmail.com>2012-08-07 23:59:18 +0200
commit14d7441b73d32614aa0e086c5f69ac087b939a48 (patch)
tree281660eac457755f199b4600439e2a7973f54612 /Bugzilla/User.pm
parenteb04bb66cee35f39d546403ea4f777b43452cd4d (diff)
downloadbugzilla-14d7441b73d32614aa0e086c5f69ac087b939a48.tar.gz
bugzilla-14d7441b73d32614aa0e086c5f69ac087b939a48.tar.xz
Bug 319598: Add support for saved tabular and graphical reports
r/a=LpSolit
Diffstat (limited to 'Bugzilla/User.pm')
-rw-r--r--Bugzilla/User.pm30
1 files changed, 30 insertions, 0 deletions
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<Bugzilla::Auth::login>, for the most part.
Returns the disable text of the user, if any.
+=item C<reports>
+
+Returns an arrayref of the user's own saved reports. The array contains
+L<Bugzilla::Reports> objects.
+
+=item C<flush_reports_cache>
+
+Some code modifies the set of stored reports. Because C<Bugzilla::User> does
+not handle these modifications, but does cache the result of calling C<reports>
+internally, such code must call this method to flush the cached result.
+
=item C<settings>
Returns a hash of hashes which holds the user's settings. The first key is