Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)
authorJonathan Druart <jonathan.druart@bugs.koha-community.org>
Mon, 4 Mar 2019 19:57:26 +0000 (16:57 -0300)
committerNick Clemens <nick@bywatersolutions.com>
Fri, 15 Mar 2019 12:36:11 +0000 (12:36 +0000)
Test plan:
0/ Do not apply this patch
1/ Place several holds on a given item
2/ Use the inventory with the "skip waiting holds" option to list this item.
It will be displayed several times
3/ Apply this patch and confirm that the item is now only displayed once

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>

Signed-off-by: Nick Clemens <nick@bywatersolutions.com>

C4/Items.pm

index a4ac0e9..611c63e 100644 (file)
@@ -777,9 +777,9 @@ sub GetItemsForInventory {
     my $max_cnsort = GetClassSort($class_source,undef,$maxlocation);
 
     my $select_columns = q{
-        SELECT items.itemnumber, barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber
+        SELECT DISTINCT(items.itemnumber), barcode, itemcallnumber, title, author, biblio.biblionumber, biblio.frameworkcode, datelastseen, homebranch, location, notforloan, damaged, itemlost, withdrawn, stocknumber
     };
-    my $select_count = q{SELECT COUNT(*)};
+    my $select_count = q{SELECT COUNT(DISTINCT(items.itemnumber))};
     my $query = q{
         FROM items
         LEFT JOIN biblio ON items.biblionumber = biblio.biblionumber