From 398be4af739aaf06fbbdeb8f4adfa9a829b8ee3b Mon Sep 17 00:00:00 2001 From: Arthur Suzuki Date: Fri, 11 Oct 2019 23:42:25 +0200 Subject: [PATCH] Bug 23800: fix regression in batch item modification tool Test plan : 1/ scan several items in the Tools / Batch Item Modification 2/ click continue 3/ check that items were not displayed in the order they appeared in 4/ apply patch 5/ repeat step 1 and 2 6/ verify that items now appear in the order they were scanned --- tools/batchMod.pl | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 2e6473784c..98cbc757a1 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -282,9 +282,15 @@ 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 $order = "field(" . join(",","barcode",@barcodelist) . ")"; + my $existing_items = Koha::Items->search({ barcode => \@barcodelist }, + { order_by => \[$order] } )->unblessed; + + my @barcodes; + foreach my $itm (@$existing_items) { + push @itemnumbers, $itm->{'itemnumber'}; + push @barcodes, $itm->{'barcode'}; + } my %exists = map {lc($_)=>1} @barcodes; # to avoid problems with case sensitivity foreach my $barcode (@barcodelist) { -- 2.20.1