From 3bcca3a62ffe775ca6c329caf842b37ff9a9db18 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 + .../intranet-tmpl/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 9c2bb8a..d8a9988 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1162,6 +1162,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 7cffb4e..add4f88 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 16574f5..896b750 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') || ''; @@ -55,6 +55,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 @ignore_locations = $input->param('ignore_locations'); my ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "tools/inventory.tt", @@ -367,8 +368,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 }; + } } } } -- 2.1.4