diff options
author | Dave Lawrence <dlawrence@mozilla.com> | 2012-08-10 21:15:21 +0200 |
---|---|---|
committer | Dave Lawrence <dlawrence@mozilla.com> | 2012-08-10 21:15:21 +0200 |
commit | b0ffc83036d55ec7e2870de0d8146760185e342f (patch) | |
tree | 8b8d839c97551872c1d28744a49f8d597c5f1e21 /extensions | |
parent | f8d1e773e300c24257deb9c5e7b77e1f9fe3a1f8 (diff) | |
download | bugzilla-b0ffc83036d55ec7e2870de0d8146760185e342f.tar.gz bugzilla-b0ffc83036d55ec7e2870de0d8146760185e342f.tar.xz |
small changes to My Dashboard
Diffstat (limited to 'extensions')
-rw-r--r-- | extensions/MyDashboard/lib/Util.pm | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/extensions/MyDashboard/lib/Util.pm b/extensions/MyDashboard/lib/Util.pm new file mode 100644 index 000000000..ce5db005f --- /dev/null +++ b/extensions/MyDashboard/lib/Util.pm @@ -0,0 +1,48 @@ +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This Source Code Form is "Incompatible With Secondary Licenses", as +# defined by the Mozilla Public License, v. 2.0. + +package Bugzilla::Extension::MyDashboard::Util; + +use strict; + +use base qw(Exporter); +@Bugzilla::Extension::MyDashboard::Util::EXPORT = qw( + open_states + closed_states + quoted_open_states + quoted_closed_states +); + +use Bugzilla::Status; + +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; +} + +our $_closed_states; +sub closed_states { + $_closed_states ||= Bugzilla::Status->match({ is_open => 0, isactive => 1 }); + return wantarray ? @$_closed_states : $_closed_states; +} + +our $_quoted_closed_states; +sub quoted_closed_states { + my $dbh = Bugzilla->dbh; + $_quoted_closed_states ||= [ map { $dbh->quote($_->name) } closed_states() ]; + return wantarray ? @$_quoted_closed_states : $_quoted_closed_states; +} + +1; |