Bug 22219

Summary: C4::Biblio->GetItemsForInventory can return wrong count / duplicated items when skipping waiting holds
Product: Koha Reporter: Nick Clemens <nick>
Component: Architecture, internals, and plumbingAssignee: Jonathan Druart <jonathan.druart>
Status: CLOSED FIXED QA Contact: Josef Moravec <josef.moravec>
Severity: normal    
Priority: P5 - low CC: jonathan.druart, josef.moravec, lucas, m.de.rooy, martin.renvoize, pierre-marc.thibault, tomascohen
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: ---
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Bug Depends on: 21413    
Bug Blocks:    
Attachments: Bug 22219: Add tests
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)
Bug 22219: Add tests
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)
Bug 22219: Add tests
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)

Description Nick Clemens 2019-01-28 19:27:13 UTC
The SQL does a left join to reserves ON (itemnumber)

If there are multiple item-specific holds we will get multiple results for a biblio

Discovered while running tests on bug 21798

To recreate:
1 - place several holds on a specific item
2 - prove -v t/db_dependent/Items/GetItemsForInventory
3 - It fails
Comment 1 Jonathan Druart 2019-03-04 19:59:55 UTC
Created attachment 86030 [details] [review]
Bug 22219: Add tests
Comment 2 Jonathan Druart 2019-03-04 20:00:02 UTC
Created attachment 86031 [details] [review]
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)

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
Comment 3 Pierre-Marc Thibault 2019-03-08 20:33:36 UTC
Created attachment 86402 [details] [review]
Bug 22219: Add tests

Signed-off-by: Pierre-Marc Thibault <pierre-marc.thibault@inLibro.com>
Comment 4 Pierre-Marc Thibault 2019-03-08 20:33:53 UTC
Created attachment 86403 [details] [review]
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)

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>
Comment 5 Josef Moravec 2019-03-11 16:45:22 UTC
Created attachment 86468 [details] [review]
Bug 22219: Add tests

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

Signed-off-by: Josef Moravec <josef.moravec@gmail.com>
Comment 6 Josef Moravec 2019-03-11 16:45:26 UTC
Created attachment 86469 [details] [review]
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds)

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>
Comment 7 Nick Clemens 2019-03-15 12:48:07 UTC
Awesome work all!

Pushed to master for 19.05
Comment 8 Martin Renvoize 2019-03-19 10:41:41 UTC
Pushed to 18.11.x for 18.11.04
Comment 9 Lucas Gass 2019-03-26 23:29:04 UTC
missing dependency for 18.05.x not backporting