From 78eddc62ec0725c774801b44b08908c1712c5553 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 | 5 ++++- .../prog/en/modules/tools/inventory.tt | 15 +++++++++++++++ tools/inventory.pl | 9 ++++++--- 3 files changed, 25 insertions(+), 4 deletions(-) diff --git a/C4/Items.pm b/C4/Items.pm index 994dbe0..d972547 100644 --- a/C4/Items.pm +++ b/C4/Items.pm @@ -1090,7 +1090,10 @@ sub GetItemsForInventory { if ($f and $sf) { # We replace the code with it's description my $authvals = C4::Koha::GetKohaAuthorisedValuesFromField($f, $sf, $row->{'frameworkcode'}); - $row->{$_} = $authvals->{$row->{$_}} if defined $authvals->{$row->{$_}}; + if ( defined $authvals->{ $row->{$_} } ) { + $row->{"$_-code"} = $row->{$_}; + $row->{$_} = $authvals->{ $row->{$_} }; + } } } push @results, $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 cbe99b3..881e669 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -163,6 +163,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 2529106..81dc489 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", @@ -285,8 +286,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