On bug 27272 we are going to replace C4::Items::GetItemsInfo with Koha::Items methods, but we need to keep the existing behaviour that is: Order by publisheddate, enumchron for searisl, or by homebranch.branchname, enumchron, LPAD( copynumber, 8, '0' ), desc dateaccessioned
Created attachment 138806 [details] [review] Bug 31306: Add search_ordered sub to order items with extra conditions Commit message from JD: On bug 27272 we are going to replace C4::Items::GetItemsInfo with Koha::Items methods, but we need to keep the existing behaviour that is: Order by publisheddate, enumchron for searisl, or by homebranch.branchname, enumchron, LPAD( copynumber, 8, '0' ), desc dateaccessioned Test plan: Confirm that the code from the new method makes sense Run t/db_dependent/Koha/Items.t
Created attachment 138807 [details] [review] Bug 31306: Allow to pass params and attributes to search_ordered
Created attachment 138808 [details] [review] Bug 31306: Add tests for search_ordered
Created attachment 138838 [details] [review] Bug 31306: Add search_ordered sub to order items with extra conditions Commit message from JD: On bug 27272 we are going to replace C4::Items::GetItemsInfo with Koha::Items methods, but we need to keep the existing behaviour that is: Order by publisheddate, enumchron for searisl, or by homebranch.branchname, enumchron, LPAD( copynumber, 8, '0' ), desc dateaccessioned Test plan: Confirm that the code from the new method makes sense Run t/db_dependent/Koha/Items.t Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 138839 [details] [review] Bug 31306: Allow to pass params and attributes to search_ordered Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 138840 [details] [review] Bug 31306: Add tests for search_ordered Signed-off-by: Owen Leonard <oleonard@myacpl.org>
You are deciding which way to sort based on: $self->search({ select => ["enumchron IS NOT NULL"] The original routine based it upon: $serial Which was a join between items->serialitems->serial I do not believe testing for enumchron is the same result - many libraries use the enumchron for other purposes. Probably a count of serial items would suffice?
Nick, have a look at the squashed version :) There is a (unadvertised) change that does what I think is correct in the second patch.
Created attachment 138905 [details] [review] Bug 31306: Add search_ordered sub to order items with extra conditions Commit message from JD: On bug 27272 we are going to replace C4::Items::GetItemsInfo with Koha::Items methods, but we need to keep the existing behaviour that is: Order by publisheddate, enumchron for searisl, or by homebranch.branchname, enumchron, LPAD( copynumber, 8, '0' ), desc dateaccessioned Test plan: Confirm that the code from the new method makes sense Run t/db_dependent/Koha/Items.t Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 138906 [details] [review] Bug 31306: Allow to pass params and attributes to search_ordered Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 138907 [details] [review] Bug 31306: Add tests for search_ordered Signed-off-by: Owen Leonard <oleonard@myacpl.org>
Created attachment 138908 [details] [review] Bug 31306: (QA follow-up) Add comments to test
Pushed to master for 22.11. Nice work everyone, thanks!
Enhancement will not be backported to 22.05.x series