Bugzilla – Attachment 190538 Details for
Bug 41457
Hold history table does not deal with column visibility correctly
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 41457: Fix column visibility on the holds history table
f70ac26.patch (text/plain), 8.34 KB, created by
Jonathan Druart
on 2025-12-16 12:45:37 UTC
(
hide
)
Description:
Bug 41457: Fix column visibility on the holds history table
Filename:
MIME Type:
Creator:
Jonathan Druart
Created:
2025-12-16 12:45:37 UTC
Size:
8.34 KB
patch
obsolete
>From f70ac266c3024cdce470db4fafd885eedc1231b4 Mon Sep 17 00:00:00 2001 >From: Jonathan Druart <jonathan.druart@bugs.koha-community.org> >Date: Tue, 16 Dec 2025 12:24:32 +0100 >Subject: [PATCH] Bug 41457: Fix column visibility on the holds history table > >We must use bKohaColumnsUseNames to correctly deal with the column >visibility if some columns are shown/hidden depending on sysprefs. > >On the holds history table we have "item type" that is hidden if >AllowHoldItemTypeSelection is disabled. > >Test plan: >1. Create a hold and select an item type >Note: I think there is a bug if you select it from "Hold next available >item", use "Hold details". Please confirm? >2. Go to the holds history view >3. Hide some columns >4. Modify the value of AllowHoldItemTypeSelection >5. Reload the page and notice that the state of the table is restored > correctly, however the "item type" column is shown or hidden > depending on the syspref's value. >--- > .../prog/en/modules/members/holdshistory.tt | 87 ++++++++++--------- > 1 file changed, 45 insertions(+), 42 deletions(-) > >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >index 3145bc14241..6b3f96fea6e 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/holdshistory.tt >@@ -49,9 +49,6 @@ > [% ELSIF patron.is_anonymous %] > <div class="alert alert-warning">This is the anonymous patron, so no holds history is displayed.</div> > [% ELSE %] >- >- [% SET show_itemtype_column = Koha.Preference('AllowHoldItemTypeSelection') %] >- > <div id="holdshistory" class="page-section"> > <h2 id="current_holds_heading">Current holds</h2> > <p >@@ -85,20 +82,18 @@ > <table id="table_holdshistory"> > <thead> > <tr> >- <th class="anti-the">Title</th> >- <th>Author</th> >- <th>Barcode</th> >- <th>Call number</th> >- <th>Library</th> >- <th>Hold date</th> >- <th>Expiration date</th> >- <th>Waiting date</th> >- <th>Cancellation date</th> >- [% IF show_itemtype_column %] >- <th>Requested item type</th> >- [% END %] >- <th>Status</th> >- <th>Notes</th> >+ <th data-colname="title" class="anti-the">Title</th> >+ <th data-colname="author">Author</th> >+ <th data-colname="barcode">Barcode</th> >+ <th data-colname="itemcallnumber">Call number</th> >+ <th data-colname="branch">Library</th> >+ <th data-colname="reservedate">Hold date</th> >+ <th data-colname="expirationdate">Expiration date</th> >+ <th data-colname="waitingdate">Waiting date</th> >+ <th data-colname="cancellationdate">Cancellation date</th> >+ <th data-colname="itemtype">Requested item type</th> >+ <th data-colname="status">Status</th> >+ <th data-colname="notes">Notes</th> > </tr> > </thead> > </table> >@@ -130,20 +125,18 @@ > <table id="table_oldholdshistory"> > <thead> > <tr> >- <th class="anti-the">Title</th> >- <th>Author</th> >- <th>Barcode</th> >- <th>Call number</th> >- <th>Library</th> >- <th>Hold date</th> >- <th>Expiration date</th> >- <th>Waiting date</th> >- <th>Cancellation date</th> >- [% IF show_itemtype_column %] >- <th>Requested item type</th> >- [% END %] >- <th>Status</th> >- <th>Notes</th> >+ <th data-colname="title" class="anti-the">Title</th> >+ <th data-colname="author">Author</th> >+ <th data-colname="barcode">Barcode</th> >+ <th data-colname="itemcallnumber">Call number</th> >+ <th data-colname="branch">Library</th> >+ <th data-colname="reservedate">Hold date</th> >+ <th data-colname="expirationdate">Expiration date</th> >+ <th data-colname="waitingdate">Waiting date</th> >+ <th data-colname="cancellationdate">Cancellation date</th> >+ <th data-colname="itemtype">Requested item type</th> >+ <th data-colname="status">Status</th> >+ <th data-colname="notes">Notes</th> > </tr> > </thead> > </table> >@@ -181,14 +174,21 @@ > item_types: all_item_types, > libraries: all_libraries, > }; >+ >+ const show_itemtype_column = [% Koha.Preference('AllowHoldItemTypeSelection') ? 1 : 0 %]; > </script> > <script> > $(document).ready(function() { > var table_settings = [% TablesSettings.GetTableSettings('members', 'holdshistory', 'holdshistory-table', 'json') | $raw %]; >- [% UNLESS show_itemtype_column %] >- //Remove item type column settings >- table_settings['columns'] = table_settings['columns'].filter(function(c){return c['columnname'] != 'itemtype';}); >- [% END %] >+ >+ let item_type_column = table_settings.columns.find(c => c.columnname == 'itemtype'); >+ if ( !show_itemtype_column ) { >+ item_type_column.is_hidden = 1; >+ item_type_column.cannot_be_toggled = 1; >+ } else { >+ item_type_column.is_hidden = 0; >+ } >+ item_type_column.force_visibility = 1; > > let current_holds_table = build_holds_table("#table_holdshistory"); > let old_holds_table = build_holds_table("#table_oldholdshistory", 1); >@@ -323,7 +323,6 @@ > return $date(row.cancellation_date) > } > }, >- [% IF show_itemtype_column %] > { > data: "item_type_id", > datatype: "coded_value:item_type", >@@ -331,14 +330,17 @@ > searchable: true, > orderable: true, > render: function (data, type, row, meta) { >- if ( row.item_type_id ) { >- return row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; >- } else { >- return _("Any item type"); >- } >+ [% IF Koha.Preference('AllowHoldItemTypeSelection') %] >+ return ""; >+ [% ELSE %] >+ if ( row.item_type_id ) { >+ return row._strings.item_type_id ? row._strings.item_type_id.str : row.item_type_id; >+ } else { >+ return _("Any item type"); >+ } >+ [% END %] > } > }, >- [% END %] > { > data: "status", > searchable: false, >@@ -372,6 +374,7 @@ > } > }, > ], >+ bKohaColumnsUseNames: true, > }, > table_settings, > true, >-- >2.43.0 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 41457
: 190538