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

(-)a/C4/Items.pm (-1 / +8 lines)
Lines 536-541 sub GetItemsForInventory { Link Here
536
    my $statushash   = $parameters->{'statushash'}   // '';
536
    my $statushash   = $parameters->{'statushash'}   // '';
537
    my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // '';
537
    my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // '';
538
    my $itemtypes    = $parameters->{'itemtypes'}    || [];
538
    my $itemtypes    = $parameters->{'itemtypes'}    || [];
539
    my $ccode        = $parameters->{'ccode'}        // '';
539
540
540
    my $dbh = C4::Context->dbh;
541
    my $dbh = C4::Context->dbh;
541
    my ( @bind_params, @where_strings );
542
    my ( @bind_params, @where_strings );
Lines 544-550 sub GetItemsForInventory { Link Here
544
    my $max_cnsort = GetClassSort($class_source,undef,$maxlocation);
545
    my $max_cnsort = GetClassSort($class_source,undef,$maxlocation);
545
546
546
    my $select_columns = q{
547
    my $select_columns = q{
547
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort
548
        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort, ccode
549
548
    };
550
    };
549
    my $select_count = q{SELECT COUNT(DISTINCT(items.itemnumber))};
551
    my $select_count = q{SELECT COUNT(DISTINCT(items.itemnumber))};
550
    my $query = q{
552
    my $query = q{
Lines 561-566 sub GetItemsForInventory { Link Here
561
        }
563
        }
562
    }
564
    }
563
565
566
    if ($ccode){
567
        push @where_strings, 'ccode = ?';
568
        push @bind_params, $ccode;
569
    }
570
564
    if ($minlocation) {
571
    if ($minlocation) {
565
        push @where_strings, 'items.cn_sort >= ?';
572
        push @where_strings, 'items.cn_sort >= ?';
566
        push @bind_params, $min_cnsort;
573
        push @bind_params, $min_cnsort;
(-)a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt (+22 lines)
Lines 1-5 Link Here
1
[% USE raw %]
1
[% USE raw %]
2
[% USE Asset %]
2
[% USE Asset %]
3
[% USE AuthorisedValues %]
3
[% USE KohaDates %]
4
[% USE KohaDates %]
4
[% USE Branches %]
5
[% USE Branches %]
5
[% SET footerjs = 1 %]
6
[% SET footerjs = 1 %]
Lines 116-121 Link Here
116
        [% END %]
117
        [% END %]
117
        </select>        </li>
118
        </select>        </li>
118
        [% END %]
119
        [% END %]
120
        [% SET ccodes = AuthorisedValues.GetAuthValueDropbox('CCODE') %]
121
        [% IF ( ccodes.count > 0 ) %]
122
        <li>
123
            <label for="ccode">Collection code: </label>
124
            <select id="ccodeloop" name="ccode">
125
                        <option value="">Filter collection</option>
126
                [% FOREACH cc IN ccodes %]
127
                    [% IF (ccode == cc.authorised_value) %]
128
                        <option value="[% cc.authorised_value %]" selected="selected">[% cc.lib %]</option>
129
                    [% ELSE %]
130
                        <option value="[% cc.authorised_value %]">[% cc.lib %]</option>
131
                    [% END %]
132
                [% END %]
133
            </select>
134
        </li>
135
        [% END %]
119
        <li>
136
        <li>
120
            <label for="minlocation">Item call number between: </label>
137
            <label for="minlocation">Item call number between: </label>
121
                <input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber)  </li>
138
                <input type="text" name="minlocation" id="minlocation" value="[% minlocation | html %]" /> (items.itemcallnumber)  </li>
Lines 229-234 Link Here
229
    <input type="hidden" name="location" value="[% location | html %]" />
246
    <input type="hidden" name="location" value="[% location | html %]" />
230
    <input type="hidden" name="branchcode" value="[% branchcode | html %]" />
247
    <input type="hidden" name="branchcode" value="[% branchcode | html %]" />
231
    <input type="hidden" name="datelastseen" value="[% datelastseen | html %]" />
248
    <input type="hidden" name="datelastseen" value="[% datelastseen | html %]" />
249
    <input type="hidden" name="ccode" value="[% ccode %]" />
232
250
233
    [% UNLESS uploadedbarcodesflag %]
251
    [% UNLESS uploadedbarcodesflag %]
234
      <div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
252
      <div><a href="#" class="checkall"><i class="fa fa-check"></i> Select all</a> <a href="#" class="clearall"><i class="fa fa-remove"></i> Clear all</a></div>
Lines 241-246 Link Here
241
            <th>Barcode</th>
259
            <th>Barcode</th>
242
            <th>Call number</th>
260
            <th>Call number</th>
243
            <th>Library</th>
261
            <th>Library</th>
262
            <th>Collection code</th>
244
            <th class="anti-the">Title</th>
263
            <th class="anti-the">Title</th>
245
            <th>Not for loan</th>
264
            <th>Not for loan</th>
246
            <th>Lost</th>
265
            <th>Lost</th>
Lines 268-273 Link Here
268
                [% Branches.GetName( result.homebranch ) | html %]
287
                [% Branches.GetName( result.homebranch ) | html %]
269
                <span class="shelvingloc">[% result.location | html %]</span>
288
                <span class="shelvingloc">[% result.location | html %]</span>
270
            </td>
289
            </td>
290
            <td>
291
                <span class="ccode">[% result.ccode | html %]</span>
292
            </td>
271
            <td>
293
            <td>
272
                <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | uri %]" class="openWin">[% result.title | html %]</a>
294
                <a href="/cgi-bin/koha/catalogue/detail.pl?biblionumber=[% result.biblionumber | uri %]" class="openWin">[% result.title | html %]</a>
273
                [% IF ( result.author ) %]
295
                [% IF ( result.author ) %]
(-)a/tools/inventory.pl (-3 / +11 lines)
Lines 58-63 my $op = $input->param('op'); Link Here
58
my $compareinv2barcd = $input->param('compareinv2barcd');
58
my $compareinv2barcd = $input->param('compareinv2barcd');
59
my $dont_checkin = $input->param('dont_checkin');
59
my $dont_checkin = $input->param('dont_checkin');
60
my $out_of_order = $input->param('out_of_order');
60
my $out_of_order = $input->param('out_of_order');
61
my $ccode = $input->param('ccode');
61
62
62
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
63
my ( $template, $borrowernumber, $cookie ) = get_template_and_user(
63
    {   template_name   => "tools/inventory.tt",
64
    {   template_name   => "tools/inventory.tt",
Lines 73-78 my $authorisedvalue_categories = ''; Link Here
73
my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] })->unblessed;
74
my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] })->unblessed;
74
unshift @$frameworks, { frameworkcode => '' };
75
unshift @$frameworks, { frameworkcode => '' };
75
76
77
my @collections = ();
78
my @collection_codes = ();
79
76
for my $fwk ( @$frameworks ){
80
for my $fwk ( @$frameworks ){
77
  my $fwkcode = $fwk->{frameworkcode};
81
  my $fwkcode = $fwk->{frameworkcode};
78
  my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
82
  my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] });
