Lines 41-46
use C4::Debug;
Link Here
|
41 |
use C4::Output qw(:html :ajax pagination_bar); |
41 |
use C4::Output qw(:html :ajax pagination_bar); |
42 |
use C4::Scrubber; |
42 |
use C4::Scrubber; |
43 |
use C4::Biblio; |
43 |
use C4::Biblio; |
|
|
44 |
use C4::Items qw(GetItemsInfo GetHiddenItemnumbers); |
44 |
use C4::Tags qw(add_tag get_approval_rows get_tag_rows remove_tag stratify_tags); |
45 |
use C4::Tags qw(add_tag get_approval_rows get_tag_rows remove_tag stratify_tags); |
45 |
use C4::XSLT; |
46 |
use C4::XSLT; |
46 |
|
47 |
|
Lines 226-238
if ($is_ajax) {
Link Here
|
226 |
|
227 |
|
227 |
my $results = []; |
228 |
my $results = []; |
228 |
my $my_tags = []; |
229 |
my $my_tags = []; |
|
|
230 |
my $borcat = q{}; |
229 |
|
231 |
|
230 |
if ($loggedinuser) { |
232 |
if ($loggedinuser) { |
|
|
233 |
my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } ); |
234 |
$borcat = $patron ? $patron->categorycode : $borcat; |
235 |
my $should_hide = C4::Context->preference('OpacHiddenItems') // q{}; |
236 |
$should_hide = ( $should_hide =~ /\S/ ) ? 1 : 0; |
231 |
$my_tags = get_tag_rows({borrowernumber=>$loggedinuser}); |
237 |
$my_tags = get_tag_rows({borrowernumber=>$loggedinuser}); |
232 |
my $my_approved_tags = get_approval_rows({ approved => 1 }); |
238 |
my $my_approved_tags = get_approval_rows({ approved => 1 }); |
233 |
foreach my $tag (@$my_tags) { |
239 |
foreach my $tag (@$my_tags) { |
|
|
240 |
$tag->{visible} = 0; |
234 |
my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); |
241 |
my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); |
235 |
my $record = &GetMarcBiblio({ biblionumber => $tag->{biblionumber} }); |
242 |
my $record = &GetMarcBiblio({ |
|
|
243 |
biblionumber => $tag->{biblionumber}, |
244 |
embed_items => 1, |
245 |
opac => 1, |
246 |
borcat => $borcat }); |
247 |
next unless $record; |
248 |
my $hidden_items = undef; |
249 |
my @hidden_itemnumbers; |
250 |
my @all_items; |
251 |
if ($should_hide) { |
252 |
@all_items = GetItemsInfo( $tag->{biblionumber} ); |
253 |
@hidden_itemnumbers = GetHiddenItemnumbers({ |
254 |
items => \@all_items, |
255 |
borcat => $borcat }); |
256 |
$hidden_items = \@hidden_itemnumbers; |
257 |
} |
258 |
next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); |
236 |
$tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); |
259 |
$tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); |
237 |
$tag->{title} = $biblio->title; |
260 |
$tag->{title} = $biblio->title; |
238 |
$tag->{author} = $biblio->author; |
261 |
$tag->{author} = $biblio->author; |
Lines 244-250
if ($loggedinuser) {
Link Here
|
244 |
if ( $xslfile ) { |
267 |
if ( $xslfile ) { |
245 |
$tag->{XSLTBloc} = XSLTParse4Display( |
268 |
$tag->{XSLTBloc} = XSLTParse4Display( |
246 |
$tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay", |
269 |
$tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay", |
247 |
1, undef, $sysxml, $xslfile, $lang |
270 |
1, $hidden_items, $sysxml, $xslfile, $lang |
248 |
); |
271 |
); |
249 |
} |
272 |
} |
250 |
|
273 |
|
Lines 252-257
if ($loggedinuser) {
Link Here
|
252 |
$date =~ /\s+(\d{2}\:\d{2}\:\d{2})/; |
275 |
$date =~ /\s+(\d{2}\:\d{2}\:\d{2})/; |
253 |
$tag->{time_created_display} = $1; |
276 |
$tag->{time_created_display} = $1; |
254 |
$tag->{approved} = ( grep { $_->{term} eq $tag->{term} and $_->{approved} } @$my_approved_tags ); |
277 |
$tag->{approved} = ( grep { $_->{term} eq $tag->{term} and $_->{approved} } @$my_approved_tags ); |
|
|
278 |
$tag->{visible} = 1; |
255 |
} |
279 |
} |
256 |
} |
280 |
} |
257 |
|
281 |
|
Lines 281-286
if ($add_op) {
Link Here
|
281 |
$arghash->{biblionumber} = $arg; |
305 |
$arghash->{biblionumber} = $arg; |
282 |
} |
306 |
} |
283 |
$results = get_approval_rows($arghash); |
307 |
$results = get_approval_rows($arghash); |
|
|
308 |
my @filtered_results; |
309 |
foreach my $my_tag (@$my_tags) { |
310 |
if (grep { $_->{term} eq $my_tag->{term} } @$results) { |
311 |
if (! $my_tag->{visible} ) { |
312 |
my $check_biblio = GetMarcBiblio({ |
313 |
biblionumber => $my_tag->{biblionumber}, |
314 |
embed_itesm => 1, |
315 |
opac => 1, |
316 |
borcat => $borcat }); |
317 |
if ($check_biblio) { |
318 |
push @filtered_results, $my_tag; |
319 |
} |
320 |
} else { |
321 |
push @filtered_results, $my_tag; |
322 |
} |
323 |
} |
324 |
} |
325 |
$results = \@filtered_results; |
284 |
stratify_tags(10, $results); # work out the differents sizes for things |
326 |
stratify_tags(10, $results); # work out the differents sizes for things |
285 |
my $count = scalar @$results; |
327 |
my $count = scalar @$results; |
286 |
$template->param(TAGLOOP_COUNT => $count, mine => $mine); |
328 |
$template->param(TAGLOOP_COUNT => $count, mine => $mine); |
287 |
- |
|
|