From 83b364ec56ae94a077542691f790d6153d90c4d1 Mon Sep 17 00:00:00 2001 From: Jonathan Druart Date: Mon, 26 Mar 2018 12:22:15 -0300 Subject: [PATCH] Bug 20462: Ensure batch item deletion will not delete the same item twice MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This has been done on bug 9509 when barcodes are scaned, but not when using a text file. Test plan (stolen from Barton on the bug report): 1) Create a text file containing duplicate barcodes Here's a quick way to do that, substitute INSTANCE for the instance name of your test server: sudo koha-mysql INSTANCE <<< "select barcode from items where barcode is not null limit 3" | sed '1d;p' > /tmp/dup_barcodes.txt 2) Go to Home › Tools › Batch item deletion 3) Click 'Choose File', select the file you created in step 1. 4) Click 'Continue' 5) Note that duplicate items appear in the list of items to batch delete 6) Check 'Delete records if no items remain' 7) This will trigger a software error Note that entering the barcodes via the 'scan items one by one' text box removes duplicates in the list, so this only causes problems when uploading a file. Signed-off-by: Mark Tompsett Signed-off-by: Josef Moravec Signed-off-by: Jonathan Druart --- tools/batchMod.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/tools/batchMod.pl b/tools/batchMod.pl index 5f540766f6..94062f79ed 100755 --- a/tools/batchMod.pl +++ b/tools/batchMod.pl @@ -242,6 +242,7 @@ if ($op eq "show"){ push @contentlist, $content if $content; } + @contentlist = uniq @contentlist; if ($filecontent eq 'barcode_file') { foreach my $barcode (@contentlist) { -- 2.39.5