From c0bc29eaf377737663c719dc4ac9fdd25fc608aa Mon Sep 17 00:00:00 2001 From: Kyle M Hall Date: Tue, 25 Sep 2018 10:16:53 -0300 Subject: [PATCH] Bug 21408: Inventory - Warn of items possibly scanned out of order This patch addes the ability to choose to be warned if it's possible an item was scanned out of order ( i.e. mis-shelved ). Test Plan: 1) Apply this patch 2) Generate a list of barcodes ordered by callnumber 3) "Misplace" one callnumber by moving it to another area of the list 4) Browse to the inventory tool, choose your barcodes file 5) Check the checkbox for "Check barcodes list for items shelved out of order" 6) Click "submit", note the item has been flagged as possibly out of order Signed-off-by: Tomas Cohen Arazi Signed-off-by: Katrin Fischer Signed-off-by: Nick Clemens --- .../prog/en/modules/tools/inventory.tt | 3 +++ tools/inventory.pl | 24 ++++++++++++++++++- 2 files changed, 26 insertions(+), 1 deletion(-) 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 a8a68633a0..0d87de7a92 100644 --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -47,6 +47,7 @@
  • +
  • @@ -224,6 +225,8 @@ Still checked out
    [% ELSIF problem.key == 'no_barcode' %] No barcode
    + [% ELSIF problem.key == 'out_of_order' %] + Item may be shelved out of order
    [% END %] [% END %] diff --git a/tools/inventory.pl b/tools/inventory.pl index 2ad1dd8d2c..ac33fbefcd 100755 --- a/tools/inventory.pl +++ b/tools/inventory.pl @@ -52,6 +52,7 @@ my $branch = $input->param('branch'); 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 ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "tools/inventory.tt", @@ -252,7 +253,10 @@ if( @scanned_items ) { # Report scanned items that are on the wrong place, or have a wrong notforloan # status, or are still checked out. -foreach my $item ( @scanned_items ) { +for ( my $i = 0; $i < @scanned_items; $i++ ) { + + my $item = $scanned_items[$i]; + $item->{notforloancode} = $item->{notforloan}; # save for later use my $fc = $item->{'frameworkcode'} || ''; @@ -271,6 +275,24 @@ foreach my $item ( @scanned_items ) { additemtoresults( $item, $results ); } + # Check for items shelved out of order + if ($out_of_order) { + unless ( $i == 0 ) { + my $previous_item = $scanned_items[ $i - 1 ]; + if ( $previous_item && $item->{cn_sort} lt $previous_item->{cn_sort} ) { + $item->{problems}->{out_of_order} = 1; + additemtoresults( $item, $results ); + } + } + unless ( $i == scalar(@scanned_items) ) { + my $next_item = $scanned_items[ $i + 1 ]; + if ( $next_item && $item->{cn_sort} gt $next_item->{cn_sort} ) { + $item->{problems}->{out_of_order} = 1; + additemtoresults( $item, $results ); + } + } + } + # Report an item that is checked out (unusual!) or wrongly placed if( $item->{onloan} ) { $item->{problems}->{checkedout} = 1; -- 2.39.5