From 6893aca98387600815dcd83bedbeb126e0e087c0 Mon Sep 17 00:00:00 2001 From: Lari Taskula Date: Fri, 18 Oct 2024 20:32:10 +0000 Subject: [PATCH] Bug 15728: Add component records facet to staff client Test plan provided in "Support component records limit" commits. --- catalogue/search.pl | 21 +++++++++++++---- .../intranet-tmpl/prog/en/includes/facets.inc | 23 ++++++++++++++++++- 2 files changed, 38 insertions(+), 6 deletions(-) diff --git a/catalogue/search.pl b/catalogue/search.pl index ba97a75f1c..0555b58833 100755 --- a/catalogue/search.pl +++ b/catalogue/search.pl @@ -400,13 +400,22 @@ if ($operands[0] && !$operands[1]) { $basic_search=1; } -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 my $limit_yr; @@ -648,9 +657,11 @@ for (my $i=0;$i<@servers;$i++) { if ($hits) { $template->param(total => $hits); if ($limit_cgi) { - my $limit_cgi_not_availablity = $limit_cgi; - $limit_cgi_not_availablity =~ s/&limit=available//g; - $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(DisplayMultiPlaceHold => $DisplayMultiPlaceHold); if ($query_desc || $limit_desc) { diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc index 2e54fcb523..4ced1c2d8d 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc +++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc @@ -34,7 +34,7 @@ Showing only records with available items
  • - Show all records + Show all records [% ELSE %] Limit to records with available items [% END # /IF available %] @@ -47,6 +47,27 @@ [% END %]
  • + [% IF Koha.Preference("ShowComponentRecordsFacet") == 'staff' || Koha.Preference("ShowComponentRecordsFacet") == 'both' %] +
  • + Component records + +
  • + [% END # /IF ShowComponentRecordsFacet %] + [% FOREACH facets_loo IN facets_loop %] [% IF facets_loo.facets.size > 0 %]
  • -- 2.34.1