Bugzilla – Attachment 119784 Details for
Bug 18989
Allow displaying biblios with all items hidden by OpacHiddenItems
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 18989: Allow displaying biblios with all items hidden by OpacHiddenItems
Bug-18989-Allow-displaying-biblios-with-all-items-.patch (text/plain), 8.00 KB, created by
Katrin Fischer
on 2021-04-17 12:29:08 UTC
(
hide
)
Description:
Bug 18989: Allow displaying biblios with all items hidden by OpacHiddenItems
Filename:
MIME Type:
Creator:
Katrin Fischer
Created:
2021-04-17 12:29:08 UTC
Size:
8.00 KB
patch
obsolete
>From 6089b21687cb890015ed3810d3b590e2cacb008a Mon Sep 17 00:00:00 2001 >From: Fridolin Somers <fridolin.somers@biblibre.com> >Date: Fri, 4 Sep 2020 14:33:12 +0200 >Subject: [PATCH] Bug 18989: Allow displaying biblios with all items hidden by > OpacHiddenItems > >Bug 10584 made Koha hide biblios for which all items match some criteria (in OpacHiddenItems) so they are hidden. >Add syspref OpacHiddenItemsHidesRecord controlling this behaviour. > >Test plan : >1) >1.1) Create some biblio records with one item having damaged=1 >1.2) Define system preference OpacHiddenItems = damaged: 1 >2) >2.1) Set system preference OpacHiddenItemsHidesRecord to 'don't hide' >2.2) At OPAC : perform a search showing those records and some more >2.3) Check you see the all the records >2.4) For a record with hidden item check you don't get HTTP 404 for : normal view, ISBD view, MARC view >2.5) Check you can had tags on this record >2.6) Add record to basket, check you see it in basket >3) >3.1) Set system preference OpacHiddenItemsHidesRecord to 'hide' >3.2) At OPAC : perform a search showing those records and some more >3.3) Check you don't see the records with hidden item >3.4) For a record with hidden item check you get HTTP 404 for : normal view, ISBD view, MARC view >3.5) Show basket, check you see the records with hidden item > >Signed-off-by: Kelly McElligott <kelly@bywatersolutions.com> >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> > >Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de> >--- > C4/Search.pm | 2 +- > installer/data/mysql/mandatory/sysprefs.sql | 1 + > .../intranet-tmpl/prog/en/modules/admin/preferences/opac.pref | 7 +++++++ > opac/opac-ISBDdetail.pl | 2 +- > opac/opac-MARCdetail.pl | 2 +- > opac/opac-basket.pl | 2 +- > opac/opac-detail.pl | 2 +- > opac/opac-tags.pl | 2 +- > 8 files changed, 14 insertions(+), 6 deletions(-) > >diff --git a/C4/Search.pm b/C4/Search.pm >index a4fafd1e01..0db460a808 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -1992,7 +1992,7 @@ sub searchResults { > } # notforloan, item level and biblioitem level > > # if all items are hidden, do not show the record >- if ($items_count > 0 && $hideatopac_count == $items_count) { >+ if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $items_count > 0 && $hideatopac_count == $items_count) { > next; > } > >diff --git a/installer/data/mysql/mandatory/sysprefs.sql b/installer/data/mysql/mandatory/sysprefs.sql >index 40e5dc3ee5..d80af7158c 100644 >--- a/installer/data/mysql/mandatory/sysprefs.sql >+++ b/installer/data/mysql/mandatory/sysprefs.sql >@@ -410,6 +410,7 @@ INSERT INTO systempreferences ( `variable`, `value`, `options`, `explanation`, ` > ('OPACFRBRizeEditions','0','','If ON, the OPAC will query one or more ISBN web services for associated ISBNs and display an Editions tab on the details pages','YesNo'), > ('OpacHiddenItems','','','This syspref allows to define custom rules for hiding specific items at the OPAC. See http://wiki.koha-community.org/wiki/OpacHiddenItems for more information.','Textarea'), > ('OpacHiddenItemsExceptions','',NULL,'List of borrower categories, separated by |, that can see items otherwise hidden by OpacHiddenItems','Textarea'), >+('OpacHiddenItemsHidesRecord','1','','Hide biblio record when all its items are hidden because of OpacHiddenItems','YesNo'), > ('OpacHighlightedWords','1','','If Set, then queried words are higlighted in OPAC','YesNo'), > ('OPACHoldingsDefaultSortField','first_column','first_column|homebranch|holdingbranch','Default sort field for the holdings table at the OPAC','choice'), > ('OPACHoldsHistory','0','','If ON, enables display of Patron Holds History in OPAC','YesNo'), >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >index 8e56f74984..2a56803c83 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/admin/preferences/opac.pref >@@ -656,6 +656,13 @@ OPAC: > - 'List of patron categories, separated by |, that can see items otherwise hidden by <a href="/cgi-bin/koha/admin/preferences.pl?op=search&searchfield=OpacHiddenItems">OpacHiddenItems</a>:' > - pref: OpacHiddenItemsExceptions > - >+ - pref: OpacHiddenItemsHidesRecord >+ default: 1 >+ choices: >+ no: "Don't hide" >+ yes: Hide >+ - "biblio record when all its items are hidden by <code>OpacHiddenItems</code>." >+ - > - pref: OpacAllowPublicListCreation > default: 1 > choices: >diff --git a/opac/opac-ISBDdetail.pl b/opac/opac-ISBDdetail.pl >index 6278177e10..2d8fd7368f 100755 >--- a/opac/opac-ISBDdetail.pl >+++ b/opac/opac-ISBDdetail.pl >@@ -90,7 +90,7 @@ eval { > unless ( $patron and $patron->category->override_hidden_items ) { > # only skip this check if there's a logged in user > # and its category overrides OpacHiddenItems >- if ( $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { >+ if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $biblio->hidden_in_opac({ rules => $opachiddenitems_rules }) ) { > print $query->redirect('/cgi-bin/koha/errors/404.pl'); # escape early > exit; > } >diff --git a/opac/opac-MARCdetail.pl b/opac/opac-MARCdetail.pl >index 39cb10eecf..3211f61df3 100755 >--- a/opac/opac-MARCdetail.pl >+++ b/opac/opac-MARCdetail.pl >@@ -108,7 +108,7 @@ my $framework = $biblio ? $biblio->frameworkcode : q{}; > my $tagslib = &GetMarcStructure( 0, $framework ); > my ($tag_itemnumber,$subtag_itemnumber) = &GetMarcFromKohaField( 'items.itemnumber' ); > my @nonhiddenitems = $record->field($tag_itemnumber); >-if (scalar @all_items >= 1 && scalar @nonhiddenitems == 0) { >+if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @nonhiddenitems == 0 ) { > print $query->redirect("/cgi-bin/koha/errors/404.pl"); > exit; > } >diff --git a/opac/opac-basket.pl b/opac/opac-basket.pl >index b746abde67..cc3d975355 100755 >--- a/opac/opac-basket.pl >+++ b/opac/opac-basket.pl >@@ -96,7 +96,7 @@ foreach my $biblionumber ( @bibs ) { > my @hidden_items = GetHiddenItemnumbers({ items => \@all_items, borcat => $borcat }); > > # If every item is hidden, then the biblio should be hidden too. >- next if (scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items); >+ next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @all_items >= 1 && scalar @hidden_items == scalar @all_items); > > # copy the visible ones into the items array. > my @items; >diff --git a/opac/opac-detail.pl b/opac/opac-detail.pl >index e4e4a8341d..26d3ef0151 100755 >--- a/opac/opac-detail.pl >+++ b/opac/opac-detail.pl >@@ -106,7 +106,7 @@ if ( scalar @all_items >= 1 ) { > push @hiddenitems, > GetHiddenItemnumbers( { items => \@all_items, borcat => $borcat } ); > >- if (scalar @hiddenitems == scalar @all_items ) { >+ if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && scalar @hiddenitems == scalar @all_items ) { > print $query->redirect("/cgi-bin/koha/errors/404.pl"); # escape early > exit; > } >diff --git a/opac/opac-tags.pl b/opac/opac-tags.pl >index be3c3d5886..1f15149cb2 100755 >--- a/opac/opac-tags.pl >+++ b/opac/opac-tags.pl >@@ -270,7 +270,7 @@ if ($loggedinuser) { > borcat => $borcat }); > $hidden_items = \@hidden_itemnumbers; > } >- next if ( $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); >+ next if ( C4::Context->preference('OpacHiddenItemsHidesRecord') && $should_hide && scalar @all_items == scalar @hidden_itemnumbers ); > $tag->{title} = $biblio->title; > $tag->{subtitle} = $biblio->subtitle; > $tag->{medium} = $biblio->medium; >-- >2.11.0
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 18989
:
109656
|
109657
|
114738
|
116000
|
116001
|
116002
|
116003
|
119524
| 119784 |
119785
|
119786
|
119787
|
119788
|
120137
|
120138
|
120171
|
120431
|
120432
|
120558