summaryrefslogtreecommitdiffstats
path: root/extensions/MyDashboard/Extension.pm
diff options
context:
space:
mode:
authorDave Lawrence <dlawrence@mozilla.com>2012-08-10 20:57:05 +0200
committerDave Lawrence <dlawrence@mozilla.com>2012-08-10 20:57:05 +0200
commitf8d1e773e300c24257deb9c5e7b77e1f9fe3a1f8 (patch)
treeec02ea6b10903f955ee3a4953ed1314b5375b146 /extensions/MyDashboard/Extension.pm
parent3524a4610f7355d1e055eb4a0dccb71ccecefc33 (diff)
downloadbugzilla-f8d1e773e300c24257deb9c5e7b77e1f9fe3a1f8.tar.gz
bugzilla-f8d1e773e300c24257deb9c5e7b77e1f9fe3a1f8.tar.xz
small changes to My Dashboard
Diffstat (limited to 'extensions/MyDashboard/Extension.pm')
-rw-r--r--extensions/MyDashboard/Extension.pm38
1 files changed, 4 insertions, 34 deletions
diff --git a/extensions/MyDashboard/Extension.pm b/extensions/MyDashboard/Extension.pm
index 3eea207f2..a0a5e36cf 100644
--- a/extensions/MyDashboard/Extension.pm
+++ b/extensions/MyDashboard/Extension.pm
@@ -19,6 +19,8 @@ use Bugzilla::Status;
use Bugzilla::Field;
use Bugzilla::Search::Saved;
+use Bugzilla::Extension::MyDashboard::Util qw(open_states closed_states
+ quoted_open_states quoted_closed_states);
use Bugzilla::Extension::MyDashboard::TimeAgo qw(time_ago);
use DateTime;
@@ -56,7 +58,7 @@ sub QUERY_DEFS {
heading => "In Progress Reported by You",
description => 'You reported the bug, the developer accepted the bug and is hopefully working on it.',
params => {
- 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', _open_states()) ],
+ 'bug_status' => [ map { $_->name } grep($_->name ne 'NEW' && $_->name ne 'MODIFIED', open_states()) ],
'emailreporter1' => 1,
'emailtype1' => 'exact',
'email1' => $user->login
@@ -156,44 +158,12 @@ sub page_before_template {
# Switch to shadow db since we are just reading information
Bugzilla->switch_to_shadow_db();
- _active_product_counts($vars);
_standard_saved_queries($vars);
_flags_requested($vars);
$vars->{'severities'} = get_legal_field_values('bug_severity');
}
-our $_open_states;
-sub _open_states {
- $_open_states ||= Bugzilla::Status->match({ is_open => 1, isactive => 1 });
- return wantarray ? @$_open_states : $_open_states;
-}
-
-our $_quoted_open_states;
-sub _quoted_open_states {
- my $dbh = Bugzilla->dbh;
- $_quoted_open_states ||= [ map { $dbh->quote($_->name) } _open_states() ];
- return wantarray ? @$_quoted_open_states : $_quoted_open_states;
-}
-
-sub _active_product_counts {
- my ($vars) = @_;
- my $dbh = Bugzilla->dbh;
- my $user = Bugzilla->user;
-
- my @enterable_products = @{$user->get_enterable_products()};
- $vars->{'products'}
- = $dbh->selectall_arrayref("SELECT products.name AS product, count(*) AS count
- FROM bugs,products
- WHERE bugs.product_id=products.id
- AND products.isactive = 1
- AND bugs.bug_status IN (" . join(',', _quoted_open_states()) . ")
- AND products.id IN (" . join(',', map { $_->id } @enterable_products) . ")
- GROUP BY products.name ORDER BY count DESC", { Slice => {} });
-
- $vars->{'products_buffer'} = "&" . join('&', map { "bug_status=" . $_->name } _open_states());
-}
-
sub _standard_saved_queries {
my ($vars) = @_;
my $dbh = Bugzilla->dbh;
@@ -306,7 +276,7 @@ sub _flags_requested {
AND ccmap.bug_id = bugs.bug_id ";
# Limit query to pending requests and open bugs only
- $query .= " WHERE bugs.bug_status IN (" . join(',', _quoted_open_states()) . ")
+ $query .= " WHERE bugs.bug_status IN (" . join(',', quoted_open_states()) . ")
AND flags.status = '?' ";
# Weed out bug the user does not have access to