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

(-)a/C4/Branch.pm (+10 lines)
Lines 46-51 BEGIN { Link Here
46
		&DelBranchCategory
46
		&DelBranchCategory
47
	        &CheckCategoryUnique
47
	        &CheckCategoryUnique
48
		&mybranch
48
		&mybranch
49
		&GetBranchesCount
49
	);
50
	);
50
	@EXPORT_OK = qw( &onlymine &mybranch get_branch_code_from_name );
51
	@EXPORT_OK = qw( &onlymine &mybranch get_branch_code_from_name );
51
}
52
}
Lines 580-585 sub get_branch_code_from_name { Link Here
580
   return $sth->fetchrow_array;
581
   return $sth->fetchrow_array;
581
}
582
}
582
583
584
sub GetBranchesCount {
585
    my $dbh = C4::Context->dbh();
586
    my $query = "SELECT COUNT(*) AS branches_count FROM branches";
587
    my $sth = $dbh->prepare( $query );
588
    $sth->execute();
589
    my $row = $sth->fetchrow_hashref();
590
    return $row->{'branches_count'};
591
}
592
583
1;
593
1;
584
__END__
594
__END__
585
595
(-)a/C4/Koha.pm (-17 / +38 lines)
Lines 23-28 package C4::Koha; Link Here
23
use strict;
23
use strict;
24
#use warnings; FIXME - Bug 2505
24
#use warnings; FIXME - Bug 2505
25
use C4::Context;
25
use C4::Context;
26
use C4::Branch qw(GetBranchesCount);
26
use Memoize;
27
use Memoize;
27
28
28
use vars qw($VERSION @ISA @EXPORT $DEBUG);
29
use vars qw($VERSION @ISA @EXPORT $DEBUG);
Lines 711-725 sub getFacets { Link Here
711
            ];
712
            ];
712
713
713
            my $library_facet;
714
            my $library_facet;
714
715
            unless ( C4::Context->preference("singleBranchMode") || GetBranchesCount() == 1 ) {
715
            $library_facet = {
716
                $library_facet = {
716
                link_value  => 'branch',
717
                    link_value  => 'branch',
717
                label_value => 'Libraries',
718
                    label_value => 'Libraries',
718
                tags        => [ '995', ],
719
                    tags        => [ '995', ],
719
                subfield    => 'b',
720
                    subfield    => 'b',
720
                expanded    => '1',
721
                    expanded    => '1',
721
            };
722
                };
722
            push @$facets, $library_facet unless C4::Context->preference("singleBranchMode");
723
            } else {
724
                $library_facet = {
725
                    link_value  => 'location',
726
                    label_value => 'Location',
727
                    tags        => [ '995' ],
728
                    subfield    => 'c',
729
                    expanded    => '1',
730
                };
731
            }
732
            push( @$facets, $library_facet );
723
    }
733
    }
724
    else {
734
    else {
725
        $facets = [
735
        $facets = [
Lines 761-775 sub getFacets { Link Here
761
                subfield    => 'a',
771
                subfield    => 'a',
762
            },
772
            },
763
            ];
773
            ];
774
            
764
            my $library_facet;
775
            my $library_facet;
765
            $library_facet = {
776
            unless ( C4::Context->preference("singleBranchMode") || GetBranchesCount() == 1 ) {
766
                link_value  => 'branch',
777
                $library_facet = {
767
                label_value => 'Libraries',
778
                    link_value  => 'branch',
768
                tags        => [ '952', ],
779
                    label_value => 'Libraries',
769
                subfield    => 'b',
780
                    tags        => [ '952', ],
770
                expanded    => '1',
781
                    subfield    => 'b',
771
            };
782
                    expanded    => '1',
772
            push @$facets, $library_facet unless C4::Context->preference("singleBranchMode");
783
                };
784
            } else {
785
                $library_facet = {
786
                    link_value => 'location',
787
                    label_value => 'Location',
788
                    tags => [ '952' ],
789
                    subfield => 'c',
790
                    expanded => '1',
791
                };
792
            }
793
            push( @$facets, $library_facet );
773
    }
794
    }
774
    return $facets;
795
    return $facets;
775
}
796
}
(-)a/C4/Search.pm (-1 / +6 lines)
Lines 303-309 sub getRecords { Link Here
303
    my (
303
    my (
304
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
304
        $koha_query,       $simple_query, $sort_by_ref,    $servers_ref,
305
        $results_per_page, $offset,       $expanded_facet, $branches,
305
        $results_per_page, $offset,       $expanded_facet, $branches,
306
        $query_type,       $scan
306
        $query_type,       $scan,         $opac
307
    ) = @_;
307
    ) = @_;
308
308
309
    my @servers = @$servers_ref;
309
    my @servers = @$servers_ref;
Lines 564-569 sub getRecords { Link Here
564
								}
564
								}
565
                            }
565
                            }
566
566
567
                            # also, if it's a location code, use the name instead of the code
568
                            if ( $link_value =~ /location/ ) {
569
                                $facet_label_value = GetKohaAuthorisedValueLib('LOC', $one_facet, $opac) || '*';
570
                            }
571
567
                            # but we're down with the whole label being in the link's title.
572
                            # but we're down with the whole label being in the link's title.
568
                            push @this_facets_array, {
573
                            push @this_facets_array, {
569
                                facet_count       => $facets_counter->{$link_value}->{$one_facet},
574
                                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 (+1 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 %]
20
<ul>
21
<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 ) %]
22
        [% 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>
23
        <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 452-458 elsif (C4::Context->preference('NoZebra')) { Link Here
452
    $pasarParams .= '&amp;simple_query=' . $simple_query;
452
    $pasarParams .= '&amp;simple_query=' . $simple_query;
453
    $pasarParams .= '&amp;query_type=' . $query_type if ($query_type);
453
    $pasarParams .= '&amp;query_type=' . $query_type if ($query_type);
454
    eval {
454
    eval {
455
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
455
        ($error, $results_hashref, $facets) = getRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan,1);
456
    };
456
    };
457
}
457
}
458
# This sorts the facets into alphabetical order
458
# This sorts the facets into alphabetical order
459
- 

Return to bug 7401