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

(-)a/C4/Search.pm (-2 / +2 lines)
Lines 440-446 sub getRecords { Link Here
440
                # loop through the results
440
                # loop through the results
441
                $results_hash->{'hits'} = $size;
441
                $results_hash->{'hits'} = $size;
442
                my $times;
442
                my $times;
443
                if ( $offset + $results_per_page <= $size ) {
443
                if ( $results_per_page != 'all' && ($offset + $results_per_page <= $size) ) {
444
                    $times = $offset + $results_per_page;
444
                    $times = $offset + $results_per_page;
445
                }
445
                }
446
                else {
446
                else {
Lines 1850-1856 sub searchResults { Link Here
1850
1850
1851
    # handle which records to actually retrieve
1851
    # handle which records to actually retrieve
1852
    my $times;
1852
    my $times;
1853
    if ( $hits && $offset + $results_per_page <= $hits ) {
1853
    if ( $hits && $results_per_page != 'all' && ($offset + $results_per_page <= $hits) ) {
1854
        $times = $offset + $results_per_page;
1854
        $times = $offset + $results_per_page;
1855
    }
1855
    }
1856
    else {
1856
    else {
(-)a/catalogue/search.pl (-4 / +4 lines)
Lines 474-483 for (my $ii = 0; $ii < @operands; ++$ii) Link Here
474
# Params that can only have one value
474
# Params that can only have one value
475
my $scan = $params->{'scan'};
475
my $scan = $params->{'scan'};
476
my $count = C4::Context->preference('numSearchResults') || 20;
476
my $count = C4::Context->preference('numSearchResults') || 20;
477
my $results_per_page = $params->{'count'} || $count;
477
my $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page") || $count;
478
my $offset = $params->{'offset'} || 0;
479
my $page = $cgi->param('page') || 1;
478
my $page = $cgi->param('page') || 1;
480
#my $offset = ($page-1)*$results_per_page;
479
my $offset = $results_per_page != 'all' ? ($page-1)*$results_per_page : 0;
481
my $hits;
480
my $hits;
482
my $expanded_facet = $params->{'expand'};
481
my $expanded_facet = $params->{'expand'};
483
482
Lines 549-554 for (my $i=0;$i<@servers;$i++) { Link Here
549
    my $server = $servers[$i];
548
    my $server = $servers[$i];
550
    if ($server =~/biblioserver/) { # this is the local bibliographic server
549
    if ($server =~/biblioserver/) { # this is the local bibliographic server
551
        $hits = $results_hashref->{$server}->{"hits"};
550
        $hits = $results_hashref->{$server}->{"hits"};
551
        $results_per_page = $hits if $results_per_page == 'all';
552
        my $page = $cgi->param('page') || 0;
552
        my $page = $cgi->param('page') || 0;
553
        my @newresults = searchResults('intranet', $query_desc, $hits, $results_per_page, $offset, $scan,
553
        my @newresults = searchResults('intranet', $query_desc, $hits, $results_per_page, $offset, $scan,
554
                                       $results_hashref->{$server}->{"RECORDS"});
554
                                       $results_hashref->{$server}->{"RECORDS"});
Lines 612-618 for (my $i=0;$i<@servers;$i++) { Link Here
612
            if ($query_desc || $limit_desc) {
612
            if ($query_desc || $limit_desc) {
613
                $template->param(searchdesc => 1);
613
                $template->param(searchdesc => 1);
614
            }
614
            }
615
            $template->param(results_per_page =>  $results_per_page);
615
            $template->param(results_per_page =>  $results_per_page == $hits ? 'all' : $results_per_page);
616
            # must define a value for size if not present in DB
616
            # must define a value for size if not present in DB
617
            # in order to avoid problems generated by the default size value in TT
617
            # in order to avoid problems generated by the default size value in TT
618
            foreach my $line (@newresults) {
618
            foreach my $line (@newresults) {
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/catalogue/results.tt (-4 / +19 lines)
Lines 95-103 $("#forgetholdfor").click(function(){ Link Here
95
    $(".btn-group").removeClass("open");
95
    $(".btn-group").removeClass("open");
96
    return false;
96
    return false;
97
});
97
});
98
$('#sortbyform').find("input:submit").hide();
98
$('#resultoptionsform').find("input:submit").hide();
99
$('#sort_by').change(function() {
99
$('#sort_by').change(function() {
100
        $('#sortbyform').submit();
100
        $('#resultoptionsform').submit();
101
    });
102
$('#results_per_page').change(function() {
103
        $.cookie('results_per_page', $(this).val());
104
        $('#resultoptionsform').submit();
101
    });
105
    });
102
        var param1 = "<label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
106
        var param1 = "<label for=\"addto\">"+_("Add to:")+"<\/label><select name=\"addto\" id=\"addto\"><option value=\"\"><\/option>";
103
        [% IF ( intranetbookbag ) %]     param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>"; [% END %]
107
        [% IF ( intranetbookbag ) %]     param1 += "<option value=\"addtocart\">"+_("Cart")+"<\/option>"; [% END %]
Lines 317-323 var holdForPatron = function () { Link Here
317
321
318
    [% IF ( total ) %]
322
    [% IF ( total ) %]
319
        <div id="searchheader">
323
        <div id="searchheader">
320
            <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="sortbyform">
324
            <form action="/cgi-bin/koha/catalogue/search.pl" method="get" id="resultoptionsform">
321
                [% IF ( searchdesc ) %]
325
                [% IF ( searchdesc ) %]
322
                    [% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
326
                    [% FOREACH QUERY_INPUT IN QUERY_INPUTS %]
323
                    <input type="hidden" name="[% QUERY_INPUT.input_name |html %]" value="[% QUERY_INPUT.input_value |html %]"/>
327
                    <input type="hidden" name="[% QUERY_INPUT.input_name |html %]" value="[% QUERY_INPUT.input_value |html %]"/>
Lines 331-338 var holdForPatron = function () { Link Here
331
                    <select id="sort_by" name="sort_by">
335
                    <select id="sort_by" name="sort_by">
332
                    [% INCLUDE 'resort_form.inc' %]
336
                    [% INCLUDE 'resort_form.inc' %]
333
                    </select>
337
                    </select>
334
                    <input type="submit" value="Go" />
335
                <!-- RESORT END -->
338
                <!-- RESORT END -->
339
                <!-- RESULTS_PER_PAGE START -->
340
                    <label for="results_per_page">Results per page: </label>
341
                    <select id="results_per_page" name="results_per_page">
342
                        <option value="20" [% 'SELECTED' IF results_per_page == '20' %]>20</option>
343
                        <option value="40" [% 'SELECTED' IF results_per_page == '40' %]>40</option>
344
                        <option value="60" [% 'SELECTED' IF results_per_page == '60' %]>60</option>
345
                        <option value="80" [% 'SELECTED' IF results_per_page == '80' %]>80</option>
346
                        <option value="100" [% 'SELECTED' IF results_per_page == '100' %]>100</option>
347
                        <option value="all" [% 'SELECTED' IF results_per_page == 'all' %]>all</option>
348
                    </select>
349
                <!-- RESULTS_PER_PAGE END -->
350
                    <input type="submit" value="Go" />
336
            </form>
351
            </form>
337
            <h3>
352
            <h3>
338
                [% total %] result(s) found [% IF ( query_desc ) %]for <span style="font-weight: bold;">'[% query_desc |html %]'</span>[% END %][% IF limit_desc  %]&nbsp;with limit(s): <span style="font-weight: bold;">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName %] Catalog[% END %].<br />&nbsp;
353
                [% total %] result(s) found [% IF ( query_desc ) %]for <span style="font-weight: bold;">'[% query_desc |html %]'</span>[% END %][% IF limit_desc  %]&nbsp;with limit(s): <span style="font-weight: bold;">'[% limit_desc | html %]'</span>[% END %][% IF ( LibraryName ) %] in [% LibraryName %] Catalog[% END %].<br />&nbsp;
(-)a/koha-tmpl/opac-tmpl/bootstrap/en/modules/opac-results.tt (+15 lines)
Lines 145-150 Link Here
145
                                    [% UNLESS tag %]
145
                                    [% UNLESS tag %]
146
                                        <div class="sort_by pull-right">
146
                                        <div class="sort_by pull-right">
147
                                            <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
147
                                            <select id="sort_by" class="resort" name="sort_by"> [% INCLUDE 'resort_form.inc' %] </select>
148
149
                                            <label for="results_per_page">Results per page: </label>
150
                                            <select id="results_per_page" name="results_per_page">
151
                                                <option value="20" [% 'SELECTED' IF results_per_page == '20' %]>20</option>
152
                                                <option value="40" [% 'SELECTED' IF results_per_page == '40' %]>40</option>
153
                                                <option value="60" [% 'SELECTED' IF results_per_page == '60' %]>60</option>
154
                                                <option value="80" [% 'SELECTED' IF results_per_page == '80' %]>80</option>
155
                                                <option value="100" [% 'SELECTED' IF results_per_page == '100' %]>100</option>
156
                                                <option value="all" [% 'SELECTED' IF results_per_page == 'all' %]>all</option>
157
                                            </select>
158
148
                                            <input type="submit" class="btn btn-small clearfix" id="sortsubmit" value="Go" />
159
                                            <input type="submit" class="btn btn-small clearfix" id="sortsubmit" value="Go" />
149
                                        </div>
160
                                        </div>
150
                                    [% END %]
161
                                    [% END %]
Lines 786-791 $(document).ready(function(){ Link Here
786
    $('.resort').change(function() {
797
    $('.resort').change(function() {
787
        $('#bookbag_form').submit();
798
        $('#bookbag_form').submit();
788
    });
799
    });
800
    $('#results_per_page').change(function() {
801
        $.cookie('results_per_page', $(this).val());
802
        $('#bookbag_form').submit();
803
    });
789
    $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
804
    $("span.clearall").html("<a id=\"CheckNone\" href=\"#\">"+_("Clear all")+"<\/a>");
790
    $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
805
    $("span.checkall").html("<a id=\"CheckAll\" href=\"#\">"+_("Select all")+"<\/a>");
791
806
(-)a/opac/opac-search.pl (-5 / +10 lines)
Lines 510-519 if ($params->{'limit-yr'}) { Link Here
510
my $scan = $params->{'scan'};
510
my $scan = $params->{'scan'};
511
my $count = C4::Context->preference('OPACnumSearchResults') || 20;
511
my $count = C4::Context->preference('OPACnumSearchResults') || 20;
512
my $countRSS         = C4::Context->preference('numSearchRSSResults') || 50;
512
my $countRSS         = C4::Context->preference('numSearchRSSResults') || 50;
513
my $results_per_page = $params->{'count'} || $count;
513
my $results_per_page = $params->{'results_per_page'} || $cgi->cookie("results_per_page") || $count;
514
my $offset = $params->{'offset'} || 0;
515
my $page = $cgi->param('page') || 1;
514
my $page = $cgi->param('page') || 1;
516
$offset = ($page-1)*$results_per_page if $page>1;
515
my $offset = $results_per_page != 'all' ? ($page-1)*$results_per_page : 0;
517
my $hits;
516
my $hits;
518
my $expanded_facet = $params->{'expand'};
517
my $expanded_facet = $params->{'expand'};
519
518
Lines 594-599 if ($tag) { Link Here
594
    # FIXME: No facets for tags search.
593
    # FIXME: No facets for tags search.
595
} elsif ($build_grouped_results) {
594
} elsif ($build_grouped_results) {
596
    eval {
595
    eval {
596
        unless($results_per_page =~ /\d+/) { # all
597
            # pazpar2 expects $results_per_page to be an integer, we hack around
598
            # this by setting $results_per_page to the max value of a 32bit
599
            # signed int - as defined by parpaz2 session.c:perform_termlist()
600
            $results_per_page = 2147483647;
601
        }
597
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
602
        ($error, $results_hashref, $facets) = C4::Search::pazGetRecords($query,$simple_query,\@sort_by,\@servers,$results_per_page,$offset,$expanded_facet,$branches,$query_type,$scan);
598
    };
603
    };
599
} else {
604
} else {
Lines 627-632 for (my $i=0;$i<@servers;$i++) { Link Here
627
    my $server = $servers[$i];
632
    my $server = $servers[$i];
628
    if ($server && $server =~/biblioserver/) { # this is the local bibliographic server
633
    if ($server && $server =~/biblioserver/) { # this is the local bibliographic server
629
        $hits = $results_hashref->{$server}->{"hits"};
634
        $hits = $results_hashref->{$server}->{"hits"};
635
        $results_per_page = $hits if $results_per_page == 'all';
630
        my $page = $cgi->param('page') || 0;
636
        my $page = $cgi->param('page') || 0;
631
        my @newresults;
637
        my @newresults;
632
        if ($build_grouped_results) {
638
        if ($build_grouped_results) {
Lines 778-784 for (my $i=0;$i<@servers;$i++) { Link Here
778
            if ($query_desc || $limit_desc) {
784
            if ($query_desc || $limit_desc) {
779
                $template->param(searchdesc => 1);
785
                $template->param(searchdesc => 1);
780
            }
786
            }
781
            $template->param(results_per_page =>  $results_per_page);
787
            $template->param(results_per_page =>  $results_per_page == $hits ? 'all' : $results_per_page);
782
            my $hide = C4::Context->preference('OpacHiddenItems');
788
            my $hide = C4::Context->preference('OpacHiddenItems');
783
            $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
789
            $hide = ($hide =~ m/\S/) if $hide; # Just in case it has some spaces/new lines
784
            my $branch = '';
790
            my $branch = '';
785
- 

Return to bug 14715