@@ -, +, @@ --- .../prog/en/modules/tools/inventory.tt | 6 +++ tools/inventory.pl | 39 +++++++++++++++----- 2 files changed, 36 insertions(+), 9 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -181,6 +181,10 @@ $(document).ready(function(){ +
  • + + +
  • @@ -254,6 +258,8 @@ $(document).ready(function(){

    Change item status

    [% ELSIF result.problem == 'not_scanned' %]

    Item should have been scanned

    + [% ELSIF result.problem == 'out_of_order' %] +

    Item may be shelved out of order

    [% END %] --- a/tools/inventory.pl +++ a/tools/inventory.pl @@ -52,6 +52,7 @@ my $branchcode = $input->param('branchcode') || ''; 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 ( $template, $borrowernumber, $cookie ) = get_template_and_user( { template_name => "tools/inventory.tt", @@ -220,7 +221,26 @@ if ( $compareinv2barcd ) { # insert "wrongplace" to all scanned items that are not supposed to be in this range # note this list is always displayed, whatever the librarian has choosen for comparison my $moddatecount = 0; -foreach my $item ( @scanned_items ) { +for ( my $i = 0; $i < @scanned_items; $i++ ) { + my $item = $scanned_items[$i]; + + # 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->{problem} = 'out_of_order'; + push( @items_with_problems, {%$item} ); + } + } + unless ( $i == scalar(@scanned_items) ) { + my $next_item = $scanned_items[ $i + 1 ]; + if ( $next_item && $item->{cn_sort} gt $next_item->{cn_sort} ) { + $item->{problem} = 'out_of_order'; + push( @items_with_problems, {%$item} ); + } + } + } # Saving notforloan code before it's replaced by it's authorised value for later comparison $item->{notforloancode} = $item->{notforloan}; @@ -242,9 +262,11 @@ foreach my $item ( @scanned_items ) { next if $item->{onloan}; # skip checked out items # If we have scanned items with a non-matching notforloan value - if (none { $item->{'notforloancode'} eq $_ } @notforloans) { - $item->{problem} = 'changestatus'; - push @items_with_problems, { %$item }; + if ( $item->{notforloancode} ) { + if ( none { $item->{'notforloancode'} eq $_ } @notforloans ) { + $item->{problem} = 'changestatus'; + push @items_with_problems, {%$item}; + } } if (none { $item->{barcode} eq $_->{barcode} && !$_->{'onloan'} } @$inventorylist) { $item->{problem} = 'wrongplace'; @@ -275,11 +297,10 @@ for my $item ( @items_with_problems ) { # If a barcode file is given, we want to show problems, else all items my @results; -@results = $uploadbarcodes - ? @items_with_problems - : $op - ? @$inventorylist - : (); +@results = + $uploadbarcodes ? @items_with_problems + : $op ? @$inventorylist + : undef; $template->param( moddatecount => $moddatecount, --