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>
<tr>
<td class="tagterm">
<span class="tdlabel">Tag:</span>
<tr>
<td class="tagterm">
<span class="tdlabel">Tag:</span>
- <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&q=[% MY_TAG.term |url %]">
- [% MY_TAG.term |html %]</a></td>
+ [% IF MY_TAG.approved == 1 %]
+ <a href="/cgi-bin/koha/opac-search.pl?tag=[% MY_TAG.term |url %]&q=[% MY_TAG.term |url %]">[% MY_TAG.term |html %]</a>
+ [% ELSE %]
+ [% MY_TAG.term |html %] (not approved)
+ [% END %]
+ </td>
+
<td>
[% IF ( MY_TAG.XSLTBloc ) %]
[% MY_TAG.XSLTBloc %]
<td>
[% IF ( MY_TAG.XSLTBloc ) %]
[% MY_TAG.XSLTBloc %]
my $my_tags = [];
if ($loggedinuser) {
my $my_tags = [];
if ($loggedinuser) {
- $my_tags = get_tag_rows({borrowernumber=>$loggedinuser});
- foreach (@$my_tags) {
- my $biblio = GetBiblioData($_->{biblionumber});
- my $record = &GetMarcBiblio( $_->{biblionumber} );
- $_->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $_->{biblionumber} ) );
- $_->{title} = $biblio->{title};
- $_->{author} = $biblio->{author};
+ $my_tags = get_tag_rows({borrowernumber=>$loggedinuser});
+ my $my_approved_tags = get_approval_rows({borrowernumber => $loggedinuser, approved => 1});
+ foreach my $tag (@$my_tags) {
+ my $biblio = GetBiblioData($tag->{biblionumber});
+ my $record = &GetMarcBiblio( $tag->{biblionumber} );
+ $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) );
+ $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} || '';
- $date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
- $_->{time_created_display} = $1;
- }
+ my $date = $tag->{date_created} || '';
+ $date =~ /\s+(\d{2}\:\d{2}\:\d{2})/;
+ $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);