Bug 37238

Summary: Add table settings to itemsearch results
Product: Koha Reporter: Lucas Gass <lucas>
Component: SearchingAssignee: Lucas Gass <lucas>
Status: Signed Off --- QA Contact: Testopia <testopia>
Severity: enhancement    
Priority: P5 - low CC: anni.rajala, catrina, kebliss, lisette, oleonard
Version: Main   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 37249    
Bug Blocks: 13965    
Attachments: Bug 37238: Add column configuration to item search results table
Bug 37238: Add column configuration to item search results table
Bug 37238: Replace jquery.dataTables.columnFilter.js with native DataTables function
Bug 37238: Move filters from tfoot to thead
Bug 37238: Move filters from tfoot to thead

Description Lucas Gass 2024-07-02 22:09:52 UTC
Itemsearch results has grown to be a very large table, table settings should be added.

https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=13965#c3
Comment 1 Lucas Gass 2024-07-02 22:15:27 UTC
Created attachment 168409 [details] [review]
Bug 37238: Add column configuration to item search results table

To test:
1. APPLY PATCH
2. Do an item search that will return results.
3. To the right of the table notice thee Columns, Export, Configure buttons
4. Use the Columns button to hide and show various columns, make sure it works right.
5. Use the Export button to try and export the table in various file formats. You should only see visible columns in your export.
6. Go to Admin -> Table settings, make sure you can hide columns properly from there.
Comment 2 Sam Lau 2024-07-02 22:39:08 UTC
Created attachment 168411 [details] [review]
Bug 37238: Add column configuration to item search results table

To test:
1. APPLY PATCH
2. Do an item search that will return results.
3. To the right of the table notice thee Columns, Export, Configure buttons
4. Use the Columns button to hide and show various columns, make sure it works right.
5. Use the Export button to try and export the table in various file formats. You should only see visible columns in your export.
6. Go to Admin -> Table settings, make sure you can hide columns properly from there.

Signed-off-by: Sam Lau <samalau@gmail.com>
Comment 3 Katrin Fischer 2024-07-03 07:30:34 UTC
*** Bug 23565 has been marked as a duplicate of this bug. ***
Comment 4 Owen Leonard 2024-07-03 12:14:19 UTC
I'm getting inconsistent behavior from the column header search fields. Sometimes they work, sometimes they incorrectly filter out all results, and sometimes I get a 500 error:

C4::Items::SearchItems(): DBI Exception: DBD::mysql::st execute failed: Column 'itemnumber' in where clause is ambiguous at /kohadevbox/koha/catalogue/itemsearch.pl line 252
 at /usr/share/perl5/DBIx/Class/Exception.pm line 77
	DBIx::Class::Exception::throw('DBIx::Class::Exception', 'DBI Exception: DBD::mysql::st execute failed: Column \'itemnumber\' in where clause is ambiguous', 0) called at /usr/share/perl5/DBIx/Class/Schema.pm line 1118
Comment 5 Lucas Gass 2024-07-03 14:00:34 UTC
(In reply to Owen Leonard from comment #4)
> I'm getting inconsistent behavior from the column header search fields.
> Sometimes they work, sometimes they incorrectly filter out all results, and
> sometimes I get a 500 error:

> C4::Items::SearchItems(): DBI Exception: DBD::mysql::st execute failed:
> Column 'itemnumber' in where clause is ambiguous at
> /kohadevbox/koha/catalogue/itemsearch.pl line 252
>  at /usr/share/perl5/DBIx/Class/Exception.pm line 77
> 	DBIx::Class::Exception::throw('DBIx::Class::Exception', 'DBI Exception:
> DBD::mysql::st execute failed: Column \'itemnumber\' in where clause is
> ambiguous', 0) called at /usr/share/perl5/DBIx/Class/Schema.pm line 1118

Thanks Owen. For the 500 error, I am reproducing that without my patch applied. It seems specific to the itemnumber column? 

It also seems like many of the columns, but not all, are incorrectly filtering without this patch applied.
Comment 6 Lucas Gass 2024-07-03 22:24:50 UTC
Created attachment 168483 [details] [review]
Bug 37238: Replace jquery.dataTables.columnFilter.js with native DataTables function
Comment 7 Lucas Gass 2024-07-03 22:33:27 UTC
I fixed the 500 error when using itemnumber filtering on Bug 37249.

The follow-up patch here make filtering work when columns are hidden. 

I did notice that when filtering things like Item type, Home library, currently library, damaged, lost, ect. it requires the user to know the code. The description doesn't work. This seems to be true with or without my patch.  

The same seems to true when filtering dates. You must use the ISO date or else filtering doesn't work. This is also true with or without this patchset.
Comment 8 Anni Rajala 2024-07-16 07:51:29 UTC
Noticed a couple of issues while testing and thus changed status to Failed QA:

1. On the item results page, the filters have been relocated to the bottom of the results list when they should be at the top.
2. After making changes to the table settings, the changes didn't apply until I logged in again to Koha. I think this is different from how the table settings act otherwise?
Comment 9 Lucas Gass 2024-08-27 20:51:15 UTC
Created attachment 170785 [details] [review]
Bug 37238: Move filters from tfoot to thead
Comment 10 Lucas Gass 2024-08-27 20:52:25 UTC
(In reply to Anni Rajala from comment #8)
> Noticed a couple of issues while testing and thus changed status to Failed
> QA:
> 
> 1. On the item results page, the filters have been relocated to the bottom
> of the results list when they should be at the top.
> 2. After making changes to the table settings, the changes didn't apply
> until I logged in again to Koha. I think this is different from how the
> table settings act otherwise?

Anni, thanks for testing. I did move the filters from the footer into the header. 

However I cannot recreate your 2nd problem. For me the column configuration/Table settings are working.
Comment 11 Eric Garcia 2024-09-04 16:40:41 UTC
Created attachment 171037 [details] [review]
Bug 37238: Move filters from tfoot to thead

Signed-off-by: Eric Garcia <cubingguy714@gmail.com>
Comment 12 Anni Rajala 2024-09-13 11:44:29 UTC
(In reply to Lucas Gass from comment #10)
> (In reply to Anni Rajala from comment #8)
> > Noticed a couple of issues while testing and thus changed status to Failed
> > QA:
> > 
> > 1. On the item results page, the filters have been relocated to the bottom
> > of the results list when they should be at the top.
> > 2. After making changes to the table settings, the changes didn't apply
> > until I logged in again to Koha. I think this is different from how the
> > table settings act otherwise?
> 
> Anni, thanks for testing. I did move the filters from the footer into the
> header. 
> 
> However I cannot recreate your 2nd problem. For me the column
> configuration/Table settings are working.

I was going to try if I could recreate the 2nd problem, but after applying the batch, I keep getting error ("Unsupported format html at /kohadevbox/koha/catalogue/itemsearch.pl line 100) when trying to search something in item search.