Bug 26032 - Add 'is new' filter in items search
Summary: Add 'is new' filter in items search
Status: CLOSED FIXED
Alias: None
Product: Koha
Classification: Unclassified
Component: Searching (show other bugs)
Version: Main
Hardware: All All
: P5 - low enhancement
Assignee: Fridolin Somers
QA Contact:
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-07-21 09:42 UTC by Fridolin Somers
Modified: 2021-06-14 21:33 UTC (History)
2 users (show)

See Also:
Change sponsored?: ---
Patch complexity: Small patch
Documentation contact:
Documentation submission:
Text to go in the release notes:
There is a new filter in item search, when the database column 'items.new_status' is used. It allows searching items defined as new or not new, like the filter on damaged or not damaged.
Version(s) released in:
20.11.00
Circulation function:


Attachments
Bug 26032: Add unit test (1.41 KB, patch)
2020-07-21 10:32 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (3.78 KB, patch)
2020-07-21 10:33 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: Add unit test (1.73 KB, patch)
2020-10-13 12:55 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (3.78 KB, patch)
2020-10-13 12:56 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() (715 bytes, patch)
2020-10-16 08:46 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: Add unit test (1.79 KB, patch)
2020-10-19 11:11 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (3.85 KB, patch)
2020-10-19 11:11 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() (778 bytes, patch)
2020-10-19 11:12 UTC, Emmi Takkinen
Details | Diff | Splinter Review
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used (2.29 KB, patch)
2020-10-26 09:51 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used (2.20 KB, patch)
2020-10-26 09:52 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used (2.84 KB, patch)
2020-10-26 10:08 UTC, Fridolin Somers
Details | Diff | Splinter Review
Bug 26032: Add unit test (1.92 KB, patch)
2020-10-30 14:07 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (3.99 KB, patch)
2020-10-30 14:07 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() (914 bytes, patch)
2020-10-30 14:07 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used (2.98 KB, patch)
2020-10-30 14:07 UTC, Séverine Queune
Details | Diff | Splinter Review
Bug 26032: Add unit test (1.93 KB, patch)
2020-11-01 13:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (4.01 KB, patch)
2020-11-01 13:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() (921 bytes, patch)
2020-11-01 13:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26032: (follow-up) show 'is new' filter only if items.new_status is used (2.99 KB, patch)
2020-11-01 13:55 UTC, Katrin Fischer
Details | Diff | Splinter Review
Bug 26032: Add unit test (1.98 KB, patch)
2020-11-03 13:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 26032: Add 'is new' filter in items search (4.05 KB, patch)
2020-11-03 13:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() (978 bytes, patch)
2020-11-03 13:23 UTC, Jonathan Druart
Details | Diff | Splinter Review
Bug 26032: (follow-up) show 'is new' filter only if items.new_status is used (3.04 KB, patch)
2020-11-03 13:23 UTC, Jonathan Druart
Details | Diff | Splinter Review

Note You need to log in before you can comment on or make changes to this bug.
Description Fridolin Somers 2020-07-21 09:42:51 UTC
In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.
Comment 1 Fridolin Somers 2020-07-21 10:32:50 UTC
Created attachment 107141 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t
Comment 2 Fridolin Somers 2020-07-21 10:33:51 UTC
Created attachment 107142 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A
Comment 3 Emmi Takkinen 2020-10-07 08:00:46 UTC
Followed test plan and filtering works as expected. However tests fail since they seem to take whole db in account not just test items. Should there be more filters (e.g by homebranch like in test above)?
Comment 4 Fridolin Somers 2020-10-13 12:55:26 UTC
Created attachment 111554 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t
Comment 5 Fridolin Somers 2020-10-13 12:56:09 UTC
Created attachment 111555 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A
Comment 6 Fridolin Somers 2020-10-13 12:57:02 UTC
(In reply to Emmi Takkinen from comment #3)
> Followed test plan and filtering works as expected. However tests fail since
> they seem to take whole db in account not just test items. Should there be
> more filters (e.g by homebranch like in test above)?

You are right, Unit Test is now much better.
Comment 7 Fridolin Somers 2020-10-16 08:46:47 UTC
Created attachment 111834 [details] [review]
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()
Comment 8 Emmi Takkinen 2020-10-19 11:11:01 UTC
Created attachment 111961 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Comment 9 Emmi Takkinen 2020-10-19 11:11:48 UTC
Created attachment 111962 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Comment 10 Emmi Takkinen 2020-10-19 11:12:43 UTC
Created attachment 111963 [details] [review]
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Comment 11 Emmi Takkinen 2020-10-19 11:13:46 UTC
Works as expected and tests pass.
Comment 12 Katrin Fischer 2020-10-22 20:18:23 UTC
Hi Fridolin,

there is no mapping in MARC21 for the "new_status", so it cannot be edited via the item editor. It also seems that this is not set to any value by default. I am really not sure how this is used normally, it doesn't seem to be well integrated in "default" Koha right now. Can you explain?

I'd also love if the div had an id so it would e possible to hide the option for libraries not using this.
Comment 13 Katrin Fischer 2020-10-22 20:27:17 UTC
My problem is that the "is new" is not really a feature at the moment that is really advertised anywhere in standard Koha - I believe having a field to limit on with no idea where to set it will be confusing :(
Comment 14 Fridolin Somers 2020-10-23 10:01:26 UTC
Good points.

I propose to show this filter only if items.new_status has a mapping.

+ div with an id
Comment 15 Katrin Fischer 2020-10-23 10:11:12 UTC
Hi Frido, that sounds sensible, thx!
Comment 16 Fridolin Somers 2020-10-26 09:51:31 UTC
Created attachment 112500 [details] [review]
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2Â) Check you dont see the 'is new' filter in items search form
Comment 17 Fridolin Somers 2020-10-26 09:52:06 UTC
Created attachment 112501 [details] [review]
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2) Check you dont see the 'is new' filter in items search form
Comment 18 Fridolin Somers 2020-10-26 10:08:35 UTC
Created attachment 112502 [details] [review]
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used

