Bugzilla – Attachment 10184 Details for
Bug 4255
Add item type to facet list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
[SIGNED-OFF] Bug 4255 - Add item type to facet list
SIGNED-OFF-Bug-4255---Add-item-type-to-facet-list.patch (text/plain), 6.33 KB, created by
Kyle M Hall
on 2012-06-11 11:27:26 UTC
(
hide
)
Description:
[SIGNED-OFF] Bug 4255 - Add item type to facet list
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-06-11 11:27:26 UTC
Size:
6.33 KB
patch
obsolete
>From bc00dd6a82a747fc58d1f9a42312b2f25cffe097 Mon Sep 17 00:00:00 2001 >From: Meenakshi.R <meenakshi.r@osslabs.biz> >Date: Wed, 30 May 2012 16:06:33 +0530 >Subject: [PATCH] [SIGNED-OFF] Bug 4255 - Add item type to facet list > >This is for MARC 21 only. > >Made following changed: > >- In getFacets in C4/Koha.pm added item type facet for 952y and 942c >- In getRecords in C4:Search.pm added code to get description of itemtype codes >- facets.inc in both staff and opac to show item types related label in the facets block > >To test: > >Add records such that a certain itype (say BK) is present in both 942c and 952y in two DIFFERENT records. > >Run a search where both test records are present. Test to see if itype types are presented in the facets block (both OPAC and staff). > >Click on the itype (say BK), both the test records should appear in the refined results. This shows that the feature works for both 942c and 952y. > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > C4/Koha.pm | 6 ++++++ > C4/Search.pm | 15 +++++++++++++-- > catalogue/search.pl | 2 +- > .../intranet-tmpl/prog/en/includes/facets.inc | 1 + > .../opac-tmpl/prog/en/includes/opac-facets.inc | 1 + > opac/opac-search.pl | 2 +- > 6 files changed, 23 insertions(+), 4 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index ebb3eed..5698990 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -760,6 +760,12 @@ sub getFacets { > tags => [ qw/ 440a 490a / ], > sep => ', ', > }, >+ { >+ idx => 'itype', >+ label => 'ItemTypes', >+ tags => [ qw/ 952y 942c / ], >+ sep => ', ', >+ }, > ]; > my $library_facet; > $library_facet = { >diff --git a/C4/Search.pm b/C4/Search.pm >index c786080..d706e31 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -287,7 +287,7 @@ sub SimpleSearch { > ( undef, $results_hashref, \@facets_loop ) = getRecords ( > > $koha_query, $simple_query, $sort_by_ref, $servers_ref, >- $results_per_page, $offset, $expanded_facet, $branches, >+ $results_per_page, $offset, $expanded_facet, $branches,$itemtypes, > $query_type, $scan > ); > >@@ -301,7 +301,7 @@ See verbse embedded documentation. > sub getRecords { > my ( > $koha_query, $simple_query, $sort_by_ref, $servers_ref, >- $results_per_page, $offset, $expanded_facet, $branches, >+ $results_per_page, $offset, $expanded_facet, $branches,$itemtypes, > $query_type, $scan > ) = @_; > >@@ -555,6 +555,17 @@ sub getRecords { > $facet_label_value = "*"; > } > } >+ # if it's a itemtype, label by the name, not the code, >+ if ( $link_value =~ /itype/ ) { >+ if (defined $itemtypes >+ && ref($itemtypes) eq "HASH" >+ && defined $itemtypes->{$one_facet} >+ && ref ($itemtypes->{$one_facet}) eq "HASH") >+ { >+ $facet_label_value = >+ $itemtypes->{$one_facet}->{'description'}; >+ } >+ } > > # but we're down with the whole label being in the link's title. > push @this_facets_array, { >diff --git a/catalogue/search.pl b/catalogue/search.pl >index 0052f66..2171df0 100755 >--- a/catalogue/search.pl >+++ b/catalogue/search.pl >@@ -529,7 +529,7 @@ if (C4::Context->preference('NoZebra')) { > }; > } else { > eval { >- ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); >+ ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan); > }; > } > # This sorts the facets into alphabetical order >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index e74bced..d3c0449 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >@@ -15,6 +15,7 @@ > [% IF ( facets_loo.type_label_Topics ) %]Topics[% END %] > [% IF ( facets_loo.type_label_Places ) %]Places[% END %] > [% IF ( facets_loo.type_label_Series ) %]Series[% END %] >+[% IF ( facets_loo.type_label_ItemTypes ) %]ItemTypes[% END %] > [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] > <ul> > [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %]&limit=[% facet.type_link_value %]:[% facet.facet_link_value %]" title="[% facet.facet_title_value %]">[% facet.facet_label_value %]</a> [% IF ( displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %] >diff --git a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >index b3c1bc3..288e2ec 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >@@ -14,6 +14,7 @@ > [% IF ( facets_loo.type_label_Topics ) %]Topics[% END %] > [% IF ( facets_loo.type_label_Places ) %]Places[% END %] > [% IF ( facets_loo.type_label_Series ) %]Series[% END %] >+[% IF ( facets_loo.type_label_ItemTypes ) %]ItemTypes[% END %] > [% UNLESS ( singleBranchMode ) %] > [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] > [% END %] >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 5f3ad86..7eeebbd 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -475,7 +475,7 @@ elsif (C4::Context->preference('NoZebra')) { > $pasarParams .= '&simple_query=' . $simple_query; > $pasarParams .= '&query_type=' . $query_type if ($query_type); > eval { >- ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan); >+ ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$itemtypes,$query_type,$scan); > }; > } > # This sorts the facets into alphabetical order >-- >1.7.2.5
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 4255
:
9847
|
10184
|
10296