Bug 6379: Remove link from unapproved tags

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.

Signed-off-by: Bernardo Gonzalez Kriegel <bgkriegel@gmail.com>
works as described, no errors

For the (approved) link to work I need to install YAML::XS

Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Signed-off-by: Tomas Cohen Arazi <tomascohen@theke.io>
This commit is contained in:
Jonathan Druart 2015-03-25 13:44:25 +01:00 committed by Tomas Cohen Arazi
parent 2f0e409f47
commit 1489bb7342
2 changed files with 21 additions and 14 deletions

View file

@ -122,8 +122,13 @@
<tr> <tr>
<td class="tagterm"> <td class="tagterm">
<span class="tdlabel">Tag:</span> <span class="tdlabel">Tag:</span>
<a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]"> [% IF MY_TAG.approved == 1 %]
[% MY_TAG.term |html %]</a></td> <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&amp;q=[% MY_TAG.term |url %]">[% MY_TAG.term |html %]</a>
[% ELSE %]
[% MY_TAG.term |html %] (not approved)
[% END %]
</td>
<td> <td>
[% IF ( MY_TAG.XSLTBloc ) %] [% IF ( MY_TAG.XSLTBloc ) %]
[% MY_TAG.XSLTBloc %] [% MY_TAG.XSLTBloc %]

View file

@ -226,20 +226,22 @@ my $results = [];
my $my_tags = []; my $my_tags = [];
if ($loggedinuser) { if ($loggedinuser) {
$my_tags = get_tag_rows({borrowernumber=>$loggedinuser}); $my_tags = get_tag_rows({borrowernumber=>$loggedinuser});
foreach (@$my_tags) { my $my_approved_tags = get_approval_rows({borrowernumber => $loggedinuser, approved => 1});
my $biblio = GetBiblioData($_->{biblionumber}); foreach my $tag (@$my_tags) {
my $record = &GetMarcBiblio( $_->{biblionumber} ); my $biblio = GetBiblioData($tag->{biblionumber});
$_->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $_->{biblionumber} ) ); my $record = &GetMarcBiblio( $tag->{biblionumber} );
$_->{title} = $biblio->{title}; $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) );
$_->{author} = $biblio->{author}; $tag->{title} = $biblio->{title};
$tag->{author} = $biblio->{author};
if (C4::Context->preference("OPACXSLTResultsDisplay")) { if (C4::Context->preference("OPACXSLTResultsDisplay")) {
$_->{XSLTBloc} = XSLTParse4Display($_->{biblionumber}, $record, "OPACXSLTResultsDisplay"); $tag->{XSLTBloc} = XSLTParse4Display($tag->{biblionumber}, $record, "OPACXSLTResultsDisplay");
} }
my $date = $_->{date_created} || ''; my $date = $tag->{date_created} || '';
$date =~ /\s+(\d{2}\:\d{2}\:\d{2})/; $date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
$_->{time_created_display} = $1; $tag->{time_created_display} = $1;
} $tag->{approved} = ( grep { $_->{term} eq $tag->{term} and $_->{approved} } @$my_approved_tags );
}
} }
$template->param(tagsview => 1); $template->param(tagsview => 1);