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

(-)a/C4/HoldsQueue.pm (-2 / +20 lines)
Lines 129-135 Returns hold queue for a holding branch. If branch is omitted, then whole queue Link Here
129
=cut
129
=cut
130
130
131
sub GetHoldsQueueItems {
131
sub GetHoldsQueueItems {
132
    my ($branchlimit) = @_;
132
    my ($branchlimit, $limit, $page) = @_;
133
134
    $limit ||= 20;
135
    $page  ||= 1;
136
137
    my $offset = 0 + ( $limit * ( $page - 1 ) );
138
133
    my $dbh   = C4::Context->dbh;
139
    my $dbh   = C4::Context->dbh;
134
140
135
    my @bind_params = ();
141
    my @bind_params = ();
Lines 156-161 sub GetHoldsQueueItems { Link Here
156
        push @bind_params, $branchlimit;
162
        push @bind_params, $branchlimit;
157
    }
163
    }
158
    $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
164
    $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
165
    $query .= " LIMIT $limit OFFSET $offset";
159
    my $sth = $dbh->prepare($query);
166
    my $sth = $dbh->prepare($query);
160
    $sth->execute(@bind_params);
167
    $sth->execute(@bind_params);
161
    my $items = [];
168
    my $items = [];
Lines 177-183 sub GetHoldsQueueItems { Link Here
177
184
178
        push @$items, $row;
185
        push @$items, $row;
179
    }
186
    }
180
    return $items;
187
188
189
    @bind_params = ();
190
    my $total_query = "SELECT COUNT(*) FROM tmp_holdsqueue";
191
    if ($branchlimit) {
192
        $total_query .=" WHERE tmp_holdsqueue.holdingbranch = ?";
193
        push @bind_params, $branchlimit;
194
    }
195
196
    my ($total_results) = $dbh->selectrow_array( $total_query, undef, @bind_params );
197
198
    return ( $items, $total_results );
181
}
199
}
182
200
183
=head2 CreateQueue
201
=head2 CreateQueue
(-)a/circ/view_holdsqueue.pl (-8 / +28 lines)
Lines 25-31 This script displays items in the tmp_holdsqueue table Link Here
25
use Modern::Perl;
25
use Modern::Perl;
26
use CGI qw ( -utf8 );
26
use CGI qw ( -utf8 );
27
use C4::Auth qw( get_template_and_user );
27
use C4::Auth qw( get_template_and_user );
28
use C4::Output qw( output_html_with_http_headers );
28
use C4::Output qw( output_html_with_http_headers pagination_bar );
29
use C4::HoldsQueue qw( GetHoldsQueueItems );
29
use C4::HoldsQueue qw( GetHoldsQueueItems );
30
use Koha::BiblioFrameworks;
30
use Koha::BiblioFrameworks;
31
use Koha::ItemTypes;
31
use Koha::ItemTypes;
Lines 43-58 my ( $template, $loggedinuser, $cookie, $flags ) = get_template_and_user( Link Here
43
my $params = $query->Vars;
43
my $params = $query->Vars;
44
my $run_report     = $params->{'run_report'};
44
my $run_report     = $params->{'run_report'};
45
my $branchlimit    = $params->{'branchlimit'};
45
my $branchlimit    = $params->{'branchlimit'};
46
my $itemtypeslimit = $params->{'itemtypeslimit'};
46
my $limit          = $params->{'limit'} || 20;
47
my $page           = $params->{'page'}  || 1;
47
48
48
if ( $run_report ) {
49
if ( $run_report ) {
49
    # XXX GetHoldsQueueItems() does not support $itemtypeslimit!
50
    my ( $items, $total ) = GetHoldsQueueItems( $branchlimit, $limit, $page );
50
    my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit);
51
52
    my $pages = int( $total / $limit ) + ( ( $total % $limit ) > 0 ? 1 : 0 );
53
    warn "LIMIT: $limit";
54
    warn "PAGES: $pages";
51
    $template->param(
55
    $template->param(
52
        branchlimit     => $branchlimit,
56
        branchlimit    => $branchlimit,
53
        total      => scalar @$items,
57
        total          => $total,
54
        itemsloop  => $items,
58
        itemsloop      => $items,
55
        run_report => $run_report,
59
        run_report     => $run_report,
60
        page           => $page,
61
        limit          => $limit,
62
        pagination_bar => pagination_bar(
63
            'view_holdsqueue.pl',
64
            $pages,
65
            $page,
66
            'page',
67
            {
68
                branchlimit    => $branchlimit,
69
                itemtypeslimit => $itemtypeslimit,
70
                ccodeslimit    => $ccodeslimit,
71
                locationslimit => $locationslimit,
72
                limit          => $limit,
73
                run_report     => 1,
74
            }
75
        ),
56
    );
76
    );
57
}
77
}
58
78
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-1 / +24 lines)
Lines 66-71 Link Here
66
        <div class="results">[% total | html %] items found for
66
        <div class="results">[% total | html %] items found for
67
            [% IF ( branchlimit ) %][% Branches.GetName( branchlimit ) | html %][% ELSE %]All libraries[% END %]
67
            [% IF ( branchlimit ) %][% Branches.GetName( branchlimit ) | html %][% ELSE %]All libraries[% END %]
68
        </div>
68
        </div>
69
70
		<form action="view_holdsqueue.pl" method="get" id="limitselect">
71
			<input type="hidden" name="page" value="[% page | html %]"/>
72
            <input type="hidden" name="branchlimit" value="[% branchlimit | html %]"/>
73
			<input type="hidden" name="run_report" value="1"/>
74
75
			<label for="limit">Rows per page: </label>
76
			<select name="limit" id="limit">
77
				[% limits = [ 10, 20, 50, 100, 200, 300, 400, 500, 1000 ] %]
78
				[% FOREACH l IN limits %]
79
					[% IF l == limit %]
80
						<option value="[% l | html %]" selected="selected">[% l | html %]</option>
81
					[% ELSE %]
82
						<option value="[% l | html %]">[% l | html %]</option>
83
					[% END %]
84
				[% END %]
85
			</select>
86
		</form> <!-- /#limitselect -->
87
        <div class="pages">[% pagination_bar | $raw %]</div>
88
69
    [% ELSE %]
89
    [% ELSE %]
70
        <div class="dialog message">No items found.</div>
90
        <div class="dialog message">No items found.</div>
71
    [% END %]
91
    [% END %]
Lines 237-242 Link Here
237
        $(document).ready(function() {
257
        $(document).ready(function() {
238
            var holdst;
258
            var holdst;
239
259
260
            $('#limit').change(function() {
261
                $('#limitselect').submit();
262
            });
263
240
            // Setup filters before DataTables initialisation, in case some columns are
264
            // Setup filters before DataTables initialisation, in case some columns are
241
            // hidden by default
265
            // hidden by default
242
            var filterColumnTimeoutId;
266
            var filterColumnTimeoutId;
243
- 

Return to bug 28974