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

(-)a/C4/Items.pm (-2 / +10 lines)
Lines 477-483 lists of authorized values for certain item fields. Link Here
477
  minlocation  => $minlocation,
477
  minlocation  => $minlocation,
478
  maxlocation  => $maxlocation,
478
  maxlocation  => $maxlocation,
479
  location     => $location,
479
  location     => $location,
480
  itemtype     => $itemtype,
481
  ignoreissued => $ignoreissued,
480
  ignoreissued => $ignoreissued,
482
  datelastseen => $datelastseen,
481
  datelastseen => $datelastseen,
483
  branchcode   => $branchcode,
482
  branchcode   => $branchcode,
Lines 485-490 lists of authorized values for certain item fields. Link Here
485
  offset       => $offset,
484
  offset       => $offset,
486
  size         => $size,
485
  size         => $size,
487
  statushash   => $statushash,
486
  statushash   => $statushash,
487
  itemtypes    => @itemsarray,
488
} );
488
} );
489
489
490
Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
490
Retrieve a list of title/authors/barcode/callnumber, for biblio inventory.
Lines 517-522 sub GetItemsForInventory { Link Here
517
    my $size         = $parameters->{'size'}         // '';
517
    my $size         = $parameters->{'size'}         // '';
518
    my $statushash   = $parameters->{'statushash'}   // '';
518
    my $statushash   = $parameters->{'statushash'}   // '';
519
    my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // '';
519
    my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // '';
520
    my $items        = $parameters->{'itemtypes'}    // '';
520
521
521
    my $dbh = C4::Context->dbh;
522
    my $dbh = C4::Context->dbh;
522
    my ( @bind_params, @where_strings );
523
    my ( @bind_params, @where_strings );
Lines 576-582 sub GetItemsForInventory { Link Here
576
        push @where_strings, 'biblioitems.itemtype = ?';
577
        push @where_strings, 'biblioitems.itemtype = ?';
577
        push @bind_params, $itemtype;
578
        push @bind_params, $itemtype;
578
    }
579
    }
579
580
    if ( $ignoreissued) {
580
    if ( $ignoreissued) {
581
        $query .= "LEFT JOIN issues ON items.itemnumber = issues.itemnumber ";
581
        $query .= "LEFT JOIN issues ON items.itemnumber = issues.itemnumber ";
582
        push @where_strings, 'issues.date_due IS NULL';
582
        push @where_strings, 'issues.date_due IS NULL';
Lines 587-592 sub GetItemsForInventory { Link Here
587
        push( @where_strings, q{(reserves.found != 'W' OR reserves.found IS NULL)} );
587
        push( @where_strings, q{(reserves.found != 'W' OR reserves.found IS NULL)} );
588
    }
588
    }
589
589
590
    if ( $items and @{$items} > 0 ){
591
        my $joinedvals;
592
        for my $itemtype (@{$items}){
593
            $joinedvals = join(',', @{$items});
594
        }
595
        push @where_strings, "( biblioitems.itemtype IN (" . $joinedvals . ") OR items.itype IN (" . $joinedvals . ") )";
596
    }
597
590
    if ( @where_strings ) {
598
    if ( @where_strings ) {
591
        $query .= 'WHERE ';
599
        $query .= 'WHERE ';
592
        $query .= join ' AND ', @where_strings;
600
        $query .= join ' AND ', @where_strings;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (+29 lines)
Lines 157-163 Link Here
157
            <label for="ignore_waiting_holds">Skip items on hold awaiting pickup: </label>
157
            <label for="ignore_waiting_holds">Skip items on hold awaiting pickup: </label>
158
            <input type="checkbox" id="ignore_waiting_holds" name="ignore_waiting_holds" />
158
            <input type="checkbox" id="ignore_waiting_holds" name="ignore_waiting_holds" />
159
        </li>
159
        </li>
160
        <li>
161
            <label>Item types: </label>
162
            <div class="branchselector">
163
                <p><a href="#" id="checkallitemtypes"> <i class="fa fa-check"></i> Select all</a> | <a href="#" id="checknoneitemtypes"> <i class="fa fa-remove"></i> Clear all</a></p>
164
                <div class="branchgridrow">
165
                    [% FOREACH itemtype IN itemtypes %]
166
                        <div class="branchgriditem">
167
                            <input id="itemtype-[% itemtype.itemtype | html %]" class="branch_select" type="checkbox" name="itemtype-[% itemtype.itemtype | html %]" value="[% itemtype.itemtype | html %]" />
168
                            <label for="itemtype-[% itemtype.itemtype | html %]">[% itemtype.description | html %]</label>
169
                        </div>
170
                        [% IF loop.count() % 4 == 0 && !loop.last() %]
171
                            </div>
172
                            <div class="branchgridrow">
173
                        [% END %]
174
                    [% END %]
175
                </div>
176
            </div>
177
        </li>
178
160
        </ol>
179
        </ol>
180
161
    </fieldset>
181
    </fieldset>
162
182
163
        <fieldset class="rows">
183
        <fieldset class="rows">
Lines 432-437 Link Here
432
                    $("fieldset#optionalfilters").hide();
452
                    $("fieldset#optionalfilters").hide();
433
                }
453
                }
434
            });
