Bugzilla – Attachment 7700 Details for
Bug 7401
Show shelving location facet instead of branch facet when only 1 branch configured
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 7401 - Shelving Location facet instead of Branch facet when only 1 branch configured
Bug-7401---Shelving-Location-facet-instead-of-Bran.patch (text/plain), 7.49 KB, created by
Kyle M Hall
on 2012-02-16 17:33:23 UTC
(
hide
)
Description:
Bug 7401 - Shelving Location facet instead of Branch facet when only 1 branch configured
Filename:
MIME Type:
Creator:
Kyle M Hall
Created:
2012-02-16 17:33:23 UTC
Size:
7.49 KB
patch
obsolete
>From ba11034a75faa1af4dee21a502194309fcf0f1d8 Mon Sep 17 00:00:00 2001 >From: Ian Walls <ian.walls@bywatersolutions.com> >Date: Thu, 16 Feb 2012 12:09:44 -0500 >Subject: [PATCH] Bug 7401 - Shelving Location facet instead of Branch facet when only 1 branch configured > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> > >Did some minor re-working so it uses the singleBranchMode >system pref, instead of counting the number or branches. >--- > C4/Koha.pm | 54 +++++++++++++------ > C4/Search.pm | 7 ++- > .../intranet-tmpl/prog/en/includes/facets.inc | 1 + > .../opac-tmpl/prog/en/includes/opac-facets.inc | 1 + > opac/opac-search.pl | 2 +- > 5 files changed, 46 insertions(+), 19 deletions(-) > >diff --git a/C4/Koha.pm b/C4/Koha.pm >index 976b46a..70cb915 100644 >--- a/C4/Koha.pm >+++ b/C4/Koha.pm >@@ -711,15 +711,24 @@ sub getFacets { > ]; > > my $library_facet; >- >- $library_facet = { >- link_value => 'branch', >- label_value => 'Libraries', >- tags => [ '995', ], >- subfield => 'b', >- expanded => '1', >- }; >- push @$facets, $library_facet unless C4::Context->preference("singleBranchMode"); >+ unless ( C4::Context->preference("singleBranchMode") ) { >+ $library_facet = { >+ link_value => 'branch', >+ label_value => 'Libraries', >+ tags => [ '995', ], >+ subfield => 'b', >+ expanded => '1', >+ }; >+ } else { >+ $library_facet = { >+ link_value => 'location', >+ label_value => 'Location', >+ tags => [ '995' ], >+ subfield => 'c', >+ expanded => '1', >+ }; >+ } >+ push( @$facets, $library_facet ); > } > else { > $facets = [ >@@ -761,15 +770,26 @@ sub getFacets { > subfield => 'a', > }, > ]; >+ > my $library_facet; >- $library_facet = { >- link_value => 'branch', >- label_value => 'Libraries', >- tags => [ '952', ], >- subfield => 'b', >- expanded => '1', >- }; >- push @$facets, $library_facet unless C4::Context->preference("singleBranchMode"); >+ unless ( C4::Context->preference("singleBranchMode") ) { >+ $library_facet = { >+ link_value => 'branch', >+ label_value => 'Libraries', >+ tags => [ '952', ], >+ subfield => 'b', >+ expanded => '1', >+ }; >+ } else { >+ $library_facet = { >+ link_value => 'location', >+ label_value => 'Location', >+ tags => [ '952' ], >+ subfield => 'c', >+ expanded => '1', >+ }; >+ } >+ push( @$facets, $library_facet ); > } > return $facets; > } >diff --git a/C4/Search.pm b/C4/Search.pm >index e86bb26..09a5134 100644 >--- a/C4/Search.pm >+++ b/C4/Search.pm >@@ -303,7 +303,7 @@ sub getRecords { > my ( > $koha_query, $simple_query, $sort_by_ref, $servers_ref, > $results_per_page, $offset, $expanded_facet, $branches, >- $query_type, $scan >+ $query_type, $scan, $opac > ) = @_; > > my @servers = @$servers_ref; >@@ -564,6 +564,11 @@ sub getRecords { > } > } > >+ # also, if it's a location code, use the name instead of the code >+ if ( $link_value =~ /location/ ) { >+ $facet_label_value = GetKohaAuthorisedValueLib('LOC', $one_facet, $opac) || '*'; >+ } >+ > # but we're down with the whole label being in the link's title. > push @this_facets_array, { > facet_count => $facets_counter->{$link_value}->{$one_facet}, >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >index a72b586..bacbfaf 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc >@@ -16,6 +16,7 @@ > [% IF ( facets_loo.type_label_Places ) %]Places[% END %] > [% IF ( facets_loo.type_label_Series ) %]Series[% END %] > [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] >+[% IF ( facets_loo.type_label_Location ) %]Locations[% 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 ) %] > <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li> >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 ccb37b0..1afe7f6 100644 >--- a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >+++ b/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc >@@ -17,6 +17,7 @@ > [% UNLESS ( singleBranchMode ) %] > [% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %] > [% END %] >+[% IF ( facets_loo.type_label_Location ) %]Locations[% END %] > <ul> > [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-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 |html %]">[% facet.facet_label_value %]</a> [% IF ( displayFacetCount ) %]([% facet.facet_count %])[% END %]</li>[% END %][% IF ( facets_loo.expandable ) %] > <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&sort_by=[% sort_by %][% END %][% IF ( offset ) %]&offset=[% offset %][% END %]&expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li> >diff --git a/opac/opac-search.pl b/opac/opac-search.pl >index 87d2890..8edb0ea 100755 >--- a/opac/opac-search.pl >+++ b/opac/opac-search.pl >@@ -452,7 +452,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,$query_type,$scan,1); > }; > } > # 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 7401
:
7040
|
7700
|
7741
|
8188
|
8189
|
10154
|
10210
|
10756
|
10817
|
10877
|
12241
|
12253
|
12254