From a4a55893bfb95e8d2195c07973aa8ee07a4c8614 Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Mon, 16 Dec 2013 13:23:34 -0500 Subject: [PATCH] Bug 11405 [6] - Allow items with selected locations to be not be flagged as "Item should have been scanned" if not scanned This patch allows items to be skipped over if the item has one of the locations selected in the new field set listing shelving locations. Test Plan: 1) Apply this patch 2) Generate a list of barcodes ordered by callnumber 3) Set one of those items to a shelving location 4) Remove that item from the list 5) Run the inventory tool with this list of barcodes 6) Note the item is listed as "should have been scanned" 7) Click back to return to the previous page 8) Select the shelving location from "If comparing barcodes list to results, assume items with the following locations should note have been scanned". 8) Re-run the inventory tool 9) Note the item is no longer listed as "should have been scanned" --- C4/Items.pm | 1 + .../prog/en/modules/tools/inventory.tt | 15 +++++++++++++++ tools/inventory.pl | 9 ++++++--- 3 files changed, 22 insertions(+), 3 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 727ddd6..611d1a2 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1164,6 +1164,7 @@ sub GetItemsForInventory { # Auth values foreach (keys %$row) { if (defined($avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}})) { + $row->{"$_-code"} = $row->{$_}; $row->{$_} = $avmapping->{"items.$_,".$row->{'frameworkcode'}.",".$row->{$_}}; } } diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt index dfa9227..039ca1f 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -196,6 +196,21 @@ $(document).ready(function(){ [% END %] + [% IF (authorised_values) %] +
+ If comparing barcodes list to results, assume items with the following locations should not have been scanned + +
    + [% FOREACH value IN authorised_values %] +
  1. + + +
  2. + [% END %] +
+
+ [% END %] +
  1. diff --git a/tools/inventory.pl b/tools/inventory.pl index 4792349..88532d1 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -37,7 +37,7 @@ use C4::Circulation; use C4::Reports::Guided; #_get_column_defs use C4::Charset; use Koha::DateUtils; -use List::MoreUtils qw( none ); +use List::MoreUtils qw( none any ); my $minlocation=$input->param('minlocation') || ''; @@ -54,6 +54,7 @@ my $branch = $input->param('branch'); my $op = $input->param('op'); my $compareinv2barcd = $input->param('compareinv2barcd'); my $out_of_order = $input->param('out_of_order'); +my @ignore_locations = $input->param('ignore_locations'); my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "tools/inventory.tt", @@ -364,8 +365,10 @@ if ( $compareinv2barcd ) { for my $should_be_scanned ( @$inventorylist ) { my $barcode = $should_be_scanned->{barcode}; unless ( grep /^$barcode$/, @scanned_barcodes ) { - $should_be_scanned->{problem} = 'not_scanned'; - push @items_with_problems, { %$should_be_scanned }; + unless ( any { $should_be_scanned->{'location-code'} eq $_ } @ignore_locations ) { + $should_be_scanned->{problem} = 'not_scanned'; + push @items_with_problems, { %$should_be_scanned }; + } } } } -- 1.7.2.5