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

(-)a/C4/HoldsQueue.pm (-5 / +18 lines)
Lines 122-135 sub UpdateTransportCostMatrix { Link Here
122
122
123
=head2 GetHoldsQueueItems
123
=head2 GetHoldsQueueItems
124
124
125
  GetHoldsQueueItems($branch);
125
  GetHoldsQueueItems({ branchlimit => $branch, itemtypeslimit =>  $itype, ccodeslimit => $ccode, locationslimit => $location );
126
126
127
Returns hold queue for a holding branch. If branch is omitted, then whole queue is returned
127
Returns hold queue for a holding branch. If branch is omitted, then whole queue is returned
128
128
129
=cut
129
=cut
130
130
131
sub GetHoldsQueueItems {
131
sub GetHoldsQueueItems {
132
    my ($branchlimit) = @_;
132
    my $params = shift;
133
    my $dbh   = C4::Context->dbh;
133
    my $dbh   = C4::Context->dbh;
134
134
135
    my @bind_params = ();
135
    my @bind_params = ();
Lines 143-152 sub GetHoldsQueueItems { Link Here
143
                       JOIN biblio      USING (biblionumber)
143
                       JOIN biblio      USING (biblionumber)
144
                  LEFT JOIN biblioitems USING (biblionumber)
144
                  LEFT JOIN biblioitems USING (biblionumber)
145
                  LEFT JOIN items       USING (  itemnumber)
145
                  LEFT JOIN items       USING (  itemnumber)
146
                  WHERE 1=1
146
                /;
147
                /;
147
    if ($branchlimit) {
148
    if ($params->{branchlimit}) {
148
        $query .=" WHERE tmp_holdsqueue.holdingbranch = ?";
149
        $query .="AND tmp_holdsqueue.holdingbranch = ? ";
149
        push @bind_params, $branchlimit;
150
        push @bind_params, $params->{branchlimit};
151
    }
152
    if( $params->{itemtypeslimit} ) {
153
        $query .=" AND items.itype = ? ";
154
        push @bind_params, $params->{itemtypeslimit};
155
    }
156
    if( $params->{ccodeslimit} ) {
157
        $query .=" AND items.ccode = ? ";
158
        push @bind_params, $params->{ccodeslimit};
159
    }
160
    if( $params->{locationslimit} ) {
161
        $query .=" AND items.location = ? ";
162
        push @bind_params, $params->{locationslimit};
150
    }
163
    }
151
    $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
164
    $query .= " ORDER BY ccode, location, cn_sort, author, title, pickbranch, reservedate";
152
    my $sth = $dbh->prepare($query);
165
    my $sth = $dbh->prepare($query);
(-)a/circ/view_holdsqueue.pl (-2 / +11 lines)
Lines 44-58 my $params = $query->Vars; Link Here
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 $itemtypeslimit = $params->{'itemtypeslimit'};
47
my $ccodeslimit = $params->{'ccodeslimit'};
48
my $locationslimit = $params->{'locationslimit'};
47
49
48
if ( $run_report ) {
50
if ( $run_report ) {
49
    # XXX GetHoldsQueueItems() does not support $itemtypeslimit!
51
    my $items = GetHoldsQueueItems({
50
    my $items = GetHoldsQueueItems($branchlimit, $itemtypeslimit);
52
        branchlimit => $branchlimit,
53
        itemtypeslimit => $itemtypeslimit,
54
        ccodeslimit => $ccodeslimit,
55
        locationslimit => $locationslimit
56
    });
51
    for my $item ( @$items ) {
57
    for my $item ( @$items ) {
52
        $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} );
58
        $item->{patron} = Koha::Patrons->find( $item->{borrowernumber} );
53
    }
59
    }
54
    $template->param(
60
    $template->param(
55
        branchlimit     => $branchlimit,
61
        branchlimit     => $branchlimit,
62
        itemtypeslimit     => $itemtypeslimit,
63
        ccodeslimit     => $ccodeslimit,
64
        locationslimit     => $locationslimit,
56
        total      => scalar @$items,
65
        total      => scalar @$items,
57
        itemsloop  => $items,
66
        itemsloop  => $items,
58
        run_report => $run_report,
67
        run_report => $run_report,
(-)a/koha-tmpl/intranet-tmpl/prog/en/includes/html_helpers.inc (+10 lines)
Lines 47-52 Link Here
47
    [% END %]
47
    [% END %]
48
[% END %]
48
[% END %]
49
49
50
[% BLOCK options_for_authorised_values %]
51
    [% FOREACH av IN authorised_values %]
52
        [% IF av.authorised_value == selected_av %]
53
            <option value="[% av.authorised_value | html %]" selected="selected">[% av.lib | html %]</option>
54
        [% ELSE %]
55
            <option value="[% av.authorised_value | html %]">[% av.lib | html %]</option>
56
        [% END %]
57
    [% END %]
58
[% END %]
59
50
[% BLOCK options_for_item_types %]
60
[% BLOCK options_for_item_types %]
51
    [% FOREACH itemtype IN itemtypes %]
61
    [% FOREACH itemtype IN itemtypes %]
52
        [% IF itemtype.itemtype == selected_itemtype %]
62
        [% IF itemtype.itemtype == selected_itemtype %]
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/view_holdsqueue.tt (-2 / +25 lines)
Lines 65-70 Link Here
65
    [% IF ( total ) %]
65
    [% IF ( total ) %]
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
            [% IF ( itemtypeslimit ) %] and item type:([% ItemTypes.GetDescription( itemtypeslimit ) | html %])[% END %]
69
            [% IF ( ccodeslimit ) %] and collection code:([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.ccode' authorised_value = ccodeslimit ) | html %])[% END %]
70
            [% IF ( locationslimit ) %] and shelving location:([% AuthorisedValues.GetDescriptionByKohaField( kohafield => 'items.location' authorised_value = locationslimit ) | html %])[% END %]
68
        </div>
71
        </div>
69
    [% ELSE %]
72
    [% ELSE %]
70
        <div class="dialog message">No items found.</div>
73
        <div class="dialog message">No items found.</div>
Lines 200-206 Link Here
200
	[% END %]
203
	[% END %]
201
204
202
[% UNLESS ( total ) %]
205
[% UNLESS ( total ) %]
203
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl" method="post">
206
<form name="f" action="/cgi-bin/koha/circ/view_holdsqueue.pl">
204
	<fieldset class="rows">
207
	<fieldset class="rows">
205
	<ol>
208
	<ol>
206
        <li>
209
        <li>
Lines 210-215 Link Here
210
                [% PROCESS options_for_libraries libraries => Branches.all( only_from_group => 1 ) %]
213
                [% PROCESS options_for_libraries libraries => Branches.all( only_from_group => 1 ) %]
211
            </select>
214
            </select>
212
        </li>
215
        </li>
216
        <li>
217
            <label for="itemtypeslimit">Item type: </label>
218
            <select name="itemtypeslimit" id="itemtypeslimit">
219
                <option value="">All</option>
220
                [% PROCESS options_for_item_types itemtypes => ItemTypes.Get() %]
221
            </select>
222
        </li>
223
        <li>
224
            <label for="ccodeslimit">Collection code: </label>
225
            <select name="ccodeslimit" id="ccodeslimit">
226
                <option value="">All</option>
227
                [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'CCODE' ) %]
228
            </select>
229
        </li>
230
        <li>
231
            <label for="locationsslimit">Shelving location: </label>
232
            <select name="locationslimit" id="ccodeslimit">
233
                <option value="">All</option>
234
                [% PROCESS options_for_authorised_values authorised_values => AuthorisedValues.GetAuthValueDropbox( 'LOC' ) %]
235
            </select>
236
        </li>
213
    </ol></fieldset>
237
    </ol></fieldset>
214
    <fieldset class="action">    <input type="submit" value="Submit" />
238
    <fieldset class="action">    <input type="submit" value="Submit" />
215
        <input type="hidden" name="run_report" value="1" /></fieldset>
239
        <input type="hidden" name="run_report" value="1" /></fieldset>
216
- 

Return to bug 29015