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

(-)a/circ/pendingreserves.pl (-74 / +56 lines)
Lines 164-171 my %where = ( Link Here
164
);
164
);
165
165
166
# date boundaries
166
# date boundaries
167
my $startdate_iso = output_pref({ dt => $startdate, dateformat => 'iso', dateonly => 1 });
167
my $dtf = Koha::Database->new->schema->storage->datetime_parser;
168
my $enddate_iso   = output_pref({ dt => $enddate, dateformat => 'iso', dateonly => 1 });
168
my $startdate_iso = $dtf->format_date($startdate);
169
my $enddate_iso   = $dtf->format_date($enddate);
169
if ( $startdate_iso && $enddate_iso ){
170
if ( $startdate_iso && $enddate_iso ){
170
    $where{'reserve.reservedate'} = [ -and => { '>=', $startdate_iso }, { '<=', $enddate_iso } ];
171
    $where{'reserve.reservedate'} = [ -and => { '>=', $startdate_iso }, { '<=', $enddate_iso } ];
171
} elsif ( $startdate_iso ){
172
} elsif ( $startdate_iso ){
Lines 204-222 foreach my $bibnum ( @biblionumbers ){ Link Here
204
    my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 });
205
    my @branchtransfers = map { $_->itemnumber } Koha::Item::Transfers->search({ datearrived => undef }, { columns => [ 'itemnumber' ], collapse => 1 });
205
    my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 });
206
    my @issues = map { $_->itemnumber } Koha::Checkouts->search({}, { columns => [ 'itemnumber' ], collapse => 1 });
206
207
208
    my $items = Koha::Items->search(
209
        {
210
            biblionumber => $bibnum,
211
            itemlost     => 0,
212
            withdrawn    => 0,
213
            notforloan   => 0,
214
            itemnumber   => { -not_in => [ @branchtransfers, @issues ] },
215
        }
216
    );
217
207
    # get available item types for each biblio
218
    # get available item types for each biblio
208
    my $res_itemtypes;
219
    my $res_itemtypes;
