After searching an item, i. e. with barcode, you can't see wheter it is checked out or not. Therefore the due date and / or the availability of the item would be very helpful.
*** Bug 19509 has been marked as a duplicate of this bug. ***
+1
Created attachment 116353 [details] [review] Bug 17748: [WIP] Not ready for testing
*** Bug 27918 has been marked as a duplicate of this bug. ***
Created attachment 119341 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out, available on the shelf, or not available for checkout for some other reason). If checked out, also shows due date in item search results. Both the new availability and due date columns will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up three items. Check out Item A to a borrower. Set Item B to some damaged, notforloan, withdrawn etc status so that it is considered not available. Leave Item C as is, not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, Checked out, and Available. 4) Leave the Ignore option selected and do a search so that all three items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says Not available. Confirm Item C says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Items B and C). 8) Go to edit your search. Select the 'Available' radio option for Availability and submit the search. Confirm only Item B shows in the results (not Items A and C). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
This works well except for sorting: Sorting the results by Availability or by Date due doesn't work. The order changes, but not to the correct order.
(In reply to Owen Leonard from comment #6) > This works well except for sorting: Sorting the results by Availability or > by Date due doesn't work. The order changes, but not to the correct order. I have no idea why this is happening or how to fix it. Any datatables experts know why the filtering and sorting doesn't work for these two columns?
(In reply to Aleisha Amohia from comment #7) > (In reply to Owen Leonard from comment #6) > > This works well except for sorting: Sorting the results by Availability or > > by Date due doesn't work. The order changes, but not to the correct order. > > I have no idea why this is happening or how to fix it. Any datatables > experts know why the filtering and sorting doesn't work for these two > columns? You are not doing anything to sort correctly on those 2 columns. It's an AJAX-based table, the results are not sorted in JS client-side only. You certainly need to modify C4::Items::SearchItems to correctly deal with those 2 columns in the order by clause.
Created attachment 128332 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out, available on the shelf, or not available for checkout for some other reason). If checked out, also shows due date in item search results. Both the new availability and due date columns will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up three items. Check out Item A to a borrower. Set Item B to some damaged, notforloan, withdrawn etc status so that it is considered not available. Leave Item C as is, not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, Checked out, and Available. 4) Leave the Ignore option selected and do a search so that all three items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says Not available. Confirm Item C says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Items B and C). 8) Go to edit your search. Select the 'Available' radio option for Availability and submit the search. Confirm only Item B shows in the results (not Items A and C). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Created attachment 128333 [details] [review] Bug 17748: (follow-up) Fix sorting on new columns Confirm tests in t/db_dependent/Items.t still pass.
I was testing, and unfortunately on step 8 the unavailable item (i set the damaged status) also shows up togeter with the available items in the results, with the radio button set to 'available'.
Created attachment 128582 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out or not). If checked out, shows due date in item search results. The due date column will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up two items. Check out Item A to a borrower. Leave Item B as is not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, and Checked out. 4) Leave the Ignore option selected and do a search so that both items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Item B). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ)
Created attachment 128583 [details] [review] Bug 17748: (follow-up) Fix sorting on new columns Confirm tests in t/db_dependent/Items.t still pass.
Created attachment 128584 [details] [review] Bug 17748: (follow-up) Remove availability column Items can now only be filtered by 'Checked out' or 'not' rather than looking at damaged/itemlost/withdrawn/notforloan status. Removed availability column as Checked out items are made clear by the due date column.
Created attachment 128591 [details] Screenshot showing problems I'm seeing a couple of issues with the results, as shown in this screenshot: Is there supposed to be both an "Availability" and "Due date" column? I think this misalignment is why the column search field under "Availability" doesn't work.
Created attachment 128638 [details] [review] Bug 17748: (follow-up) Remove availability column Items can now only be filtered by 'Checked out' or 'not' rather than looking at damaged/itemlost/withdrawn/notforloan status. Removed availability column as Checked out items are made clear by the due date column.
(In reply to Owen Leonard from comment #15) > Created attachment 128591 [details] > Screenshot showing problems > > I'm seeing a couple of issues with the results, as shown in this screenshot: > > Is there supposed to be both an "Availability" and "Due date" column? I > think this misalignment is why the column search field under "Availability" > doesn't work. Woops I had missed one more instance of removing the Availability column. Should be good to test now.
Created attachment 128645 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out or not). If checked out, shows due date in item search results. The due date column will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up two items. Check out Item A to a borrower. Leave Item B as is not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, and Checked out. 4) Leave the Ignore option selected and do a search so that both items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Item B). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: Christian <christian.stelzenmueller@bsz-bw.de>
Created attachment 128646 [details] [review] Bug 17748: (follow-up) Fix sorting on new columns Confirm tests in t/db_dependent/Items.t still pass. Signed-off-by: Christian <christian.stelzenmueller@bsz-bw.de>
Created attachment 128647 [details] [review] Bug 17748: (follow-up) Remove availability column Items can now only be filtered by 'Checked out' or 'not' rather than looking at damaged/itemlost/withdrawn/notforloan status. Removed availability column as Checked out items are made clear by the due date column. Signed-off-by: Christian <christian.stelzenmueller@bsz-bw.de>
Looks like this was signed off so will adjust status
Created attachment 129623 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out or not). If checked out, shows due date in item search results. The due date column will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up two items. Check out Item A to a borrower. Leave Item B as is not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, and Checked out. 4) Leave the Ignore option selected and do a search so that both items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Item B). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Created attachment 129624 [details] [review] Bug 17748: (follow-up) Fix sorting on new columns Confirm tests in t/db_dependent/Items.t still pass. Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Created attachment 129625 [details] [review] Bug 17748: (follow-up) Remove availability column Items can now only be filtered by 'Checked out' or 'not' rather than looking at damaged/itemlost/withdrawn/notforloan status. Removed availability column as Checked out items are made clear by the due date column. Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de>
Added Christian's surname to the sign-off lines, patches still apply cleanly against master. Thx Aleisha for noticing the missed status change!
Tests are missing.
Created attachment 130154 [details] [review] Bug 17748: Add tests
Created attachment 130845 [details] [review] Bug 17748: Show due date and availability in item search results This enhancement adds the availability of an item to the item search results (i.e. shows if checked out or not). If checked out, shows due date in item search results. The due date column will also show when exporting results to a CSV file. To test: 1) Apply patch and restart services 2) Set up two items. Check out Item A to a borrower. Leave Item B as is not checked out, and not unavailable status. 3) Go to Search -> Item search. Scroll down and notice the Availability radio options - Ignore, and Checked out. 4) Leave the Ignore option selected and do a search so that both items show. 5) Confirm the availability and due date columns are showing at the right end of the table. Confirm Item A says Checked out and has a due date. Confirm Item B says available. 6) Export all result to CSV. Confirm the results show in the CSV file as expected. 7) Go to edit your search. Select the 'Checked out' radio option for Availability and submit the search. Confirm only Item A shows in the results (not Item B). Sponsored-by: Bibliotheksservice-Zentrum Baden-Württemberg (BSZ) Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 130846 [details] [review] Bug 17748: (follow-up) Fix sorting on new columns Confirm tests in t/db_dependent/Items.t still pass. Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 130847 [details] [review] Bug 17748: (follow-up) Remove availability column Items can now only be filtered by 'Checked out' or 'not' rather than looking at damaged/itemlost/withdrawn/notforloan status. Removed availability column as Checked out items are made clear by the due date column. Signed-off-by: Christian Stelzenmüller <christian.stelzenmueller@bsz-bw.de> Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 130848 [details] [review] Bug 17748: Add tests Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 130849 [details] [review] Bug 17748: Remove unecessary html filter Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Created attachment 131051 [details] [review] Bug 17748: (follow-up) Fix date due column filter After items search result when entering a term in date due colum filter table is not filtered. Its is because columns from 'Issue' must be added in _SearchItems_build_where_fragment() like it has been added in SearchItems(). Test plan : 1) Perform an item search with some results beeing checked-out 2) In colum 'Date due' enter a number that is contained is some due dates, ie '2022' 3) Table results are filtered with items having search term in due date
I've added a small fix for column filter. I'd like for QA to validate it. In my opinion, "Availability" should be placed under "Last checkout date".
Created attachment 132016 [details] [review] Bug 17748: (follow-up) Fix date due column filter After items search result when entering a term in date due colum filter table is not filtered. Its is because columns from 'Issue' must be added in _SearchItems_build_where_fragment() like it has been added in SearchItems(). Test plan : 1) Perform an item search with some results beeing checked-out 2) In colum 'Date due' enter a number that is contained is some due dates, ie '2022' 3) Table results are filtered with items having search term in due date Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Looks perfect. Great thanks to sponsor and contributors ;)
Created attachment 132201 [details] [review] Bug 17748: (follow-up) Stronger unit tests Before this patch, unit tests perform an item search assuming there is no checked-out items in database. This is correct for a fresh reseted database. But if you checkout any item then prove t/db_dependent/Items.t it will fail. We can see in this file that other tests use filter on generated branchcode. This patch adds filter to items.homebranch
I made some checkouts before running unit tests and they failed. I added a follow-up to fix that.
Pushed to master for 22.05, thanks to everybody involved [U+1F984]