- ModItem( { datelastseen => $date }, undef, $item->{'itemnumber'} );
- push @scanned_items, $item;
- $count++;
- $qonloan->execute($barcode);
- if ($qonloan->rows){
- my $data = $qonloan->fetchrow_hashref;
- my ($doreturn, $messages, $iteminformation, $borrower) =AddReturn($barcode, $data->{homebranch});
- if ($doreturn){
- push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_RET'=>1}
- } else {
- push @errorloop, {'barcode'=>$barcode,'ERR_ONLOAN_NOT_RET'=>1}
+ # Modify date last seen for scanned items, remove lost status
+ ModItem( { itemlost => 0, datelastseen => $date }, undef, $item->{'itemnumber'} );
+ $moddatecount++;
+ # update item hash accordingly
+ $item->{itemlost} = 0;
+ $item->{datelastseen} = $date;
+ unless ( $dont_checkin ) {
+ $qonloan->execute($barcode);
+ if ($qonloan->rows){
+ my $data = $qonloan->fetchrow_hashref;
+ my ($doreturn, $messages, $iteminformation, $borrower) =AddReturn($barcode, $data->{homebranch});
+ if( $doreturn ) {
+ $item->{onloan} = undef;
+ $item->{datelastseen} = dt_from_string;
+ } else {
+ push @errorloop, { barcode => $barcode, ERR_ONLOAN_NOT_RET => 1 };
+ }