Bug 30221

Summary: Make the tables on opac-user.tt column configurable
Product: Koha Reporter: Lucas Gass (lukeg) <lucas>
Component: OPACAssignee: Arthur Suzuki <arthur.suzuki>
Status: Failed QA --- QA Contact: Jonathan Druart <jonathan.druart>
Severity: enhancement    
Priority: P5 - low CC: arthur.suzuki, fridolin.somers, jonathan.druart, lisette
Version: Main   
Hardware: All   
OS: All   
URL: https://gitlab.com/arthur.suzuki/Koha/-/commits/bug30221
See Also: https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=16759
https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=24364
GIT URL: Initiative type: ---
Sponsorship status: Sponsored Comma delimited list of Sponsors:
Crowdfunding goal: 0 Crowdfunding committed: 0
Crowdfunding contact: Patch complexity: Small patch
Documentation contact: Documentation submission:
Text to go in the release notes:
Version(s) released in:
Circulation function:
Bug Depends on: 26553    
Bug Blocks: 38103    
Attachments: Bug 30221: make the tables on opac-user.tt configurable
Bug 30221: make the tables on opac-user.tt configurable
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl
Bug 30221: made opac-readingrecord.pl table configurable
Bug 30221: clean unused code in opac-user.tt
Bug 30221: fix Javascript error
Bug 30221: (QA follow-up) perl-tidyness
Bug 30221: (QA follow-up) remove columns settings for OPAC users
Bug 30221: make the tables on opac-user.tt configurable
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl
Bug 30221: made opac-readingrecord.pl table configurable
Bug 30221: clean unused code in opac-user.tt
Bug 30221: fix Javascript error
Bug 30221: (QA follow-up) perl-tidyness
Bug 30221: (QA follow-up) remove columns settings for OPAC users
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled
Bug 30221: (QA follow-up) add checkout branch information to other tables
Bug 30221: (QA follow-up) make holdshistory table configurable
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled
Bug 30221: (QA follow-up) add checkout branch information to other tables
Bug 30221: (QA follow-up) make holdshistory table configurable
Bug 30221: make the tables on opac-user.tt configurable
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl
Bug 30221: made opac-readingrecord.pl table configurable
Bug 30221: (QA follow-up) perl-tidyness
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled
Bug 30221: (QA follow-up) add checkout branch information to other tables
Bug 30221: (QA follow-up) make holdshistory table configurable
Bug 30221: (QA follow-up) make DOM consistent for modified tables

Description Lucas Gass (lukeg) 2022-03-03 16:14:30 UTC
There are several tables on opac-user.tt that would benefit from being column configurable. 

( check-outs, overdues, charges, holds, article requests )
Comment 1 Arthur Suzuki 2024-09-30 08:22:54 UTC
Created attachment 172214 [details] [review]
Bug 30221: make the tables on opac-user.tt configurable

Test plan:
- apply patch
- as an admin go to Administration / Table settings / Opac / Patron details
- hide a few columns (duedate, barcode)
- make a couple checkouts and/or holds for a patron
- login to the opac as this patron
- verify the tables on the patron account table is missing the selected columns

sponsored-by: Lyon 2 University
Comment 2 Arthur Suzuki 2024-09-30 08:38:47 UTC
We had a request from Lyon 2 Uni to make checkouts, overdues, holds and relative's issues configurable but I've just seen this bug so attached my patch to it instead of creating a new bug.

Didn't handled the charges and article requests pages though, shall we make a followup to do handle those?

