View | Details | Raw Unified | Return to bug 7401
Collapse All | Expand All

(-)a/C4/Koha.pm (-16 / +39 lines)
Lines 24-29 use strict; Link Here
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
use C4::Context;
25
use C4::Context;
26
use C4::Output;
26
use C4::Output;
27
use C4::Branch qw(GetBranchesLoop);
27
use URI::Split qw(uri_split);
28
use URI::Split qw(uri_split);
28
use Memoize;
29
use Memoize;
29
use Business::ISBN;
30
use Business::ISBN;
Lines 677-682 sub getallthemes { Link Here
677
678
678
sub getFacets {
679
sub getFacets {
679
    my $facets;
680
    my $facets;
681
    my @branchloop = GetBranchesLoop();
680
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
682
    if ( C4::Context->preference("marcflavour") eq "UNIMARC" ) {
681
        $facets = [
683
        $facets = [
682
            {
684
            {
Lines 714-727 sub getFacets { Link Here
714
716
715
            my $library_facet;
717
            my $library_facet;
716
718
717
            $library_facet = {
719
            if (@branchloop > 1) {
718
                link_value  => 'branch',
720
                $library_facet = {
719
                label_value => 'Libraries',
721
                    link_value  => 'branch',
720
                tags        => [ '995', ],
722
                    label_value => 'Libraries',
721
                subfield    => 'b',
723
                    tags        => [ '995', ],
722
                expanded    => '1',
724
                    subfield    => 'b',
723
            };
725
                    expanded    => '1',
724
            push @$facets, $library_facet unless C4::Context->preference("singleBranchMode");
726
                };
727
            } else {
728
                $library_facet = {
729
                    link_value  => 'location',
730
                    label_value => 'Location',
731
                    tags        => [ '995', ],
732
                    subfield    => 'c',
733
                    expanded    => '1',
734
                };
735
            }
736
            push @$facets, $library_facet;
725
    }
737
    }
726
    else {
738
    else {
727
        $facets = [
739
        $facets = [
Lines 764-777 sub getFacets { Link Here
764
            },
776
            },
765
            ];
777
            ];
766
            my $library_facet;
778
            my $library_facet;
767
            $library_facet = {
779
            if (@branchloop > 1) {
768
                link_value  => 'branch',
780
                $library_facet = {
769
                label_value => 'Libraries',
781
                    link_value  => 'branch',
770
                tags        => [ '952', ],
782
                    label_value => 'Libraries',
771
                subfield    => 'b',
783
                    tags        => [ '952', ],
772
                expanded    => '1',
784
                    subfield    => 'b',
773
            };
785
                    expanded    => '1',
774
            push @$facets, $library_facet unless C4::Context->preference("singleBranchMode");
786
                };
787
            } else {
788
                $library_facet = {
789
                    link_value  => 'location',
790
                    label_value => 'Location',
791
                    tags        => [ '952', ],
792
                    subfield    => 'c',
793
                    expanded    => '1',
794
                };
795
            }
796
797
            push @$facets, $library_facet;
775
    }
798
    }
776
    return $facets;
799
    return $facets;
777
}
800
}
(-)a/C4/Search.pm (-3 / +8 lines)
Lines 287-299 sub SimpleSearch { Link Here
287
287
288
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
288
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
289
        $results_per_page, $offset,       $expanded_facet, $branches,
289
        $results_per_page, $offset,       $expanded_facet, $branches,
290
        $query_type,       $scan
290
        $query_type,       $scan,         $opac
291
    );
291
    );
292
292
293
The all singing, all dancing, multi-server, asynchronous, scanning,
293
The all singing, all dancing, multi-server, asynchronous, scanning,
294
searching, record nabbing, facet-building
294
searching, record nabbing, facet-building
295
295
296
See verbse embedded documentation.
296
See verbose embedded documentation.
297
297
298
=cut
298
=cut
299
299
Lines 301-307 sub getRecords { Link Here
301
    my (
301
    my (
302
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
302
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
303
        $results_per_page, $offset,       $expanded_facet, $branches,
303
        $results_per_page, $offset,       $expanded_facet, $branches,
304
        $query_type,       $scan
304
        $query_type,       $scan,         $opac
305
    ) = @_;
305
    ) = @_;
306
306
307
    my @servers = @$servers_ref;
307
    my @servers = @$servers_ref;
Lines 562-567 sub getRecords { Link Here
562
								}
562
								}
563
                            }
563
                            }
564
564
565
                            # also, if it's a location code, use the name instead of code
566
                            if ( $link_value =~ /location/ ) {
567
                                $facet_label_value = GetKohaAuthorisedValueLib('LOC', $one_facet, $opac) || '*';
568
                            }
569
565
                            # but we're down with the whole label being in the link's title.
570
                            # but we're down with the whole label being in the link's title.
566
                            push @this_facets_array, {
571
                            push @this_facets_array, {
567
                                facet_count       => $facets_counter->{$link_value}->{$one_facet},
572
                                facet_count       => $facets_counter->{$link_value}->{$one_facet},
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/facets.inc (+1 lines)
Lines 16-21 Link Here
16
[% IF ( facets_loo.type_label_Places ) %]Places[% END %]
16
[% IF ( facets_loo.type_label_Places ) %]Places[% END %]
17
[% IF ( facets_loo.type_label_Series ) %]Series[% END %]
17
[% IF ( facets_loo.type_label_Series ) %]Series[% END %]
18
[% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
18
[% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
19
[% IF ( facets_loo.type_label_Location ) %]Locations[% END %]
19
<ul>
20
<ul>
20
        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;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 ) %]
21
        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;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 ) %]
21
        <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %][% IF ( offset ) %]&amp;offset=[% offset %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
22
        <li class="showmore"><a href="/cgi-bin/koha/catalogue/search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %][% IF ( offset ) %]&amp;offset=[% offset %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
(-)a/koha-tmpl/opac-tmpl/prog/en/includes/opac-facets.inc (+2 lines)
Lines 17-22 Link Here
17
[% UNLESS ( singleBranchMode ) %]
17
[% UNLESS ( singleBranchMode ) %]
18
[% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
18
[% IF ( facets_loo.type_label_Libraries ) %]Libraries[% END %]
19
[% END %]
19
[% END %]
20
[% IF ( facets_loo.type_label_Location ) %]Locations[% END %]
21
20
<ul>
22
<ul>
21
        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;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 ) %]
