Bugzilla – Attachment 122297 Details for
Bug 28491
Field 003 in authority records not updated after import
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), 3.10 KB, created by
Hakam Almotlak
on 2021-06-22 17:29:18 UTC
(
hide
)
Description:
Bug 20206: Find barcodes with more or less leading zeroes
Filename:
MIME Type:
Creator:
Hakam Almotlak
Created:
2021-06-22 17:29:18 UTC
Size:
3.10 KB
patch
obsolete
>From 3d778f64ebee4670f57b4d7307e8af91977c00f9 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 > >Test plan: >Pick an item, change barcode to e.g. 0123456 >Create a barcode file with 123456. Run inventory with it. Should be found and modified. >Change barcode file by modifying 123456 to 00123456. Same result. >Change barcode of another item to 000123456. >Run inventory again on same barcode file: 0 modified, warn on duplicates? > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> > >https://bugs.koha-community.org/show_bug.cgi?id=28491 >--- > .../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 8edc3739b4..749ff2effc 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/tools/inventory.tt >@@ -57,6 +57,7 @@ > <div class="dialog alert"> > [% 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 %] >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 2ad5452015..3d78942b6c 100755 >--- a/tools/inventory.pl >+++ b/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 }; > } >-- >2.25.1
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 28491
:
122209
|
122210
|
122211
|
122294
|
122295
|
122296
|
122297
|
122298
|
122299
|
122300