@@ -, +, @@ --- .../intranet-tmpl/prog/en/modules/tools/inventory.tt | 1 + tools/inventory.pl | 9 +++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) --- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt +++ a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt @@ -57,6 +57,7 @@
[% error.barcode | html %] [% IF (error.ERR_BARCODE) %]: barcode not found[% END %] + [% IF (error.ERR_DUPLICATE_BARCODES) %]: duplicate barcodes with leading zeroes[% END %] [% IF (error.ERR_WTHDRAWN) %]: item withdrawn[% END %] [% IF (error.ERR_ONLOAN_RET) %]: item was on loan. It was returned before marked as seen[% END %] [% IF (error.ERR_ONLOAN_NOT_RET) %]: item was on loan. couldn't be returned.[% END %] --- a/tools/inventory.pl +++ a/tools/inventory.pl @@ -213,8 +213,11 @@ if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length if ( $qwithdrawn->execute($barcode) && $qwithdrawn->rows ) { push @errorloop, { 'barcode' => $barcode, 'ERR_WTHDRAWN' => 1 }; } else { - my $item = Koha::Items->find({barcode => $barcode}); - if ( $item ) { + my $barcode_nz = $barcode; + $barcode_nz =~ s/^0*//; + my $item_rs = Koha::Items->search({barcode => { 'regexp', "^0*${barcode_nz}\$" }}); + if ( $item_rs->count == 1 ) { + my $item = $item_rs->next; # Modify date last seen for scanned items, remove lost status $item->set({ itemlost => 0, datelastseen => $date_dt })->store; my $item_unblessed = $item->unblessed; @@ -233,6 +236,8 @@ if ( ($uploadbarcodes && length($uploadbarcodes) > 0) || ($barcodelist && length } } push @scanned_items, $item_unblessed; + } elsif( $item_rs->count > 1 ) { # duplicates like 1 and 01 + push @errorloop, { barcode => $barcode_nz, ERR_DUPLICATE_BARCODES => 1 }; } else { push @errorloop, { barcode => $barcode, ERR_BARCODE => 1 }; } --