Bugzilla – Attachment 90186 Details for
Bug 22996
Move barcode separators to a preference
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 22996: Move barcode separators to a preference
Bug-22996-Move-barcode-separators-to-a-preference.patch (text/plain), 3.44 KB, created by
Marcel de Rooy
on 2019-05-29 13:42:51 UTC
(
hide
)
Description:
Bug 22996: Move barcode separators to a preference
Filename:
MIME Type:
Creator:
Marcel de Rooy
Created:
2019-05-29 13:42:51 UTC
Size:
3.44 KB
patch
obsolete
>From de338ea2c81c0597c4f97efde742c2246b57dd38 Mon Sep 17 00:00:00 2001 >From: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >Date: Tue, 28 May 2019 14:14:02 +0000 >Subject: [PATCH] Bug 22996: Move barcode separators to a preference >Content-Type: text/plain; charset=utf-8 > >This patch makes batchMod.pl and inventory.pl pick the barcode >separators from a new pref BarcodeSeparators (instead of hardcoding >these separators differently). >A few other code locations may be potential candidates for such a change >too. > >Test plan: >Test inventory with a few variations of BarcodeSeparators. >Test Batch item modification similarly. > >Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> >--- > tools/batchMod.pl | 12 ++++++++---- > tools/inventory.pl | 3 ++- > 2 files changed, 10 insertions(+), 5 deletions(-) > >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index e5b6032900..3efe25cfde 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -244,22 +244,25 @@ if ($op eq "show"){ > my $filecontent = $input->param('filecontent'); > my ( @notfoundbarcodes, @notfounditemnumbers); > >- my @contentlist; >+ my $split_chars = C4::Context->preference('BarcodeSeparators'); > if ($filefh){ > binmode $filefh, ':encoding(UTF-8)'; >+ my @contentlist; > while (my $content=<$filefh>){ > $content =~ s/[\r\n]*$//; > push @contentlist, $content if $content; > } > >- @contentlist = uniq @contentlist; > if ($filecontent eq 'barcode_file') { >+ @contentlist = grep /\S/, ( map { split /[$split_chars]/ } @contentlist ); >+ @contentlist = uniq @contentlist; > my $existing_items = Koha::Items->search({ barcode => \@contentlist }); > @itemnumbers = $existing_items->get_column('itemnumber'); > my %exists = map {$_=>1} $existing_items->get_column('barcode'); > @notfoundbarcodes = grep { !$exists{$_} } @contentlist; > } > elsif ( $filecontent eq 'itemid_file') { >+ @contentlist = uniq @contentlist; > @itemnumbers = Koha::Items->search({ itemnumber => \@contentlist })->get_column('itemnumber'); > my %exists = map {$_=>1} @itemnumbers; > @notfounditemnumbers = grep { !$exists{$_} } @contentlist; >@@ -271,8 +274,9 @@ if ($op eq "show"){ > push @itemnumbers, $itm->{itemnumber}; > } > } >- if ( my $list=$input->param('barcodelist')){ >- push my @barcodelist, uniq( split(/\s\n/, $list) ); >+ if ( my $list = $input->param('barcodelist') ) { >+ my @barcodelist = grep /\S/, ( split /[$split_chars]/, $list ); >+ @barcodelist = uniq @barcodelist; > > my $existing_items = Koha::Items->search({ barcode => \@barcodelist }); > @itemnumbers = $existing_items->get_column('itemnumber'); >diff --git a/tools/inventory.pl b/tools/inventory.pl >index 96a6bdf5ca..1ab319fb49 100755 >--- a/tools/inventory.pl >+++ b/tools/inventory.pl >@@ -166,7 +166,8 @@ if ( $uploadbarcodes && length($uploadbarcodes) > 0 ) { > my $lines_read=0; > binmode($uploadbarcodes, ":encoding(UTF-8)"); > while (my $barcode=<$uploadbarcodes>) { >- push @uploadedbarcodes, grep { /\S/ } split( /[\n\r,;|-]/, $barcode ); >+ my $split_chars = C4::Context->preference('BarcodeSeparators'); >+ push @uploadedbarcodes, grep { /\S/ } split( /[$split_chars]/, $barcode ); > } > for my $barcode (@uploadedbarcodes) { > next unless $barcode; >-- >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 22996
:
90155
|
90156
|
90185
|
90186
|
92636
|
92637
|
92668
|
92669