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.
Created attachment 107141 [details] [review] Bug 26032: Add unit test Run prove t/db_dependent/Items.t
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
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)?
Created attachment 111554 [details] [review] Bug 26032: Add unit test Run prove t/db_dependent/Items.t
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
(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.
Created attachment 111834 [details] [review] Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE()
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>
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>
Created attachment 111963 [details] [review] Bug 26032: (follow-up) Replace IFNULL() mysqlism with COALESCE() Signed-off-by: Emmi Takkinen <emmi.takkinen@outlook.com>
Works as expected and tests pass.
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.
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 :(
Good points. I propose to show this filter only if items.new_status has a mapping. + div with an id
Hi Frido, that sounds sensible, thx!
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
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
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'
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
Added missing signed-off-by lines.
Pushed to master for 20.11, thanks to everybody involved!