X-Git-Url: http://koha-dev.rot13.org:8081/gitweb/?a=blobdiff_plain;ds=sidebyside;f=C4%2FTags.pm;h=06c1e1db6de4153d94e4ff80359f1eaae87f55db;hb=aa06364814d948c2efc2d6629032a24b5ad7232b;hp=5f2ff6988a1f51e98012dec8b5b6089f95a87637;hpb=7c174930ac1618a53dbda4bc785b335f21113238;p=koha_fer diff --git a/C4/Tags.pm b/C4/Tags.pm index 5f2ff6988a..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; @@ -261,7 +280,7 @@ sub get_tags (;$) { # i.e., from tags_index sub get_approval_rows (;$) { # i.e., from tags_approval my $hash = shift || {}; - my @ok_fields = qw(term approved date_approved approved_by weight_total limit sort); + my @ok_fields = qw(term approved date_approved approved_by weight_total limit sort borrowernumber); my $wheres; my $limit = ""; my $order = ""; @@ -279,7 +298,7 @@ sub get_approval_rows (;$) { # i.e., from tags_approval if ($key eq 'limit') { my $val = $hash->{$key}; unless ($val =~ /^(\d+,)?\d+$/) { - carp "Non-nuerical limit value '$val' ignored!"; + carp "Non-numerical limit value '$val' ignored!"; next; } $limit = " LIMIT $val\n"; @@ -288,6 +307,7 @@ sub get_approval_rows (;$) { # i.e., from tags_approval unless ( $by =~ /^([-+])?(term)/ or $by =~ /^([-+])?(biblionumber)/ or + $by =~ /^([-+])?(borrowernumber)/ or $by =~ /^([-+])?(weight_total)/ or $by =~ /^([-+])?(approved(_by)?)/ or $by =~ /^([-+])?(date_approved)/ @@ -580,6 +600,8 @@ More verose debugging messages are sent in the presence of non-zero $ENV{"DEBUG" =head3 TO DO: Add real perldoc +=cut + =head2 External Dictionary (Ispell) [Recommended] An external dictionary can be used as a means of "pre-populating" and tracking