@@ -, +, @@ --- C4/Items.pm | 9 +++++++- .../prog/en/modules/tools/inventory.tt | 22 +++++++++++++++++++ tools/inventory.pl | 13 +++++++++-- 3 files changed, 41 insertions(+), 3 deletions(-) --- a/C4/Items.pm +++ a/C4/Items.pm @@ -536,6 +536,7 @@ sub GetItemsForInventory { my $statushash = $parameters->{'statushash'} // ''; my $ignore_waiting_holds = $parameters->{'ignore_waiting_holds'} // ''; my $itemtypes = $parameters->{'itemtypes'} || []; + my $ccode = $parameters->{'ccode'} // ''; my $dbh = C4::Context->dbh; my ( @bind_params, @where_strings ); @@ -544,7 +545,8 @@ sub GetItemsForInventory { my $max_cnsort = GetClassSort($class_source,undef,$maxlocation); my $select_columns = q{ - SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort + SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber, items.cn_sort, ccode + }; my $select_count = q{SELECT COUNT(DISTINCT(items.itemnumber))}; my $query = q{ @@ -561,6 +563,11 @@ sub GetItemsForInventory { } } + if ($ccode){ + push @where_strings, 'ccode = ?'; + push @bind_params, $ccode; + } + if ($minlocation) { push @where_strings, 'items.cn_sort >= ?'; push @bind_params, $min_cnsort; --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -1,5 +1,6 @@ [% USE raw %] [% USE Asset %] +[% USE AuthorisedValues %] [% USE KohaDates %] [% USE Branches %] [% SET footerjs = 1 %] @@ -116,6 +117,22 @@ [% END %] [% END %] + [% SET ccodes = AuthorisedValues.GetAuthValueDropbox('CCODE') %] + [% IF ( ccodes.count > 0 ) %] +
  • + + +
  • + [% END %]
  • (items.itemcallnumber)
  • @@ -229,6 +246,7 @@ + [% UNLESS uploadedbarcodesflag %]
    Select all Clear all
    @@ -241,6 +259,7 @@ Barcode Call number Library + Collection code Title Not for loan Lost @@ -268,6 +287,9 @@ [% Branches.GetName( result.homebranch ) | html %] [% result.location | html %] + + [% result.ccode | html %] + [% result.title | html %] [% IF ( result.author ) %] --- a/tools/inventory.pl +++ a/tools/inventory.pl @@ -58,6 +58,7 @@ my $op = $input->param('op'); my $compareinv2barcd = $input->param('compareinv2barcd'); my $dont_checkin = $input->param('dont_checkin'); my $out_of_order = $input->param('out_of_order'); +my $ccode = $input->param('ccode'); my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "tools/inventory.tt", @@ -73,6 +74,9 @@ my $authorisedvalue_categories = ''; my $frameworks = Koha::BiblioFrameworks->search({}, { order_by => ['frameworktext'] })->unblessed; unshift @$frameworks, { frameworkcode => '' }; +my @collections = (); +my @collection_codes = (); + for my $fwk ( @$frameworks ){ my $fwkcode = $fwk->{frameworkcode}; my $mss = Koha::MarcSubfieldStructures->search({ frameworkcode => $fwkcode, kohafield => 'items.location', authorised_value => [ -and => {'!=' => undef }, {'!=' => ''}] }); @@ -149,6 +153,7 @@ $template->param( class_sources => \@class_sources, pref_class => $pref_class, itemtypes => \@itemtypes, + ccode => $ccode, ); # Walk through uploaded barcodes, report errors, mark as seen, check in @@ -260,12 +265,14 @@ if ( $op && ( !$uploadbarcodes || $compareinv2barcd )) { branch => $branch, offset => 0, statushash => $staton, + ccode => $ccode, ignore_waiting_holds => $ignore_waiting_holds, itemtypes => \@selected_itemtypes, }); } # Build rightplacelist used to check if a scanned item is in the right place. if( @scanned_items ) { + # For the items that may be marked as "wrong place", we only check the location (callnumbers, location, ccode and branch) ( $rightplacelist ) = GetItemsForInventory({ minlocation => $minlocation, maxlocation => $maxlocation, @@ -279,11 +286,13 @@ if( @scanned_items ) { statushash => undef, ignore_waiting_holds => $ignore_waiting_holds, itemtypes => \@selected_itemtypes, + ccode => $ccode, }); # Convert the structure to a hash on barcode $rightplacelist = { map { $_->{barcode} ? ( $_->{barcode}, $_ ) : (); } @$rightplacelist }; + } # Report scanned items that are on the wrong place, or have a wrong notforloan @@ -394,7 +403,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ my @translated_keys; for my $key (qw / biblioitems.title biblio.author items.barcode items.itemnumber - items.homebranch items.location + items.homebranch items.location items.ccode items.itemcallnumber items.notforloan items.itemlost items.damaged items.withdrawn items.stocknumber @@ -406,7 +415,7 @@ if (defined $input->param('CSVexport') && $input->param('CSVexport') eq 'on'){ $csv->combine(@translated_keys); print $csv->string, "\n"; - my @keys = qw/ title author barcode itemnumber homebranch location itemcallnumber notforloan itemlost damaged withdrawn stocknumber /; + my @keys = qw/ title author barcode itemnumber homebranch location ccode itemcallnumber notforloan itemlost damaged withdrawn stocknumber /; for my $item ( @$loop ) { my @line; for my $key (@keys) { --