23
        [% FOREACH facet IN facets_loo.facets %]<li><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %]&amp;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 ) %]
22
        <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %][% IF ( offset ) %]&amp;offset=[% offset %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
24
        <li class="showmore"><a href="/cgi-bin/koha/opac-search.pl?[% query_cgi |html %][% limit_cgi |html %][% IF ( sort_by ) %]&amp;sort_by=[% sort_by %][% END %][% IF ( offset ) %]&amp;offset=[% offset %][% END %]&amp;expand=[% facets_loo.expand %]#[% facets_loo.type_id %]">Show More</a></li>
(-)a/opac/opac-search.pl (-2 / +1 lines)
Lines 454-460 elsif (C4::Context->preference('NoZebra')) { Link Here
454
    $pasarParams .= '&amp;simple_query=' . $simple_query;
454
    $pasarParams .= '&amp;simple_query=' . $simple_query;
455
    $pasarParams .= '&amp;query_type=' . $query_type if ($query_type);
455
    $pasarParams .= '&amp;query_type=' . $query_type if ($query_type);
456
    eval {
456
    eval {
457
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
457
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan,1);
458
    };
458
    };
459
}
459
}
460
# This sorts the facets into alphabetical order
460
# This sorts the facets into alphabetical order
461
- 

Return to bug 7401