Bugzilla – Attachment 173008 Details for
Bug 15728
Hide component parts from search result
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 15728: Add component records facet to OPAC
Bug-15728-Add-component-records-facet-to-OPAC.patch (text/plain), 5.65 KB, created by
Lari Taskula
on 2024-10-19 15:55:54 UTC
(
hide
)
Description:
Bug 15728: Add component records facet to OPAC
Filename:
MIME Type:
Creator:
Lari Taskula
Created:
2024-10-19 15:55:54 UTC
Size:
5.65 KB
patch
obsolete
>From c0039bf0e6e4282dee8bd390b81efb5a35dcdf0a Mon Sep 17 00:00:00 2001 >From: Lari Taskula <lari.taskula@hypernova.fi> >Date: Fri, 18 Oct 2024 21:01:03 +0000 >Subject: [PATCH] Bug 15728: Add component records facet to OPAC > >Test plan provided in "Support component records limit" commits. >--- > .../bootstrap/en/includes/opac-facets.inc | 22 ++++++++++++++++++- > opac/opac-search.pl | 21 +++++++++++++----- > 2 files changed, 37 insertions(+), 6 deletions(-) > >diff --git a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >index b133c530f8..1ee818450e 100644 >--- a/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/bootstrap/en/includes/opac-facets.inc >@@ -30,7 +30,7 @@ > <ul> > <li> > [% IF ( available ) %] >- <strong>Showing only records with available items</strong></li><li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi_not_availablity | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |uri %][% END %]">Show all records</a> >+ <strong>Showing only records with available items</strong></li><li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi_not_available | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |uri %][% END %]">Show all records</a> > [% ELSE %] > <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |uri %][% END %]&limit=available">Limit to records with available items</a> > [% END %] >@@ -39,6 +39,26 @@ > [% IF ( related ) %] <li>(related searches: [% FOREACH relate IN related %][% relate.related_search | html %][% END %])</li>[% END %] > </li> > >+ [% IF Koha.Preference("ShowComponentRecordsFacet") == 'opac' || Koha.Preference("ShowComponentRecordsFacet") == 'both' %] >+ <li id="component_record_facet"><h3 id="facet-compontent-records">Component records</h3> >+ <ul> >+ <li> >+ [% IF ( limit_exclude_component_records ) || ( limit_component_records ) %] >+ <strong>[% IF ( limit_exclude_component_records ) %]Excluding[% ELSE %]Showing only[% END %] component records</strong> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% IF ( limit_exclude_component_records ) %][% limit_cgi_not_limit_exclude_component_records %][% END %][% IF ( limit_component_records ) %][% limit_cgi_not_limit_component_records %][% END %][% IF ( sort_by ) %]&sort_by=[% sort_by | uri %][% END %]">Show all records</a> >+ [% ELSE %] >+ <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |uri %][% END %]&limit=exclude_component_records">Exclude component records</a> >+ </li> >+ <li> >+ <a href="/cgi-bin/koha/opac-search.pl?[% query_cgi | $raw %][% limit_cgi | $raw %][% IF ( sort_by ) %]&sort_by=[% sort_by |uri %][% END %]&limit=component_records">Limit to component records</a> >+ [% END # /IF limit_exclude_component_records %] >+ </li> >+ </ul> >+ </li> <!-- /#component_record_facet --> >+ [% END # /IF ShowComponentRecordsFacet %] >+ > [% FOREACH facets_loo IN facets_loop %] > [% IF facets_loo.facets.size > 0 %] > <li id="[% facets_loo.type_id | html %]"> >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index a5d80ed585..2a06a5b76e 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -440,13 +440,22 @@ if (@searchCategories > 0) { > @limits = map { uri_unescape($_) } @limits; > > >-my $available; >+my ( $available, $component_records, $exclude_component_records ); > foreach my $limit(@limits) { > if ($limit =~/available/) { > $available = 1; > } >+ elsif ( $limit =~ /^component_records$/ ) { >+ $component_records = 1; >+ } elsif ( $limit =~ /^exclude_component_records$/ ) { >+ $exclude_component_records = 1; >+ } > } >-$template->param(available => $available); >+$template->param( >+ available => $available, >+ limit_component_records => $component_records, >+ limit_exclude_component_records => $exclude_component_records, >+); > > # append year limits if they exist > if ($params->{'limit-yr'}) { >@@ -775,9 +784,11 @@ for (my $i=0;$i<@servers;$i++) { > $session->param('busc' => $pasarParams); > } > $template->param(total => $hits); >- my $limit_cgi_not_availablity = $limit_cgi; >- $limit_cgi_not_availablity =~ s/&limit=available//g if defined $limit_cgi_not_availablity; >- $template->param(limit_cgi_not_availablity => $limit_cgi_not_availablity); >+ foreach my $limit_case ( 'available', 'component_records', 'exclude_component_records' ) { >+ my $limit_cgi_not_case = $limit_cgi; >+ $limit_cgi_not_case = s/&limit=$limit_case//g if defined $limit_cgi_not_case; >+ $template->param( "limit_cgi_not_$limit_case" => $limit_cgi_not_case ); >+ } > $template->param(limit_cgi => $limit_cgi); > $template->param(countrss => $countRSS ); > $template->param(query_cgi => $query_cgi); >-- >2.34.1
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 15728
:
173001
|
173002
|
173003
|
173004
|
173005
|
173007
| 173008