Also I guess a couples of system preferences are made obsolete if the table is configurable, like "OPACFinesTab"... shall we make a followup patch to remove this?
It probably need a closer look to see if thoses are not used somewhere else.
Comment 3 Lucas Gass (lukeg) 2024-09-30 14:06:48 UTC
This is missing Recalls, Article requests, Clubs, Credits, and Charges tables. They should all be configurable.
Comment 4 Arthur Suzuki 2024-10-01 09:38:39 UTC
(In reply to Lucas Gass from comment #3)
> This is missing Recalls, Article requests, Clubs, Credits, and Charges
> tables. They should all be configurable.

Hi Lucas, maybe we can make this small improvement go through and file a linked bug for any other tables which needs to go to table settings?
Also those other tables are not in opac-user.tt but in opac-account.tt or even includes templates, touching them all in a single bug would increase the risk of conflicting... :(
Comment 5 Arthur Suzuki 2024-10-07 12:08:18 UTC
Created attachment 172451 [details] [review]
Bug 30221: make the tables on opac-user.tt configurable

Test plan:
- apply patch
- as an admin go to Administration / Table settings / Opac / Patron details
- hide a few columns (duedate, barcode)
- make a couple checkouts and/or holds for a patron
- login to the opac as this patron
- verify the tables on the patron account table is missing the selected columns

sponsored-by: Lyon 2 University
Comment 6 Arthur Suzuki 2024-10-07 12:08:21 UTC
Created attachment 172452 [details] [review]
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl
Comment 7 Arthur Suzuki 2024-10-07 12:08:24 UTC
Created attachment 172453 [details] [review]
Bug 30221: made opac-readingrecord.pl table configurable
Comment 8 Arthur Suzuki 2024-10-07 12:08:27 UTC
Created attachment 172454 [details] [review]
Bug 30221: clean unused code in opac-user.tt
Comment 9 Arthur Suzuki 2024-10-07 12:08:29 UTC
Created attachment 172455 [details] [review]
Bug 30221: fix Javascript error
Comment 10 Arthur Suzuki 2024-10-07 12:08:32 UTC
Created attachment 172456 [details] [review]
Bug 30221: (QA follow-up) perl-tidyness
Comment 11 Lucas Gass (lukeg) 2024-10-07 20:11:15 UTC
(In reply to Arthur Suzuki from comment #4)
> (In reply to Lucas Gass from comment #3)
> > This is missing Recalls, Article requests, Clubs, Credits, and Charges
> > tables. They should all be configurable.
> 
> Hi Lucas, maybe we can make this small improvement go through and file a
> linked bug for any other tables which needs to go to table settings?
> Also those other tables are not in opac-user.tt but in opac-account.tt or
> even includes templates, touching them all in a single bug would increase
> the risk of conflicting... :(

That's fair. But one more question. I do see the Columns ( gear icon ) button on those OPAC tables. Do we want OPAC users to be able to adjust which columns are visible?
Comment 12 Arthur Suzuki 2024-10-08 07:58:12 UTC
(In reply to Lucas Gass from comment #11)
> That's fair. But one more question. I do see the Columns ( gear icon )
> button on those OPAC tables. Do we want OPAC users to be able to adjust
> which columns are visible?

It is  possible to disable which columns are visible and/or configurable by opac users by going to the Admin > Tables settings : https://koha-community.org/manual/latest/en/html/administration.html#table-settings
Comment 13 Lucas Gass (lukeg) 2024-10-08 15:21:12 UTC
(In reply to Arthur Suzuki from comment #12)
> (In reply to Lucas Gass from comment #11)
> > That's fair. But one more question. I do see the Columns ( gear icon )
> > button on those OPAC tables. Do we want OPAC users to be able to adjust
> > which columns are visible?
> 
> It is  possible to disable which columns are visible and/or configurable by
> opac users by going to the Admin > Tables settings :
> https://koha-community.org/manual/latest/en/html/administration.html#table-
> settings

I'm aware of Table settings. Have a look at other OPAC tables that are column configurable. The OPAC user cannot adjust what columns are visible when viewing the table. (Columns ( gear icon ))

Should we not be consistent with this behavior with all OPAC tables?
Comment 14 Owen Leonard 2024-10-08 15:59:54 UTC
I agree that we should not expose the column visibility feature in the OPAC. I think that introduces more complexity for the user than is necessary.
Comment 15 Katrin Fischer 2024-10-08 16:26:31 UTC
(In reply to Owen Leonard from comment #14)
> I agree that we should not expose the column visibility feature in the OPAC.
> I think that introduces more complexity for the user than is necessary.

+1
Comment 16 Arthur Suzuki 2024-10-10 09:25:03 UTC
Created attachment 172581 [details] [review]
Bug 30221: (QA follow-up) remove columns settings for OPAC users
Comment 17 Lucas Gass (lukeg) 2024-10-10 14:40:30 UTC
Created attachment 172610 [details] [review]
Bug 30221: make the tables on opac-user.tt configurable

Test plan:
- apply patch
- as an admin go to Administration / Table settings / Opac / Patron details
- hide a few columns (duedate, barcode)
- make a couple checkouts and/or holds for a patron
- login to the opac as this patron
- verify the tables on the patron account table is missing the selected columns

sponsored-by: Lyon 2 University
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 18 Lucas Gass (lukeg) 2024-10-10 14:40:33 UTC
Created attachment 172611 [details] [review]
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 19 Lucas Gass (lukeg) 2024-10-10 14:40:35 UTC
Created attachment 172613 [details] [review]
Bug 30221: made opac-readingrecord.pl table configurable

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 20 Lucas Gass (lukeg) 2024-10-10 14:40:38 UTC
Created attachment 172615 [details] [review]
Bug 30221: clean unused code in opac-user.tt

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 21 Lucas Gass (lukeg) 2024-10-10 14:40:41 UTC
Created attachment 172616 [details] [review]
Bug 30221: fix Javascript error

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 22 Lucas Gass (lukeg) 2024-10-10 14:40:44 UTC
Created attachment 172618 [details] [review]
Bug 30221: (QA follow-up) perl-tidyness

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 23 Lucas Gass (lukeg) 2024-10-10 14:40:47 UTC
Created attachment 172620 [details] [review]
Bug 30221: (QA follow-up) remove columns settings for OPAC users

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 24 Lucas Gass (lukeg) 2024-10-10 14:43:04 UTC
-Signed off, adding a couple notes:

1. I can hide every column. Should there be any that we consider cannot_be_toggled or cannot_be_modified? 

2. I can hide the renew column but still seeing buttons for Renew/Renew all. Turning off the OpacRenewalAllowed fixes this.
Comment 25 Arthur Suzuki 2024-10-14 13:09:32 UTC
(In reply to Lucas Gass (lukeg) from comment #24)
> -Signed off, adding a couple notes:
> 
> 1. I can hide every column. Should there be any that we consider
> cannot_be_toggled or cannot_be_modified?
> 
> 2. I can hide the renew column but still seeing buttons for Renew/Renew all.
> Turning off the OpacRenewalAllowed fixes this.

So maybe a "cannot_be_modified/cannot_be_toggled" flag on the "renew" column? What other columns did you have in mind which should not be configurable?
I can make a small follow-up patch to solve this.
Comment 26 Arthur Suzuki 2024-11-05 18:09:41 UTC
Created attachment 174014 [details] [review]
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled
Comment 27 Arthur Suzuki 2024-11-05 18:09:52 UTC
Created attachment 174015 [details] [review]
Bug 30221: (QA follow-up) add checkout branch information to other tables
Comment 28 Arthur Suzuki 2024-11-05 18:09:55 UTC
Created attachment 174016 [details] [review]
Bug 30221: (QA follow-up) make holdshistory table configurable
Comment 29 Lucas Gass (lukeg) 2024-11-05 20:54:36 UTC
Created attachment 174046 [details] [review]
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 30 Lucas Gass (lukeg) 2024-11-05 20:54:38 UTC
Created attachment 174047 [details] [review]
Bug 30221: (QA follow-up) add checkout branch information to other tables

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 31 Lucas Gass (lukeg) 2024-11-05 20:54:41 UTC
Created attachment 174048 [details] [review]
Bug 30221: (QA follow-up) make holdshistory table configurable

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 32 Lucas Gass (lukeg) 2024-11-05 20:55:15 UTC
Arthur, the follow-ups look good. I am adding my SO line to the last 3 follow-ups. Thanks!
Comment 33 Arthur Suzuki 2024-11-06 08:07:06 UTC
Thank you Lucas! Very happy to get some more of my patches to Koha :)
Comment 34 Jonathan Druart 2025-01-08 09:16:02 UTC
KohaTable does not have bKohaColumnsUseNames at the OPAC, this cannot work correctly now.

You need bug 26553 and friends. I would recommend to base this patch set on top of it.
Comment 35 Arthur Suzuki 2026-01-29 15:48:36 UTC
Created attachment 192154 [details] [review]
Bug 30221: make the tables on opac-user.tt configurable

Test plan:
- apply patch
- as an admin go to Administration / Table settings / Opac / Patron details
- hide a few columns (duedate, barcode)
- make a couple checkouts and/or holds for a patron
- login to the opac as this patron
- verify the tables on the patron account table is missing the selected columns

sponsored-by: Lyon 2 University
Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 36 Arthur Suzuki 2026-01-29 15:48:46 UTC
Created attachment 192155 [details] [review]
Bug 30221: add the checkout branch to the checkouts table on opac-user.pl

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 37 Arthur Suzuki 2026-01-29 15:48:51 UTC
Created attachment 192156 [details] [review]
Bug 30221: made opac-readingrecord.pl table configurable

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 38 Arthur Suzuki 2026-01-29 15:48:55 UTC
Created attachment 192157 [details] [review]
Bug 30221: (QA follow-up) perl-tidyness

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 39 Arthur Suzuki 2026-01-29 15:48:58 UTC
Created attachment 192158 [details] [review]
Bug 30221: (QA follow-up) Fix column "renew" cannot be toggled

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 40 Arthur Suzuki 2026-01-29 15:49:02 UTC
Created attachment 192159 [details] [review]
Bug 30221: (QA follow-up) add checkout branch information to other tables

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 41 Arthur Suzuki 2026-01-29 15:49:05 UTC
Created attachment 192160 [details] [review]
Bug 30221: (QA follow-up) make holdshistory table configurable

Signed-off-by: Lucas Gass <lucas@bywatersolutions.com>
Comment 42 Arthur Suzuki 2026-01-29 15:53:37 UTC
(In reply to Jonathan Druart from comment #34)
> KohaTable does not have bKohaColumnsUseNames at the OPAC, this cannot work
> correctly now.
> 
> You need bug 26553 and friends. I would recommend to base this patch set on
> top of it.

The patch set was conflicting when trying to apply so I've rebased them on top of latest main.
Made the changes needed to get it to work with bug 26553 (now in main).
QA scripts are happy :)
changing status to signed-off since all patches has already been signed by Lucas (but another signoff is always welcome I guess)
Comment 43 Jonathan Druart 2026-02-02 11:54:54 UTC
It's better but still not how it works.

1. bKohaColumnsUseNames is not set on the table you modified

2. Columns must be displayed, then you adjust the content and the visibility

example:
```
[% IF show_itemtype_column %]
  <th data-colname="item_type">Requested item type</th>
[% END %]
...
[% IF show_itemtype_column %]
  <td>[% some_data %]</td>
[% END %]
```

Must be:
// Always add the column to the DOM
<th data-colname="item_type">Requested item type</th>
...
[% IF show_itemtype_column %]
  <td>[% some_data %]</td>
[% ELSE %]
  // Empty the column, do not leak data
  <td></td>
[% END %]

THEN hide the column in the JS part:

let itemtype_column = table_settings.columns.find(c => c.columnname == 'item_type');
[% IF !show_itemtype_column %]
  itemtype_column.is_hidden = 1;
  itemtype_column.cannot_be_toggled = 1;
  itemtype_column.force_visibility = 1;
[% ELSE %]
Comment 44 Arthur Suzuki 2026-02-18 15:23:49 UTC
Created attachment 193361 [details] [review]
Bug 30221: (QA follow-up) make DOM consistent for modified tables

Sponsored-by: BibLibre
Comment 45 Arthur Suzuki 2026-02-18 15:29:17 UTC
(In reply to Jonathan Druart from comment #43)
> It's better but still not how it works.

Hello Jonathan!
I've addressed all the comments you made, also had to make a slight modification to sco-main.tt because it uses holds-table.inc as well as opac-user.tt, everything still works as expected (tried with SCO web page).
My thoughts after fixing the QA is that some of those sysprefs are made useless by this patch set, this probably needs a further analysis to check which syspref are only used for hiding columns and which ones have more impact on Koha's behaviour.