From 3df60ebfb1cb27f76f1e60d6b025961aa370cbb3 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Tue, 26 Feb 2019 17:08:40 -0300 Subject: [PATCH] Bug 22420: Remove duplicated tags Caused by commit e1b5fa657de843a177fb4bf57947a1376152d021 Bug 14385: Squash of a lot of patches rebased Test plan: - Have the OPAC tags feature enabled - Add a couple tags to different records, make sure some of them are used more than once - Go to 'Tag cloud' in the OPAC => the repeated tags must not be repeated many times. --- opac/opac-tags.pl | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl index 272d896f23..bf50eb4aa5 100755 --- a/opac/opac-tags.pl +++ b/opac/opac-tags.pl @@ -307,6 +307,7 @@ if ($add_op) { $results = get_approval_rows($arghash); my @filtered_results; foreach my $my_tag (@$my_tags) { + next if grep {/^$my_tag$/} @filtered_results; if (grep { $_->{term} eq $my_tag->{term} } @$results) { if (! $my_tag->{visible} ) { my $check_biblio = GetMarcBiblio({ @@ -314,12 +315,9 @@ if ($add_op) { embed_items => 1, opac => 1, borcat => $borcat }); - if ($check_biblio) { - push @filtered_results, $my_tag; - } - } else { - push @filtered_results, $my_tag; + next unless $check_biblio; } + push @filtered_results, $my_tag; } } $results = \@filtered_results; -- 2.11.0