Bug 17748 - Show due date in item search results
Summary: Show due date in item search results
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Staff interface (show other bugs)
Version: master
Hardware: All All
: P5 - low enhancement with 10 votes (vote)
Assignee: Aleisha Amohia
QA Contact: Testopia
URL:
Keywords:
: 19509 27918 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-12-08 13:00 UTC by Christian Stelzenmüller
Modified: 2022-12-12 21:24 UTC (History)
9 users (show)

See Also:
Change sponsored?: Sponsored
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
This enhancement adds the due date of an item to the item search results. The due date column will also show when exporting results to a CSV file.
Version(s) released in:
22.05.00


Attachments
Bug 17748: [WIP] Not ready for testing (7.04 KB, patch)
2021-02-05 03:02 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (11.33 KB, patch)
2021-04-09 00:44 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (11.32 KB, patch)
2021-12-07 20:32 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix sorting on new columns (3.46 KB, patch)
2021-12-07 20:33 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (10.90 KB, patch)
2021-12-16 02:18 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix sorting on new columns (3.46 KB, patch)
2021-12-16 02:18 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: (follow-up) Remove availability column (5.50 KB, patch)
2021-12-16 02:19 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Screenshot showing problems (37.76 KB, image/png)
2021-12-16 11:22 UTC, Owen Leonard
Details
Bug 17748: (follow-up) Remove availability column (6.00 KB, patch)
2021-12-16 20:30 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (10.91 KB, patch)
2021-12-17 08:57 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix sorting on new columns (3.51 KB, patch)
2021-12-17 08:57 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 17748: (follow-up) Remove availability column (6.02 KB, patch)
2021-12-17 08:57 UTC, PTFS Europe Sandboxes
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (10.97 KB, patch)
2022-01-19 17:30 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix sorting on new columns (3.63 KB, patch)
2022-01-19 17:31 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 17748: (follow-up) Remove availability column (6.16 KB, patch)
2022-01-19 17:31 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 17748: Add tests (3.07 KB, patch)
2022-02-03 22:28 UTC, Aleisha Amohia
Details | Diff | Splinter Review
Bug 17748: Show due date and availability in item search results (11.01 KB, patch)
2022-02-18 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix sorting on new columns (3.69 KB, patch)
2022-02-18 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: (follow-up) Remove availability column (6.20 KB, patch)
2022-02-18 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: Add tests (3.14 KB, patch)
2022-02-18 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: Remove unecessary html filter (1.88 KB, patch)
2022-02-18 14:15 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix date due column filter (1.44 KB, patch)
2022-02-24 02:36 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 17748: (follow-up) Fix date due column filter (1.51 KB, patch)
2022-03-22 12:35 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 17748: (follow-up) Stronger unit tests (2.03 KB, patch)
2022-03-25 00:19 UTC, Fridolin Somers
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Stelzenmüller 2016-12-08 13:00:06 UTC
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.
Comment 1 Katrin Fischer 2018-07-15 17:51:30 UTC
*** Bug 19509 has been marked as a duplicate of this bug. ***
Comment 2 Katrin Fischer 2019-01-02 16:51:01 UTC
+1
Comment 3 Aleisha Amohia 2021-02-05 03:02:30 UTC
Created attachment 116353 [details] [review]
Bug 17748: [WIP] Not ready for testing
Comment 4 Katrin Fischer 2021-03-10 20:42:59 UTC
*** Bug 27918 has been marked as a duplicate of this bug. ***
Comment 5 Aleisha Amohia 2021-04-09 00:44:08 UTC
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)
Comment 6 Owen Leonard 2021-04-09 15:15:20 UTC
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.
Comment 7 Aleisha Amohia 2021-05-05 04:04:00 UTC
(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?
Comment 8 Jonathan Druart 2021-05-06 07:15:17 UTC
(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.
Comment 9 Aleisha Amohia 2021-12-07 20:32:57 UTC
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)
Comment 10 Aleisha Amohia 2021-12-07 20:33:02 UTC
Created attachment 128333 [details] [review]
Bug 17748: (follow-up) Fix sorting on new columns

Confirm tests in t/db_dependent/Items.t still pass.
Comment 11 Christian Stelzenmüller 2021-12-13 09:29:29 UTC
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'.
Comment 12 Aleisha Amohia 2021-12-16 02:18:54 UTC
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)
Comment 13 Aleisha Amohia 2021-12-16 02:18:58 UTC
Created attachment 128583 [details] [review]
Bug 17748: (follow-up) Fix sorting on new columns

Confirm tests in t/db_dependent/Items.t still pass.
Comment 14 Aleisha Amohia 2021-12-16 02:19:03 UTC
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.
Comment 15 Owen Leonard 2021-12-16 11:22:38 UTC
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.
Comment 16 Aleisha Amohia 2021-12-16 20:30:33 UTC
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.
Comment 17 Aleisha Amohia 2021-12-16 20:31:01 UTC
(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.
Comment 18 PTFS Europe Sandboxes 2021-12-17 08:57:49 UTC
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>
Comment 19 PTFS Europe Sandboxes 2021-12-17 08:57:53 UTC
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>
Comment 20 PTFS Europe Sandboxes 2021-12-17 08:57:57 UTC
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>
Comment 21 Aleisha Amohia 2022-01-16 20:11:05 UTC
Looks like this was signed off so will adjust status
Comment 22 Katrin Fischer 2022-01-19 17:30:59 UTC
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>
Comment 23 Katrin Fischer 2022-01-19 17:31:03 UTC
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>
Comment 24 Katrin Fischer 2022-01-19 17:31:07 UTC
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>
Comment 25 Katrin Fischer 2022-01-19 17:32:05 UTC
Added Christian's surname to the sign-off lines, patches still apply cleanly against master. 

Thx Aleisha for noticing the missed status change!
Comment 26 Jonathan Druart 2022-02-01 14:45:24 UTC
Tests are missing.
Comment 27 Aleisha Amohia 2022-02-03 22:28:40 UTC
Created attachment 130154 [details] [review]
Bug 17748: Add tests
Comment 28 Jonathan Druart 2022-02-18 14:15:02 UTC
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>
Comment 29 Jonathan Druart 2022-02-18 14:15:08 UTC
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>
Comment 30 Jonathan Druart 2022-02-18 14:15:12 UTC
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>
Comment 31 Jonathan Druart 2022-02-18 14:15:17 UTC
Created attachment 130848 [details] [review]
Bug 17748: Add tests

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 32 Jonathan Druart 2022-02-18 14:15:22 UTC
Created attachment 130849 [details] [review]
Bug 17748: Remove unecessary html filter

Signed-off-by: Jonathan Druart <jonathan.druart@bugs.koha-community.org>
Comment 33 Fridolin Somers 2022-02-24 02:36:17 UTC
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
Comment 34 Fridolin Somers 2022-02-24 02:41:57 UTC
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".
Comment 35 Jonathan Druart 2022-03-22 12:35:29 UTC
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>
Comment 36 Fridolin Somers 2022-03-25 00:12:10 UTC
Looks perfect. Great thanks to sponsor and contributors ;)
Comment 37 Fridolin Somers 2022-03-25 00:19:11 UTC
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
Comment 38 Fridolin Somers 2022-03-25 00:19:58 UTC
I made some checkouts before running unit tests and they failed.
I added a follow-up to fix that.
Comment 39 Fridolin Somers 2022-03-25 00:24:53 UTC
Pushed to master for 22.05, thanks to everybody involved 🦄