Bugzilla – Attachment 95659 Details for
Bug 23800
Batch modification tool orders items by barcode incremental by default (regression to 17.11)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 23800: Does not order items by barcode in batch item modification
Bug-23800-Does-not-order-items-by-barcode-in-batch.patch (text/plain), 4.00 KB, created by
ByWater Sandboxes
on 2019-11-21 14:32:52 UTC
(
hide
)
Description:
Bug 23800: Does not order items by barcode in batch item modification
Filename:
MIME Type:
Creator:
ByWater Sandboxes
Created:
2019-11-21 14:32:52 UTC
Size:
4.00 KB
patch
obsolete
>From 8a169614c91765940adb44c0ec06784769c087b6 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Mon, 11 Nov 2019 11:09:45 +0100 >Subject: [PATCH] Bug 23800: Does not order items by barcode in batch item > modification > >They must be displayed in the same order they have been scanned (or they >appear in the file) > >This is an alternative patch. Same behavior for barcodes or itemnumbers, >as well as if a file has been used or items scanned. >Code is duplicated, but refactoring is out of the scope. > >Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> >--- > tools/batchMod.pl | 40 +++++++++++++++++++++++++--------------- > 1 file changed, 25 insertions(+), 15 deletions(-) > >diff --git a/tools/batchMod.pl b/tools/batchMod.pl >index 2e6473784c..0063fc5d1b 100755 >--- a/tools/batchMod.pl >+++ b/tools/batchMod.pl >@@ -256,19 +256,27 @@ if ($op eq "show"){ > 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 {lc($_)=>1} $existing_items->get_column('barcode'); >+ my @existing_items = @{ Koha::Items->search({ barcode => \@contentlist })->unblessed }; >+ @existing_items = map { >+ my $barcode = $_; >+ grep { $_->{barcode} eq $barcode ? $_ : () } @existing_items >+ } @contentlist; >+ @itemnumbers = map { $_->{itemnumber} } @existing_items; >+ my @barcodes = map { $_->{barcode} } @existing_items; > # to avoid problems with case sensitivity >- foreach my $barcode (@contentlist) { >- $barcode = lc($barcode); >- } >+ my %exists = map { lc($_) => 1 } @barcodes; >+ @contentlist = map { lc($_) } @contentlist; > @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; >+ my @existing_items = @{ Koha::Items->search({ itemnumber => \@contentlist })->unblessed }; >+ @existing_items = map { >+ my $barcode = $_; >+ grep { $_->{barcode} eq $barcode ? $_ : () } @existing_items >+ } @contentlist; >+ @itemnumbers = map { $_->{itemnumber} } @existing_items; >+ my %exists = map { $_ => 1 } @itemnumbers; > @notfounditemnumbers = grep { !$exists{$_} } @contentlist; > } > } else { >@@ -282,14 +290,16 @@ if ($op eq "show"){ > 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'); >- my @barcodes = $existing_items->get_column('barcode'); >- my %exists = map {lc($_)=>1} @barcodes; >+ my @existing_items = @{ Koha::Items->search({ barcode => \@barcodelist })->unblessed }; >+ @existing_items = map { >+ my $barcode = $_; >+ grep { $_->{barcode} eq $barcode ? $_ : () } @existing_items >+ } @barcodelist; >+ @itemnumbers = map { $_->{itemnumber} } @existing_items; >+ my @barcodes = map { $_->{barcode} } @existing_items; > # to avoid problems with case sensitivity >- foreach my $barcode (@barcodelist) { >- $barcode = lc($barcode); >- } >+ my %exists = map { lc($_) => 1 } @barcodes; >+ @barcodelist = map { lc($_) } @barcodelist; > @notfoundbarcodes = grep { !$exists{$_} } @barcodelist; > } > } >-- >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 23800
:
93987
|
94032
|
94033
|
94034
|
94353
|
94354
|
95252
|
95659
|
96241
|
96242
|
96243