Lines 149-154 $template->param( Link Here
149
    class_sources            => \@class_sources,
153
    class_sources            => \@class_sources,
150
    pref_class               => $pref_class,
154
    pref_class               => $pref_class,
151
    itemtypes                => \@itemtypes,
155
    itemtypes                => \@itemtypes,
156
    ccode                    => $ccode,
152
);
157
);
153
158
154
# Walk through uploaded barcodes, report errors, mark as seen, check in
159
# Walk through uploaded barcodes, report errors, mark as seen, check in
Lines 260-271 if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) { Link Here
260
      branch       => $branch,
265
      branch       => $branch,
261
      offset       => 0,
266
      offset       => 0,
262
      statushash   => $staton,
267
      statushash   => $staton,
268
      ccode        => $ccode,
263
      ignore_waiting_holds => $ignore_waiting_holds,
269
      ignore_waiting_holds => $ignore_waiting_holds,
264
      itemtypes    => \@selected_itemtypes,
270
      itemtypes    => \@selected_itemtypes,
265
    });
271
    });
266
}
272
}
267
# Build rightplacelist used to check if a scanned item is in the right place.
273
# Build rightplacelist used to check if a scanned item is in the right place.
268
if( @scanned_items ) {
274
if( @scanned_items ) {
275
    # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch)
269
    ( $rightplacelist ) = GetItemsForInventory({
276
    ( $rightplacelist ) = GetItemsForInventory({
270
      minlocation  => $minlocation,
277
      minlocation  => $minlocation,
271
      maxlocation  => $maxlocation,
278
      maxlocation  => $maxlocation,
Lines 279-289 if( @scanned_items ) { Link Here
279
      statushash   => undef,
286
      statushash   => undef,
280
      ignore_waiting_holds => $ignore_waiting_holds,
287
      ignore_waiting_holds => $ignore_waiting_holds,
281
      itemtypes    => \@selected_itemtypes,
288
      itemtypes    => \@selected_itemtypes,
289
      ccode        => $ccode,
282
    });
290
    });
283
    # Convert the structure to a hash on barcode
291
    # Convert the structure to a hash on barcode
284
    $rightplacelist = {
292
    $rightplacelist = {
285
        map { $_->{barcode} ? ( $_->{barcode}, $_ ) : (); } @$rightplacelist
293
        map { $_->{barcode} ? ( $_->{barcode}, $_ ) : (); } @$rightplacelist
286
    };
294
    };
295
287
}
296
}
288
297
289
# Report scanned items that are on the wrong place, or have a wrong notforloan
298
# Report scanned items that are on the wrong place, or have a wrong notforloan
Lines 394-400 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
394
    my @translated_keys;
403
    my @translated_keys;
395
    for my $key (qw / biblioitems.title    biblio.author
404
    for my $key (qw / biblioitems.title    biblio.author
396
                      items.barcode        items.itemnumber
405
                      items.barcode        items.itemnumber
397
                      items.homebranch     items.location
406
                      items.homebranch     items.location   items.ccode
398
                      items.itemcallnumber items.notforloan
407
                      items.itemcallnumber items.notforloan
399
                      items.itemlost       items.damaged
408
                      items.itemlost       items.damaged
400
                      items.withdrawn      items.stocknumber
409
                      items.withdrawn      items.stocknumber
Lines 406-412 if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ Link Here
406
    $csv->combine(@translated_keys);
415
    $csv->combine(@translated_keys);
407
    print $csv->string, "\n";
416
    print $csv->string, "\n";
408
417
409
    my @keys = qw/ title author barcode itemnumber homebranch location itemcallnumber notforloan itemlost damaged withdrawn stocknumber /;
418
    my @keys = qw/ title author barcode itemnumber homebranch location ccode itemcallnumber notforloan itemlost damaged withdrawn stocknumber /;
410
    for my $item ( @$loop ) {
419
    for my $item ( @$loop ) {
411
        my @line;
420
        my @line;
412
        for my $key (@keys) {
421
        for my $key (@keys) {
413
- 

Return to bug 14393