use Bugzilla::Error;
use Bugzilla::Util;
use Bugzilla::Field;
+use Bugzilla::Flag;
use File::Basename;
use File::Spec::Functions;
return @{$class->request_cache->{active_custom_fields}};
}
+sub has_flags {
+ my $class = shift;
+
+ if (!defined $class->request_cache->{has_flags}) {
+ $class->request_cache->{has_flags} = Bugzilla::Flag::has_flags();
+ }
+ return $class->request_cache->{has_flags};
+}
+
sub hook_args {
my ($class, $args) = @_;
$class->request_cache->{hook_args} = $args if $args;
=over
+=item C<has_flags>
+
+Returns 1 if at least one flag exists in the DB, else 0. This subroutine
+is mainly used to decide to display the "(My )Requests" link in the footer.
+
+=back
+
+=cut
+
+sub has_flags {
+ my $dbh = Bugzilla->dbh;
+
+ my $has_flags = $dbh->selectrow_array('SELECT 1 FROM flags ' . $dbh->sql_limit(1));
+ return $has_flags || 0;
+}
+
+=pod
+
+=over
+
=item C<match($criteria)>
Queries the database for flags matching the given criteria
<li><span class="separator">| </span><a href="report.cgi">Reports</a></li>
<li>
- <span class="separator">| </span>
- [% IF user.id %]
- <a href="request.cgi?requester=[% user.login FILTER url_quote %]&requestee=
- [% user.login FILTER url_quote %]&do_union=1&group=type&action=queue">My Requests</a>
- [% ELSE %]
- <a href="request.cgi">Requests</a>
+ [% IF Bugzilla.has_flags %]
+ <span class="separator">| </span>
+ [% IF user.id %]
+ <a href="request.cgi?requester=[% user.login FILTER url_quote %]&requestee=
+ [% user.login FILTER url_quote %]&do_union=1&group=type&action=queue">My Requests</a>
+ [% ELSE %]
+ <a href="request.cgi">Requests</a>
+ [% END %]
[% END %]
[%-# Work around FF bug: keep this on one line %]</li>