From 37c25f55b2a8eb310390a73d114370951df2d978 Mon Sep 17 00:00:00 2001 From: Joe Atzberger Date: Mon, 2 Jun 2008 13:16:32 -0500 Subject: [PATCH] Restrict OPAC tags display to approved=>1. Signed-off-by: Joshua Ferraro --- C4/Tags.pm | 5 +++-- opac/opac-detail.pl | 5 ++--- opac/opac-search.pl | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/C4/Tags.pm b/C4/Tags.pm index 09e59934b4..11046c467b 100644 --- a/C4/Tags.pm +++ b/C4/Tags.pm @@ -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"; diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl index 2a28ca5efb..7c98fea432 100755 --- a/opac/opac-detail.pl +++ b/opac/opac-detail.pl @@ -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})); } diff --git a/opac/opac-search.pl b/opac/opac-search.pl index 099b01066a..dd545b3bd8 100755 --- a/opac/opac-search.pl +++ b/opac/opac-search.pl @@ -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 }); } } -- 2.39.5