X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;f=C4%2FTags.pm;h=06c1e1db6de4153d94e4ff80359f1eaae87f55db;hb=d55405047b952e2becac861f6ac7981558be9979;hp=a2603835d9fbf257eabb7daca59ee59ce0b560b8;hpb=4c14cd317e92cb44aed69f09e99438f694ae32e5;p=koha_gimpoz diff --git a/C4/Tags.pm b/C4/Tags.pm index a2603835d9..06c1e1db6d 100644 --- a/C4/Tags.pm +++ b/C4/Tags.pm @@ -40,6 +40,7 @@ BEGIN { &whitelist &is_approved &approval_counts + &get_count_by_tag_status &get_filters ); # %EXPORT_TAGS = (); @@ -92,6 +93,24 @@ sub approval_counts () { return $result; } +=head2 get_count_by_tag_status + + get_count_by_tag_status($status); + +Takes a status and gets a count of tags with that status + +=cut + +sub get_count_by_tag_status { + my ($status) = @_; + my $dbh = C4::Context->dbh; + my $query = + "SELECT count(*) FROM tags_approval WHERE approved=?"; + my $sth = $dbh->prepare($query); + $sth->execute( $status ); + return $sth->fetchrow; +} + sub remove_tag ($;$) { my $tag_id = shift or return undef; my $user_id = (@_) ? shift : undef;