Bugzilla – Attachment 66538 Details for
Bug 14385
Extend OpacHiddenItems to allow specifying exempt borrower categories
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 14385: Fix hiding in opac-tags
SIGNED-OFF-Bug-14385-Fix-hiding-in-opac-tags.patch (text/plain), 5.50 KB, created by
Aleisha Amohia
on 2017-08-27 23:43:31 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 14385: Fix hiding in opac-tags
Filename:
MIME Type:
Creator:
Aleisha Amohia
Created:
2017-08-27 23:43:31 UTC
Size:
5.50 KB
patch
obsolete
>From e5aa1f44e08e3270ae7e70bfa0e3a89668ef8efe Mon Sep 17 00:00:00 2001 >From: Mark Tompsett <mtompset@hotmail.com> >Date: Fri, 18 Aug 2017 21:50:22 +0000 >Subject: [PATCH] [SIGNED-OFF] Bug 14385: Fix hiding in opac-tags > >opac/opac-tags.pl was not properly hiding. > >There is currently one known bug associated with tags left. >If you have two biblios tagged by different people with the >same tag, the opac-search will show the one you tagged that >is supposed to be hidden, because tag searches work differently >than regular searches. This is beyond the scope of this bug. >See the FIXME's in opac/opac-search.pl > >Signed-off-by: Aleisha Amohia <aleishaamohia@hotmail.com> >--- > .../opac-tmpl/bootstrap/en/modules/opac-tags.tt | 2 + > opac/opac-tags.pl | 46 +++++++++++++++++++++- > 2 files changed, 46 insertions(+), 2 deletions(-) > >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 4deb916..9ced736 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-tags.tt >@@ -126,6 +126,7 @@ > <thead><tr><th> </th><th>Term</th><th>Title</th><th>Date added</th></tr></thead> > <tbody> > [% FOREACH MY_TAG IN MY_TAGS %] >+ [% IF MY_TAG.visible %] > <tr> > <td> > <input type="checkbox" name="del[% MY_TAG.tag_id %]" value="del[% MY_TAG.tag_id %]"> >@@ -163,6 +164,7 @@ > </span> > </td> > </tr> >+ [% END %] > [% END %] > </tbody> > </table> >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index 267c3c0..ec94a47 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -41,6 +41,7 @@ use C4::Debug; > use C4::Output qw(:html :ajax pagination_bar); > use C4::Scrubber; > use C4::Biblio; >+use C4::Items qw(GetItemsInfo GetHiddenItemnumbers); > use C4::Tags qw(add_tag get_approval_rows get_tag_rows remove_tag stratify_tags); > use C4::XSLT; > >@@ -226,13 +227,35 @@ if ($is_ajax) { > > my $results = []; > my $my_tags = []; >+my $borcat = q{}; > > if ($loggedinuser) { >+ my $patron = Koha::Patrons->find( { borrowernumber => $loggedinuser } ); >+ $borcat = $patron ? $patron->categorycode : $borcat; >+ my $should_hide = C4::Context->preference('OpacHiddenItems') // q{}; >+ $should_hide = ( $should_hide =~ /\S/ ) ? 1 : 0; > $my_tags = get_tag_rows({borrowernumber=>$loggedinuser}); > my $my_approved_tags = get_approval_rows({ approved => 1 }); > foreach my $tag (@$my_tags) { >+ $tag->{visible} = 0; > my $biblio = Koha::Biblios->find( $tag->{biblionumber} ); >- my $record = &GetMarcBiblio({ biblionumber => $tag->{biblionumber} }); >+ my $record = &GetMarcBiblio({ >+ biblionumber => $tag->{biblionumber}, >+ embed_items => 1, >+ opac => 1, >+ borcat => $borcat }); >+ next unless $record; >+ my $hidden_items = undef; >+ my @hidden_itemnumbers; >+ my @all_items; >+ if ($should_hide) { >+ @all_items = GetItemsInfo( $tag->{biblionumber} ); >+ @hidden_itemnumbers = GetHiddenItemnumbers({ >+ items => \@all_items, >+ borcat => $borcat }); >+ $hidden_items = \@hidden_itemnumbers; >+ } >+ next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); > $tag->{subtitle} = GetRecordValue( 'subtitle', $record, GetFrameworkCode( $tag->{biblionumber} ) ); > $tag->{title} = $biblio->title; > $tag->{author} = $biblio->author; >@@ -244,7 +267,7 @@ if ($loggedinuser) { > if ( $xslfile ) { > $tag->{XSLTBloc} = XSLTParse4Display( > $tag->{ biblionumber }, $record, "OPACXSLTResultsDisplay", >- 1, undef, $sysxml, $xslfile, $lang >+ 1, $hidden_items, $sysxml, $xslfile, $lang > ); > } > >@@ -252,6 +275,7 @@ if ($loggedinuser) { > $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 ); >+ $tag->{visible} = 1; > } > } > >@@ -281,6 +305,24 @@ if ($add_op) { > $arghash->{biblionumber} = $arg; > } > $results = get_approval_rows($arghash); >+ my @filtered_results; >+ foreach my $my_tag (@$my_tags) { >+ if (grep { $_->{term} eq $my_tag->{term} } @$results) { >+ if (! $my_tag->{visible} ) { >+ my $check_biblio = GetMarcBiblio({ >+ biblionumber => $my_tag->{biblionumber}, >+ embed_itesm => 1, >+ opac => 1, >+ borcat => $borcat }); >+ if ($check_biblio) { >+ push @filtered_results, $my_tag; >+ } >+ } else { >+ push @filtered_results, $my_tag; >+ } >+ } >+ } >+ $results = \@filtered_results; > stratify_tags(10, $results); # work out the differents sizes for things > my $count = scalar @$results; > $template->param(TAGLOOP_COUNT => $count, mine => $mine); >-- >2.1.4
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 14385
:
40158
|
53483
|
53494
|
53505
|
53506
|
53507
|
55593
|
64688
|
64689
|
64690
|
64691
|
64692
|
64693
|
65322
|
65323
|
65324
|
65325
|
65376
|
65377
|
65378
|
65379
|
65380
|
65381
|
65382
|
65383
|
65384
|
65385
|
65386
|
65387
|
65388
|
65389
|
65408
|
65409
|
65410
|
65411
|
66103
|
66104
|
66105
|
66106
|
66107
|
66108
|
66109
|
66110
|
66111
|
66112
|
66113
|
66114
|
66115
|
66116
|
66117
|
66118
|
66125
|
66126
|
66127
|
66128
|
66129
|
66130
|
66131
|
66132
|
66192
|
66193
|
66194
|
66195
|
66196
|
66197
|
66198
|
66199
|
66200
|
66201
|
66202
|
66203
|
66204
|
66205
|
66206
|
66207
|
66208
|
66209
|
66210
|
66302
|
66303
|
66347
|
66361
|
66372
|
66401
|
66403
|
66520
|
66521
|
66522
|
66523
|
66524
|
66525
|
66526
|
66527
|
66528
|
66529
|
66530
|
66531
|
66532
|
66533
|
66534
|
66535
|
66536
|
66537
|
66538
|
66539
|
66540
|
66541
|
66542
|
66543
|
66544
|
66545
|
70256
|
70257
|
70258
|
70259
|
72445
|
72446
|
72447
|
72448
|
72449
|
72450
|
72451
|
72452
|
72453
|
72454
|
74001
|
78654
|
78655
|
78656
|
78657
|
78825
|
78826
|
78827
|
78828
|
80411
|
80463
|
80464
|
80465
|
80466
|
80467
|
89963
|
90038