454
            });
455
456
            $("#checkallitemtypes").on("click",function(e){
457
                e.preventDefault();
458
                $(".branch_select").prop("checked",1);
459
            });
460
            $("#checknoneitemtypes").on("click",function(e){
461
                e.preventDefault();
462
                $(".branch_select").prop("checked",0);
463
            });
435
        });
464
        });
436
    </script>
465
    </script>
437
[% END %]
466
[% END %]
(-)a/t/db_dependent/Items/GetItemsForInventory.t (-1 / +6 lines)
Lines 46-52 my $builder = t::lib::TestBuilder->new; Link Here
46
46
47
subtest 'Skip items with waiting holds' => sub {
47
subtest 'Skip items with waiting holds' => sub {
48
48
49
    plan tests => 7;
49
    plan tests => 8;
50
50
51
    $schema->storage->txn_begin;
51
    $schema->storage->txn_begin;
52
52
Lines 99-104 subtest 'Skip items with waiting holds' => sub { Link Here
99
    is( scalar @{$items_2},     $second_items_count, 'Results and count match' );
99
    is( scalar @{$items_2},     $second_items_count, 'Results and count match' );
100
    is( $first_items_count + 2, $second_items_count, 'Two items added, count makes sense' );
100
    is( $first_items_count + 2, $second_items_count, 'Two items added, count makes sense' );
101
101
102
    my $real_itemtype_count = Koha::Items->search({ itype => $itemtype->itemtype })->count;
103
    my $itype_str = "'" . $itemtype->itemtype . "'"; # manipulate string for db query
104
    my ( $items_3, $itemtype_count ) = GetItemsForInventory({ itemtypes => [ $itype_str ] });
105
    is( $itemtype_count, $real_itemtype_count, 'Itemtype filter gets correct number of inventory items' );
106
102
    # Add 2 waiting holds
107
    # Add 2 waiting holds
103
    C4::Reserves::AddReserve(
108
    C4::Reserves::AddReserve(
104
        {
109
        {
(-)a/tools/inventory.pl (-2 / +11 lines)
Lines 126-131 for my $authvfield (@$statuses) { Link Here
126
my @class_sources = Koha::ClassSources->search({ used => 1 });
126
my @class_sources = Koha::ClassSources->search({ used => 1 });
127
my $pref_class = C4::Context->preference("DefaultClassificationSource");
127
my $pref_class = C4::Context->preference("DefaultClassificationSource");
128
128
129
my @itemtypes = Koha::ItemTypes->search;
130
my @selected_itemtypes;
131
foreach my $itemtype ( @itemtypes ) {
132
    if ( defined $input->param('itemtype-' . $itemtype->itemtype) ) {
133
        push @selected_itemtypes, "'" . $itemtype->itemtype . "'";
134
    }
135
}
129
136
130
$template->param(
137
$template->param(
131
    authorised_values        => \@authorised_value_list,
138
    authorised_values        => \@authorised_value_list,
Lines 141-147 $template->param( Link Here
141
    uploadedbarcodesflag     => ($uploadbarcodes || $barcodelist) ? 1 : 0,
148
    uploadedbarcodesflag     => ($uploadbarcodes || $barcodelist) ? 1 : 0,
142
    ignore_waiting_holds     => $ignore_waiting_holds,
149
    ignore_waiting_holds     => $ignore_waiting_holds,
143
    class_sources            => \@class_sources,
150
    class_sources            => \@class_sources,
144
    pref_class               => $pref_class
151
    pref_class               => $pref_class,
152
    itemtypes                => \@itemtypes,
145
);
153
);
146
154
147
# Walk through uploaded barcodes, report errors, mark as seen, check in
155
# Walk through uploaded barcodes, report errors, mark as seen, check in
Lines 251-256 if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) { Link Here
251
      offset       => 0,
259
      offset       => 0,
252
      statushash   => $staton,
260
      statushash   => $staton,
253
      ignore_waiting_holds => $ignore_waiting_holds,
261
      ignore_waiting_holds => $ignore_waiting_holds,
262
      itemtypes    => \@selected_itemtypes,
254
    });
263
    });
255
}
264
}
256
# Build rightplacelist used to check if a scanned item is in the right place.
265
# Build rightplacelist used to check if a scanned item is in the right place.
Lines 267-272 if( @scanned_items ) { Link Here
267
      offset       => 0,
276
      offset       => 0,
268
      statushash   => undef,
277
      statushash   => undef,
269
      ignore_waiting_holds => $ignore_waiting_holds,
278
      ignore_waiting_holds => $ignore_waiting_holds,
279
      itemtypes    => \@selected_itemtypes,
270
    });
280
    });
271
    # Convert the structure to a hash on barcode
281
    # Convert the structure to a hash on barcode
272
    $rightplacelist = {
282
    $rightplacelist = {
273
- 

Return to bug 4037