From efdb650c4f06f9cbb1d5673bb2eb24f622e0cfd6 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Wed, 25 Mar 2015 13:44:25 +0100 Subject: [PATCH] [Signed-off] Bug 6379: Remove link from unapproved tags MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit At the OPAC, if the tag is not approved, the tag's link did not return any result. This patch removes the link. Test plan: 1/ Set TagsModeration to 'Require' 2/ Create tags at the OPAC 3/ Approve a couple 4/ Confirm that unapproved tags does not have links. Works as expected. Unapproved tags in column 'Terms' are not linked and are marked with (not approved) Signed-off-by: Marc VĂ©ron --- C4/Tags.pm | 7 ++++++- koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt | 9 +++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/C4/Tags.pm b/C4/Tags.pm index c775da9..f96a8b0 100644 --- a/C4/Tags.pm +++ b/C4/Tags.pm @@ -208,7 +208,12 @@ sub get_tag_rows { push @exe_args, $hash->{$key}; } } - my $query = TAG_SELECT . ($wheres||'') . $limit; + my $query = q| + SELECT tall.tag_id, tall.borrowernumber, tall.biblionumber, tall.term, tall.language, tall.date_created, tapp.approved + FROM tags_all tall + LEFT JOIN tags_approval tapp ON tapp.term = tall.term + |; + $query .= ($wheres||'') . $limit; $debug and print STDERR "get_tag_rows query:\n $query\n", "get_tag_rows query args: ", join(',', @exe_args), "\n"; my $sth = C4::Context->dbh->prepare($query); diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt index b9a7072..14c5f32 100644 --- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt +++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt @@ -121,8 +121,13 @@ Tag: - - [% MY_TAG.term |html %] + [% IF MY_TAG.approved == 1 %] + [% MY_TAG.term |html %] + [% ELSE %] + [% MY_TAG.term |html %] (not approved) + [% END %] + + [% IF ( MY_TAG.XSLTBloc ) %] [% MY_TAG.XSLTBloc %] -- 1.7.10.4