If you add a hold on a book (next available), and then checkout an item of this book to the same patron, the hold is filled but without itemnumber. Since we normally expect an itemnumber in old_reserves, this may be confusing. For instance, reserve_stats.pl ignores these holds because it filters on itemnumber. Is this simply a bug or are there circumstances that this behavior is preferred? In other words, should we fix reserve_stats.pl and other code that assumes the itemnumber or should we fix MoveReserve/$hold->fill ?
Interestingly, CheckReserves puts the given itemnumber (from the checkout) into its highest reserve of the result: $highest->{'itemnumber'} = $item->itemnumber; But MoveReserves does ignore it in the $res (==$highest) hash: if ($res->{borrowernumber} == $borrowernumber) { my $hold = Koha::Holds->find( $res->{reserve_id} ); $hold->fill; So it may have worked, and was perhaps undone by refactoring?
Created attachment 151507 [details] [review] Bug 33791: Pass itemnumber to $hold->fill Test plan: Without this patch: Place next available level on some book for patron A. Checkout this book directly to patron A. Check old_reserves table for this reserve; does not have itemnumber. With this patch: Do the same. In old_reserves the itemnumber should be saved. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 151508 [details] [review] Bug 33791: Add unit test Test plan: Run t/db_dependent/Koha/Hold.t NOTE: This test should fail without following patch, but pass with it. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 151509 [details] [review] Bug 33791: Pass itemnumber to $hold->fill Test plan: Without this patch: Place next available level on some book for patron A. Checkout this book directly to patron A. Check old_reserves table for this reserve; does not have itemnumber. With this patch: Do the same. In old_reserves the itemnumber should be saved. Run again t/db_dependent/Koha/Hold.t. Should pass. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl>
Created attachment 151524 [details] [review] Bug 33791: Add unit test Test plan: Run t/db_dependent/Koha/Hold.t NOTE: This test should fail without following patch, but pass with it. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 151525 [details] [review] Bug 33791: Pass itemnumber to $hold->fill Test plan: Without this patch: Place next available level on some book for patron A. Checkout this book directly to patron A. Check old_reserves table for this reserve; does not have itemnumber. With this patch: Do the same. In old_reserves the itemnumber should be saved. Run again t/db_dependent/Koha/Hold.t. Should pass. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Created attachment 151526 [details] [review] Bug 33791: Add unit test Test plan: Run t/db_dependent/Koha/Hold.t NOTE: This test should fail without following patch, but pass with it. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Created attachment 151527 [details] [review] Bug 33791: Pass itemnumber to $hold->fill Test plan: Without this patch: Place next available level on some book for patron A. Checkout this book directly to patron A. Check old_reserves table for this reserve; does not have itemnumber. With this patch: Do the same. In old_reserves the itemnumber should be saved. Run again t/db_dependent/Koha/Hold.t. Should pass. Signed-off-by: Marcel de Rooy <m.de.rooy@rijksmuseum.nl> Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com>
Looks like Kyle and I both PQA'd on this one simultaneously.. lol.. it's certainly PQA anyways.
Created attachment 151539 [details] [review] Bug 33791: (QA follow-up) Stick to 'item_id' for the parameter name
Pushed to master for 23.05. Nice work everyone, thanks!
Nice work everyone! Pushed to stable for 22.11.x