Bug 22219 - C4::Biblio->GetItemsForInventory can return wrong count / duplicated items when skipping waiting holds
Summary: C4::Biblio->GetItemsForInventory can return wrong count / duplicated items wh...
Status: RESOLVED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Architecture, internals, and plumbing (show other bugs)
Version: master
Hardware: All All
: P5 - low normal (vote)
Assignee: Jonathan Druart
QA Contact: Josef Moravec
URL:
Keywords:
Depends on: 21413
Blocks:
  Show dependency treegraph
 
Reported: 2019-01-28 19:27 UTC by Nick Clemens
Modified: 2019-04-30 12:29 UTC (History)
7 users (show)

See Also:
Change sponsored?: ---
Patch complexity: ---
Who signed the patch off:
Text to go in the release notes:
Version(s) released in:


Attachments
Bug 22219: Add tests (2.87 KB, patch)
2019-03-04 19:59 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds) (1.50 KB, patch)
2019-03-04 20:00 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 22219: Add tests (2.94 KB, patch)
2019-03-08 20:33 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds) (1.56 KB, patch)
2019-03-08 20:33 UTC, Pierre-Marc Thibault
Details | Diff | Splinter Review
Bug 22219: Add tests (3.00 KB, patch)
2019-03-11 16:45 UTC, Josef Moravec
Details | Diff | Splinter Review
Bug 22219: Remove duplicated items in inventory (when skipping waiting holds) (1.62 KB, patch)
2019-03-11 16:45 UTC, Josef Moravec
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
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