From 6a713f7793463effc5ca7c174436c3fdc1a3bb63 Mon Sep 17 00:00:00 2001 From: Fridolin Somers Date: Fri, 12 Sep 2014 15:21:18 +0200 Subject: [PATCH] Bug 12913 - wrong inventory results when notforloan filter is not used In inventory tool, there is a test on scanned items notforloan value : if the value is not one of authorized values, the inventory results displays the problem "Change item status". The bug is that if notforloan filter is not used, the notforloan values array is not filled and so all scanned items are marked with this problem. Test plan : - Check you have in default framework an item subfield mapped with items.notforloan and with an authorized value catergory, for example 'NOTFORLOAN' - Check the authorized value category has at least value '0' - Create a new value in this category, for example '9' - Create a biblio with default framework - Create an item with barcode='000AAA1', callnumber='ZZZAAA1' and notforloan=0 - Create an item with barcode='000AAA2', callnumber='ZZZAAA2' and notforloan=9 - Delete new value created above, for example '9' - Create a file 'barecodes.txt' containing 2 lines '000AAA1' and '000AAA2' - Go to inventory tool : /cgi-bin/koha/tools/inventory.pl - Choose file in 'Barcode file' - Enter item callnumber between 'ZZZ' and 'ZZZZ' - Check 'Compare barcodes list to results' - Submit => without patch, you get 2 results with problem 'Change item status' even for item with notforloan=0 => with patch, you get 1 result with 'Change item status' on item with notforloan=9 Signed-off-by: Nick Clemens Signed-off-by: Marcel de Rooy Signed-off-by: Kyle M Hall (cherry picked from commit 358fb744c74cc63b7d2ae7d7e406ada205502ea8) Signed-off-by: Katrin Fischer --- tools/inventory.pl | 20 ++++---------------- 1 file changed, 4 insertions(+), 16 deletions(-) diff --git a/tools/inventory.pl b/tools/inventory.pl index 990855f840..52cc83d58e 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -94,6 +94,7 @@ for my $fwk (keys %$frameworks){ } my $statuses = []; +my @notforloans; for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.damaged/){ my $hash = {}; $hash->{fieldname} = $statfield; @@ -102,6 +103,9 @@ for my $statfield (qw/items.notforloan items.itemlost items.withdrawn items.dama my $arr = GetAuthorisedValues($hash->{authcode}); $hash->{values} = $arr; push @$statuses, $hash; + if ( $statfield eq 'items.notforloan') { + @notforloans = map { $_->{'authorised_value'} } @$arr; + } } } @@ -117,16 +121,6 @@ for my $authvfield (@$statuses) { } } -my $notforloanlist; -my $statussth = ''; -for my $authvfield (@$statuses) { - if ( scalar @{$staton->{$authvfield->{fieldname}}} > 0 ){ - my $joinedvals = join ',', @{$staton->{$authvfield->{fieldname}}}; - $statussth .= "$authvfield->{fieldname} in ($joinedvals) and "; - $notforloanlist = $joinedvals if ($authvfield->{fieldname} eq "items.notforloan"); - } -} -$statussth =~ s, and $,,g; $template->param( branchloop => \@branch_loop, authorised_values => \@authorised_value_list, @@ -139,14 +133,8 @@ $template->param( branch => $branch, datelastseen => $datelastseen, compareinv2barcd => $compareinv2barcd, - notforloanlist => $notforloanlist ); -my @notforloans; -if (defined $notforloanlist) { - @notforloans = split(/,/, $notforloanlist); -} - my @scanned_items; my @errorloop; if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { -- 2.39.5