When running holds to pull it can show the wrong item for an item level hold. This is because we simply get the first barcode from the list of items that can fill the hold. The issue seems to come from 'get_items_that_can_fill' in Koha::Holds This does not take into account that an item level hold can only be filled by one item To recreate: 1 - Find a record with many items available 2 - Place an item level hold for an item on the record, not the one with lowest itemnumber 3 - Run 'Hold to pull' report 4 - Note the barcode does not match
Created attachment 128987 [details] [review] Bug 29786: Unit tests I add a new test for the case of an item level hold, and additionally adjust later tests to use a title level hold. I also fix a typo where the comment says item 1 when it means item 2
Created attachment 128988 [details] [review] Bug 29786: Select only specific items for item level holds This patch adjusts get_items_that_can_fill to make two requests: first the list of items for item-level holds second the list of biblionumbers for title-level holds This stops the report from pulling more items for item-level hold This patch also removes the aliases used in the code - while readability is a bit harder, it allows for using 'me' in get_items_that_can_fill Otherwise, this routine would need a parameter to know what we called the table. To test: 1 - Find a record with many items available 2 - Place an item level hold for an item on the record, not the one with lowest itemnumber 3 - Run 'Hold to pull' report 4 - Note the barcode does not match 5 - Apply patch 6 - Reload report 7 - It matches!
Created attachment 128989 [details] [review] Bug 29786: Unit tests I add a new test for the case of an item level hold, and additionally adjust later tests to use a title level hold. I also fix a typo where the comment says item 1 when it means item 2 Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
Created attachment 128990 [details] [review] Bug 29786: Select only specific items for item level holds This patch adjusts get_items_that_can_fill to make two requests: first the list of items for item-level holds second the list of biblionumbers for title-level holds This stops the report from pulling more items for item-level hold This patch also removes the aliases used in the code - while readability is a bit harder, it allows for using 'me' in get_items_that_can_fill Otherwise, this routine would need a parameter to know what we called the table. To test: 1 - Find a record with many items available 2 - Place an item level hold for an item on the record, not the one with lowest itemnumber 3 - Run 'Hold to pull' report 4 - Note the barcode does not match 5 - Apply patch 6 - Reload report 7 - It matches! Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com>
*** Bug 29161 has been marked as a duplicate of this bug. ***
Created attachment 129139 [details] [review] Bug 29786: Unit tests I add a new test for the case of an item level hold, and additionally adjust later tests to use a title level hold. I also fix a typo where the comment says item 1 when it means item 2 Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 129140 [details] [review] Bug 29786: Select only specific items for item level holds This patch adjusts get_items_that_can_fill to make two requests: first the list of items for item-level holds second the list of biblionumbers for title-level holds This stops the report from pulling more items for item-level hold This patch also removes the aliases used in the code - while readability is a bit harder, it allows for using 'me' in get_items_that_can_fill Otherwise, this routine would need a parameter to know what we called the table. To test: 1 - Find a record with many items available 2 - Place an item level hold for an item on the record, not the one with lowest itemnumber 3 - Run 'Hold to pull' report 4 - Note the barcode does not match 5 - Apply patch 6 - Reload report 7 - It matches! Signed-off-by: Andrew Fuerste-Henry <andrew@bywatersolutions.com> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
What a big dirty bug ^^ A short release note would be great
Pushed to master for 22.05, thanks to everybody involved [U+1F984]
Pushed to 21.11.x for 21.11.03
Pushed to 21.05.x for 21.05.11 I also backported 3142, which is seemed like this might require.
Missing dependencies for 20.11.x, it shouldn't be affected, no backport.