+
+ 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 (none { $item->{barcode} eq $_->{barcode} && !$_->{'onloan'} } @$inventorylist) {
+ $item->{problem} = 'wrongplace';
+ push @items_with_problems, { %$item };
+ }
+
+ # Modify date last seen for scanned items
+ ModDateLastSeen($_->{'itemnumber'});
+ $moddatecount++;
+}
+
+if ( $compareinv2barcd ) {
+ my @scanned_barcodes = map {$_->{barcode}} @scanned_items;
+ 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 };
+ }
+ }
+}
+
+for my $item ( @items_with_problems ) {
+ my $biblio = C4::Biblio::GetBiblioData($item->{biblionumber});
+ $item->{title} = $biblio->{title};
+ $item->{author} = $biblio->{author};