Bugzilla – Attachment 109236 Details for
Bug 20206
Inventory: barcodes without or with extra leading zeroes are reported not found
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 20206: Find barcodes with more or less leading zeroes
Bug-20206-Find-barcodes-with-more-or-less-leading-.patch (text/plain), 2.67 KB, created by
Marcel de Rooy
on 2020-08-27 14:42:05 UTC
(
hide
)
Description:
Bug 20206: Find barcodes with more or less leading zeroes
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2020-08-27 14:42:05 UTC
Size:
2.67 KB
patch
obsolete
>From 8663c499e66ec2aaf971c82f2c522f1c73bddca0 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Mon, 19 Feb 2018 11:29:04 +0100 >Subject: [PATCH] Bug 20206: Find barcodes with more or less leading zeroes >Content-Type: text/plain; charset=utf-8 > >--- > koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt | 1 + > tools/inventory.pl | 9 +++++++-- > 2 files changed, 8 insertions(+), 2 deletions(-) > >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 2db78af6bd..5057ed0753 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -31,6 +31,7 @@ > <div class="dialog alert"> > [% error.barcode | html %] > [% IF (error.ERR_BARCODE) %]: barcode not found[% END %] >+ [% IF (error.ERR_DUPLICATE_BARCODES) %]: duplicate barcodes with/without 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 %] >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 13b7a538a5..a4ecb87589 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -197,8 +197,11 @@ if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { > 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 })->store; > my $item_unblessed = $item->unblessed; >@@ -217,6 +220,8 @@ if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { > } > } > 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 }; > } >-- >2.11.0
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 20206
:
71650
|
109236
|
109369
|
122351