Also adds a class 'item-new-status' to this filter to be able to hidde
even if items.new_status used.

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2) Check you dont see the 'is new' filter in items search form
3) Apply on a database with Koha to MARC mapping on items.new_status
4) Check you see class 'form-field item-new-status'
Comment 19 Séverine Queune 2020-10-30 14:07:04 UTC
Created attachment 112707 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 20 Séverine Queune 2020-10-30 14:07:08 UTC
Created attachment 112708 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 21 Séverine Queune 2020-10-30 14:07:11 UTC
Created attachment 112709 [details] [review]
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 22 Séverine Queune 2020-10-30 14:07:14 UTC
Created attachment 112710 [details] [review]
Bug 26032: (follow-up 2) show 'is new' filter only if items.new_status is used

Also adds a class 'item-new-status' to this filter to be able to hidde
even if items.new_status used.

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2) Check you dont see the 'is new' filter in items search form
3) Apply on a database with Koha to MARC mapping on items.new_status
4) Check you see class 'form-field item-new-status'

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 23 Katrin Fischer 2020-11-01 13:55:18 UTC
Created attachment 112809 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 24 Katrin Fischer 2020-11-01 13:55:21 UTC
Created attachment 112810 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 25 Katrin Fischer 2020-11-01 13:55:25 UTC
Created attachment 112811 [details] [review]
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 26 Katrin Fischer 2020-11-01 13:55:29 UTC
Created attachment 112812 [details] [review]
Bug 26032: (follow-up) show 'is new' filter only if items.new_status is used

Also adds a class 'item-new-status' to this filter to be able to hidde
even if items.new_status used.

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2) Check you dont see the 'is new' filter in items search form
3) Apply on a database with Koha to MARC mapping on items.new_status
4) Check you see class 'form-field item-new-status'

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Comment 27 Jonathan Druart 2020-11-03 13:23:16 UTC
Created attachment 112915 [details] [review]
Bug 26032: Add unit test

Run prove t/db_dependent/Items.t

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 28 Jonathan Druart 2020-11-03 13:23:19 UTC
Created attachment 112916 [details] [review]
Bug 26032: Add 'is new' filter in items search

In items search, add a filter on value of items.new_status with a Ignore/Yes/No.
Yes meaning != 0, No meaning = 0, with considering that NULL value is like 0.

This patch adds 'isnull' option to filter, this may be reused on other
fields.

Test plan :
1) Define an item subfield on items.new_status with authorised values YES_NO (0 or 1)
2) Edit an item A to set new_status=1
3) Edit an item B to set new_status=0
4) Perform an item search with 'is new' = 'ignore' => you get all items
5) Perform an item search with 'is new' = 'yes' => you get item A
6) Perform an item search with 'is new' = 'no' => you get all items but A

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 29 Jonathan Druart 2020-11-03 13:23:22 UTC
Created attachment 112917 [details] [review]
Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()

Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 30 Jonathan Druart 2020-11-03 13:23:25 UTC
Created attachment 112918 [details] [review]
Bug 26032: (follow-up) show 'is new' filter only if items.new_status is used

Also adds a class 'item-new-status' to this filter to be able to hidde
even if items.new_status used.

Addition to test plan:
1) Apply on a database without Koha to MARC mapping on items.new_status
2) Check you dont see the 'is new' filter in items search form
3) Apply on a database with Koha to MARC mapping on items.new_status
4) Check you see class 'form-field item-new-status'

Signed-off-by: Séverine QUEUNE <severine.queune@bulac.fr>
Signed-off-by: Katrin Fischer <katrin.fischer.83@web.de>
Comment 31 Jonathan Druart 2020-11-03 13:23:42 UTC
Added missing signed-off-by lines.
Comment 32 Jonathan Druart 2020-11-04 12:03:32 UTC
Pushed to master for 20.11, thanks to everybody involved!