Restrict OPAC tags display to approved=>1.
authorJoe Atzberger <joe.atzberger@liblime.com>
Mon, 2 Jun 2008 18:16:32 +0000 (13:16 -0500)
committerJoshua Ferraro <jmf@liblime.com>
Tue, 3 Jun 2008 11:00:47 +0000 (06:00 -0500)
Signed-off-by: Joshua Ferraro <jmf@liblime.com>
C4/Tags.pm
opac/opac-detail.pl
opac/opac-search.pl

index 09e5993..11046c4 100644 (file)
@@ -192,7 +192,7 @@ sub get_tag_rows ($) {
 
 sub get_tags (;$) {            # i.e., from tags_index
        my $hash = shift || {};
-       my @ok_fields = qw(term biblionumber weight limit sort);
+       my @ok_fields = qw(term biblionumber weight limit sort approved);
        my $wheres;
        my $limit  = "";
        my $order  = "";
@@ -234,7 +234,8 @@ sub get_tags (;$) {         # i.e., from tags_index
                        
                } else {
                        my $whereval = $hash->{$key};
-                       my $longkey = ($key eq 'term') ? 'tags_index.term' : $key;
+                       my $longkey = ($key eq 'term'    ) ? 'tags_index.term'        :
+                                                 ($key eq 'approved') ? 'tags_approval.approved' : $key;
                        my $op = ($whereval =~ s/^(>=|<=)// or
                                          $whereval =~ s/^(>|=|<)//   ) ? $1 : '=';
                        $wheres .= ($wheres) ? " AND    $longkey $op ?\n" : " WHERE  $longkey $op ?\n";
index 2a28ca5..7c98fea 100755 (executable)
@@ -93,8 +93,7 @@ my $collections =  GetKohaAuthorisedValues('items.ccode',$dat->{'frameworkcode'}
 
 #coping with subscriptions
 my $subscriptionsnumber = CountSubscriptionFromBiblionumber($biblionumber);
-my @subscriptions       =
-  GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
+my @subscriptions       = GetSubscriptions( $dat->{title}, $dat->{issn}, $biblionumber );
 my @subs;
 $dat->{'serial'}=1 if $subscriptionsnumber;
 foreach my $subscription (@subscriptions) {
@@ -381,7 +380,7 @@ if (C4::Context->preference('TagsEnabled') and $tag_quantity = C4::Context->pref
                TagsShowOnDetail => $tag_quantity,
                TagsInputOnDetail => C4::Context->preference('TagsInputOnDetail')
        );
-       $template->param(TagLoop => get_tags({biblionumber=>$biblionumber,
+       $template->param(TagLoop => get_tags({biblionumber=>$biblionumber, approved=>1,
                                                                'sort'=>'-weight', limit=>$tag_quantity}));
 }
 
index 099b010..dd545b3 100755 (executable)
@@ -346,7 +346,7 @@ my @results_array;
 my $results_hashref;
 
 if ($tag) {
-       my $taglist = get_tags({term=>$tag});
+       my $taglist = get_tags({term=>$tag, approved=>1});
        $results_hashref->{biblioserver}->{hits} = scalar (@$taglist);
        my @biblist  = (map {GetBiblioData($_->{biblionumber})} @$taglist);
        my @marclist = (map {$_->{marc}} @biblist );
@@ -401,7 +401,7 @@ for (my $i=0;$i<=@servers;$i++) {
                        $tag_quantity = C4::Context->preference('TagsShowOnList')) {
                        foreach (@newresults) {
                                my $bibnum = $_->{biblionumber} or next;
-                               $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, 'sort'=>'-weight',
+                               $_ ->{'TagLoop'} = get_tags({biblionumber=>$bibnum, approved=>1, 'sort'=>'-weight',
                                                                                limit=>$tag_quantity });
                        }
                }