209
    if ( C4::Context->preference('item-level_itypes') ){
220
    if ( C4::Context->preference('item-level_itypes') ){
210
        $res_itemtypes = Koha::Items->search(
221
        $res_itemtypes = $items->search(
211
            { biblionumber => $bibnum,
222
            {
212
              itype => { '!=', undef },
223
                itype => { '!=', undef },
213
              itemlost => 0,
214
              withdrawn => 0,
215
              notforloan => 0,
216
              itemnumber => { -not_in => [ @branchtransfers, @issues ] },
217
            },
224
            },
218
            { columns => 'itype',
225
            {
219
              distinct => 1,
226
                columns  => 'itype',
227
                distinct => 1,
220
            }
228
            }
221
        );
229
        );
222
    } else {
230
    } else {
Lines 230-334 foreach my $bibnum ( @biblionumbers ){ Link Here
230
    $reserves->{$bibnum}->{itemtypes} = $res_itemtypes;
238
    $reserves->{$bibnum}->{itemtypes} = $res_itemtypes;
231
239
232
    # get available locations for each biblio
240
    # get available locations for each biblio
233
    my $res_locations = Koha::Items->search(
241
    my $res_locations = $items->search(
234
        { biblionumber => $bibnum,
242
        {
235
          location => { '!=', undef },
243
            location => { '!=', undef },
236
          itemlost => 0,
237
          withdrawn => 0,
238
          notforloan => 0,
239
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
240
        },
244
        },
241
        { columns => 'location',
245
        {
242
          distinct => 1,
246
            columns  => 'location',
247
            distinct => 1,
243
        }
248
        }
244
    );
249
    );
245
    $reserves->{$bibnum}->{locations} = $res_locations;
250
    $reserves->{$bibnum}->{locations} = $res_locations;
246
251
247
    # get available callnumbers for each biblio
252
    # get available callnumbers for each biblio
248
    my $res_callnumbers = Koha::Items->search(
253
    my $res_callnumbers = $items->search(
249
        { biblionumber => $bibnum,
254
        {
250
          itemcallnumber => { '!=', undef },
255
            itemcallnumber => { '!=', undef },
251
          itemlost => 0,
252
          withdrawn => 0,
253
          notforloan => 0,
254
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
255
        },
256
        },
256
        { columns => 'itemcallnumber',
257
        {
257
          distinct => 1,
258
            columns  => 'itemcallnumber',
259
            distinct => 1,
258
        }
260
        }
259
    );
261
    );
260
    $reserves->{$bibnum}->{callnumbers} = $res_callnumbers;
262
    $reserves->{$bibnum}->{callnumbers} = $res_callnumbers;
261
263
262
    # get available enumchrons for each biblio
264
    # get available enumchrons for each biblio
263
    my $res_enumchrons = Koha::Items->search(
265
    my $res_enumchrons = $items->search(
264
        { biblionumber => $bibnum,
266
        {
265
          enumchron => { '!=', undef },
267
            enumchron => { '!=', undef },
266
          itemlost => 0,
267
          withdrawn => 0,
268
          notforloan => 0,
269
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
270
        },
268
        },
271
        { columns => 'enumchron',
269
        {
272
          distinct => 1,
270
            columns  => 'enumchron',
271
            distinct => 1,
273
        }
272
        }
274
    );
273
    );
275
    $reserves->{$bibnum}->{enumchrons} = $res_enumchrons;
274
    $reserves->{$bibnum}->{enumchrons} = $res_enumchrons;
276
275
277
    # get available copynumbers for each biblio
276
    # get available copynumbers for each biblio
278
    my $res_copynumbers = Koha::Items->search(
277
    my $res_copynumbers = $items->search(
279
        { biblionumber => $bibnum,
278
        {
280
          copynumber => { '!=', undef },
279
            copynumber => { '!=', undef },
281
          itemlost => 0,
282
          withdrawn => 0,
283
          notforloan => 0,
284
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
285
        },
280
        },
286
        { columns => 'copynumber',
281
        {
287
          distinct => 1,
282
            columns  => 'copynumber',
283
            distinct => 1,
288
        }
284
        }
289
    );
285
    );
290
    $reserves->{$bibnum}->{copynumbers} = $res_copynumbers;
286
    $reserves->{$bibnum}->{copynumbers} = $res_copynumbers;
291
287
292
    # get available barcodes for each biblio
288
    # get available barcodes for each biblio
293
    my $res_barcodes = Koha::Items->search(
289
    my $res_barcodes = $items->search(
294
        { biblionumber => $bibnum,
290
        {
295
          barcode => { '!=', undef },
291
            barcode => { '!=', undef },
296
          itemlost => 0,
297
          withdrawn => 0,
298
          notforloan => 0,
299
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
300
        },
292
        },
301
        { columns => 'barcode',
293
        {
302
          distinct => 1,
294
            columns  => 'barcode',
295
            distinct => 1,
303
        }
296
        }
304
    );
297
    );
305
    $reserves->{$bibnum}->{barcodes} = $res_barcodes;
298
    $reserves->{$bibnum}->{barcodes} = $res_barcodes;
306
299
307
    # get available holding branches for each biblio
300
    # get available holding branches for each biblio
308
    my $res_holdingbranches = Koha::Items->search(
301
    my $res_holdingbranches = $items->search(
309
        { biblionumber => $bibnum,
302
        {
310
          holdingbranch => { '!=', undef },
303
            holdingbranch => { '!=', undef },
311
          itemlost => 0,
312
          withdrawn => 0,
313
          notforloan => 0,
314
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
315
        },
304
        },
316
        { columns => 'holdingbranch',
305
        {
317
          distinct => 1,
306
            columns  => 'holdingbranch',
307
            distinct => 1,
318
        }
308
        }
319
    );
309
    );
320
    $reserves->{$bibnum}->{holdingbranches} = $res_holdingbranches;
310
    $reserves->{$bibnum}->{holdingbranches} = $res_holdingbranches;
321
311
322
    # items available
312
    # items available
323
    my $items_count = Koha::Items->search(
313
    my $items_count = $items->count;
324
        { biblionumber => $bibnum,
325
          itemlost => 0,
326
          withdrawn => 0,
327
          notforloan => 0,
328
          itemnumber => { -not_in => [ @branchtransfers, @issues ] },
329
        },
330
        { select => [ { distinct => 'itemnumber' } ] }
331
    )->count;
332
    $reserves->{$bibnum}->{items_count} = $items_count;
314
    $reserves->{$bibnum}->{items_count} = $items_count;
333
315
334
    # patrons with holds
316
    # patrons with holds
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/circ/pendingreserves.tt (-1 / +1 lines)
Lines 220-225 Link Here
220
        <td id="locationfilter"></td>
220
        <td id="locationfilter"></td>
221
        <td></td>
221
        <td></td>
222
        <td></td>
222
        <td></td>
223
        <td></td>
223
        </tr>
224
        </tr>
224
    </tfoot>
225
    </tfoot>
225
    </table>
226
    </table>
226
- 

Return to bug 24488