Bugzilla – Attachment 126868 Details for
Bug 29114
Can not add barcodes with whitespaces at the beginning to the list
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 29114: Trim whitespace before the barcode
Bug-29114-Trim-whitespace-before-the-barcode.patch (text/plain), 1.79 KB, created by
Andrii Veremeienko
on 2021-10-26 06:56:23 UTC
(
hide
)
Description:
Bug 29114: Trim whitespace before the barcode
Filename:
MIME Type:
Creator:
Andrii Veremeienko
Created:
2021-10-26 06:56:23 UTC
Size:
1.79 KB
patch
obsolete
>From 5bad51bf88f284d675efc5cce129ac97676c0a8e Mon Sep 17 00:00:00 2001 >From: Andrii Veremeienko <averemeienko@jabra.com> >Date: Tue, 26 Oct 2021 09:55:34 +0300 >Subject: [PATCH] Bug 29114: Trim whitespace before the barcode > >The solution was to add regexp that trims all whitespaces. > >How to test: >1. Go to the koha/virtualshelves/shelves.pl; >2. Add new list or edit existing one; >3. Start adding new items; >4. In the "Barcode" field add barcode(s) with whitespaces before them; >5. Observe that it wasn't added as the barcode isn't recognized because of whitespaces; >6. Apply the patch; >7. Repeat step 4; >8. Observe that the item was successfully added; >--- > virtualshelves/shelves.pl | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > >diff --git a/virtualshelves/shelves.pl b/virtualshelves/shelves.pl >index 25f2127b1c..fa671cd347 100755 >--- a/virtualshelves/shelves.pl >+++ b/virtualshelves/shelves.pl >@@ -21,6 +21,7 @@ use Modern::Perl; > use CGI qw ( -utf8 ); > use C4::Auth qw( get_template_and_user ); > use C4::Biblio qw( GetMarcBiblio ); >+use C4::Circulation qw( barcodedecode ); > use C4::Koha qw( > GetNormalizedEAN > GetNormalizedISBN >@@ -154,7 +155,8 @@ if ( $op eq 'add_form' ) { > if ( $shelf->can_biblios_be_added( $loggedinuser ) ) { > my @barcodes = split /\n/, $barcodes; # Entries are effectively passed in as a <cr> separated list > foreach my $barcode (@barcodes){ >- $barcode =~ s/\r$//; # strip any naughty return chars >+ $barcode =~ s/^\s*|\s*$//g; # remove leading/trailing whitespace >+ $barcode = barcodedecode( $barcode ) if $barcode; > next if $barcode eq ''; > my $item = Koha::Items->find({barcode => $barcode}); > if ( $item ) { >-- >2.17.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 29114
:
125369
|
125752
|
125753
|
125815
|
125816
|
126867
|
126868
|
126896
|
127075
|
127098
|
137687
|
137773