Bugzilla – Attachment 170535 Details for
Bug 36475
"Print summary" tables cannot be column configured
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 36475: Enable table configurations on patrons print summary
Bug-36475-Enable-table-configurations-on-patrons-p.patch (text/plain), 11.21 KB, created by
Martin Renvoize (ashimema)
on 2024-08-21 08:36:17 UTC
(
hide
)
Description:
Bug 36475: Enable table configurations on patrons print summary
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-08-21 08:36:17 UTC
Size:
11.21 KB
patch
obsolete
>From 518ea0f7c36f6a2c2428ce49def0bdbd3139e067 Mon Sep 17 00:00:00 2001 >From: Owen Leonard <oleonard@myacpl.org> >Date: Tue, 18 Jun 2024 15:52:10 +0000 >Subject: [PATCH] Bug 36475: Enable table configurations on patrons print > summary > >This patch fixes table configuration to the tables shown on the >patron's print summary page, adding default display length and default >sort as well. > >I removed the JS for moving around the DataTable controls to make them >display better and instead swapped the <caption>s for <h2>. It's not >perfect but it's better than it was. > >Previously table configuration wasn't working because the window.print() >function was firing before the DataTables code had time to run. I've >added a use of onbeforeprint event to make sure we run the DataTables >initiation before automatic printing. > >To test, apply the patch and restart services. > >- In the staff client, go to Administration -> Table settings -> > Circulation -> print_summary. > - Configure the print-summary-checkouts, print-summary-fines, and > print-summary-holds tables with some custom options (e.g. hide > columns, change default sort). >- In the staff client, find a patron with checkouts, holds, and fines. >- In the toolbar, click Print -> Print summary. A new tab should appear > with the print summary view. A print dialog should appear immediately. >- In the print preview you should see that the tables you configured are > displayed correctly (sort is correct, columns correctly hidden, etc). >- If you print the page or cancel the tab should close. > >- If you want to test the table configurations without having the tab > automatically close you can go to Administration -> System preferences > -> IntranetSlipPrinterJS and enter any dummy code, e.g. > "console.log('Testing');" With that preference populated, the > automatic closing isn't included. > >- Test other pages which use the slip-print include, e.g. other patron > print options and quick spine labels in Cataloging. > >Sponsored-By: Athens County Public Libraries >Signed-off-by: Thibaud Guillot <thibaud.guillot@biblibre.com> >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > admin/columns_settings.yml | 3 + > .../prog/en/includes/slip-print.inc | 2 + > .../en/modules/members/moremember-print.tt | 80 +++++++++---------- > 3 files changed, 41 insertions(+), 44 deletions(-) > >diff --git a/admin/columns_settings.yml b/admin/columns_settings.yml >index c71c7449295..4dfb152a6c1 100644 >--- a/admin/columns_settings.yml >+++ b/admin/columns_settings.yml >@@ -1936,6 +1936,7 @@ modules: > > print_summary: > print-summary-checkouts: >+ default_sort_order: 0 > columns: > - > columnname: title >@@ -1959,6 +1960,7 @@ modules: > columnname: status > > print-summary-holds: >+ default_sort_order: 0 > columns: > - > columnname: title >@@ -1974,6 +1976,7 @@ modules: > columnname: priority > > print-summary-fines: >+ default_sort_order: 0 > columns: > - > columnname: date >diff --git a/koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc b/koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc >index fba67cffcf1..4321d95177c 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc >+++ b/koha-tmpl/intranet-tmpl/prog/en/includes/slip-print.inc >@@ -2,8 +2,10 @@ > <!-- slip-print.inc --> > <script> > [% IF ( Koha.Preference('IntranetSlipPrinterJS') ) %] >+ let autoprint = false; > [% Koha.Preference('IntranetSlipPrinterJS') | $raw %] > [% ELSE %] >+ let autoprint = true; > $( window ).load(function() { > window.print(); > window.onafterprint = function () { >diff --git a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt >index 6d65c8e3841..1fd878dd136 100644 >--- a/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt >+++ b/koha-tmpl/intranet-tmpl/prog/en/modules/members/moremember-print.tt >@@ -16,31 +16,33 @@ > [% t("Koha") | html %] > [% END %]</title> > [% INCLUDE 'doc-head-close.inc' %] >+ <style>.pager div.dt-buttons { justify-content: flex-start; }</style> > </head> > > <body id="pat_moremember-print" class="pat"> > <div id="main"> > <h3><a href="/cgi-bin/koha/circ/circulation.pl?findborrower=[% patron.cardnumber | uri %]">Account summary: [% INCLUDE 'patron-title.inc' no_html = 1 %] ›</a></h3> >- >- <ul> >- [% PROCESS 'display-address-style' %] >- <li>[% IF ( patron.phone ) %][% patron.phone | html %][% ELSE %](no phone number on file)[% END %]</li> >- <li>[% IF ( patron.email ) %][% patron.email | html %][% ELSE %](no primary email on file)[% END %]</li> >- [% IF ( patron.emailpro ) %] >- <li>[% patron.emailpro | html %]</li> >- [% END %] >- <li>Registration date: [% patron.dateenrolled | $KohaDates %]</li> >- <li>Expiration date: [% patron.dateexpiry | $KohaDates %]</li> >- <li>Library: [% Branches.GetName( patron.branchcode ) | html %]</li> >- <li>Category: [% patron.category.description | html %]</li> >- </ul> >+ <div class="page-section"> >+ <ul> >+ [% PROCESS 'display-address-style' %] >+ <li>[% IF ( patron.phone ) %][% patron.phone | html %][% ELSE %](no phone number on file)[% END %]</li> >+ <li>[% IF ( patron.email ) %][% patron.email | html %][% ELSE %](no primary email on file)[% END %]</li> >+ [% IF ( patron.emailpro ) %] >+ <li>[% patron.emailpro | html %]</li> >+ [% END %] >+ <li>Registration date: [% patron.dateenrolled | $KohaDates %]</li> >+ <li>Expiration date: [% patron.dateexpiry | $KohaDates %]</li> >+ <li>Library: [% Branches.GetName( patron.branchcode ) | html %]</li> >+ <li>Category: [% patron.category.description | html %]</li> >+ </ul> >+ </div> > > [% IF ( issues ) %] >+ <h2>Items checked out</h2> > <table id="print-summary-checkouts"> >- <caption>Items checked out</caption> > <thead> > <tr> >- <th>Title</th> >+ <th class="anti-the">Title</th> > <th>Author</th> > <th>Call number</th> > <th>Item type</th> >@@ -61,7 +63,7 @@ > <td>[% issue.author | html %]</td> > <td>[% issue.itemcallnumber | html %]</td> > <td>[% ItemTypes.GetDescription( issue.itype ) | html %]</td> >- <td>[% issue.date_due | $KohaDates as_due_date => 1 %]</td> >+ <td data-order="[% issue.date_due | html %]">[% issue.date_due | $KohaDates as_due_date => 1 %]</td> > <td>[% issue.barcode | html %]</td> > <td>[% issue.stocknumber | html %]</td> > [% IF ( issue.charge <= 0 ) %] >@@ -112,11 +114,11 @@ > [% END %] > > [% IF ( reserves ) %] >+ <h2>Pending holds</h2> > <table id="print-summary-holds"> >- <caption>Pending holds</caption> > <thead> > <tr> >- <th>Title</th> >+ <th class="anti-the">Title</th> > <th>Author</th> > <th>Placed on</th> > <th>Expires on</th> >@@ -129,8 +131,8 @@ > <tr> > <td>[% reserve.title | html %]</td> > <td>[% reserve.author | html %]</td> >- <td>[% reserve.reservedate | $KohaDates %]</td> >- <td>[% reserve.expirationdate | $KohaDates %]</td> >+ <td data-sort="[% reserve.reservedate | html %]">[% reserve.reservedate | $KohaDates %]</td> >+ <td data-sort="[% reserve.expirationdate | html %]">[% reserve.expirationdate | $KohaDates %]</td> > <td>[% reserve.waiting_at | html %]</td> > <td>[% reserve.priority | html %]</td> > </tr> >@@ -139,8 +141,8 @@ > </table> > [% END %] > [% IF accounts && totaldue != 0 %] >+ <h2>Account fines and payments</h2> > <table id="print-summary-fines"> >- <caption>Account fines and payments</caption> > <thead> > <tr> > <th>Date</th> >@@ -153,7 +155,7 @@ > <tbody> > [% FOREACH account IN accounts %] > <tr> >- <td>[% account.date | $KohaDates %]</td> >+ <td data-sort="[% account.date| html %]">[% account.date | $KohaDates %]</td> > <td> > [% PROCESS account_type_description account=account %] > [%- IF account.payment_type %] >@@ -220,43 +222,33 @@ > var holds_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-holds', 'json' ) | $raw %]; > var fines_columns = [% TablesSettings.GetTableSettings( 'circ', 'print_summary', 'print-summary-fines', 'json' ) | $raw %]; > >- function moveColumnsButton( tableId ){ >- /* Hide the export button */ >- $("#" + tableId + "_wrapper").find("button.export_controls").remove(); >- /* We don't show the table controls toolbar here, so the columns settings button looks better as part of the caption */ >- $("#" + tableId).find("caption").append( $("#" + tableId + "_wrapper").find("button.columns_controls") ); >- } >- >- $(document).ready(function() { >- >+ function initTables(){ > KohaTable("print-summary-checkouts", { >- "dom": "Bt", >+ "dom": '<"dt-info"><"top pager"<"table_controls"B>>t', > "paging": false, > "autoWidth": false, >- initComplete: function( settings) { >- moveColumnsButton( settings.nTable.id ); >- } > }, checkouts_columns); > > KohaTable("print-summary-holds", { >- "dom": "Bt", >+ "dom": '<"dt-info"><"top pager"<"table_controls"B>>t', > "paging": false, > "autoWidth": false, >- initComplete: function( settings) { >- moveColumnsButton( settings.nTable.id ); >- } > }, holds_columns); > > KohaTable("print-summary-fines", { >- "dom": "Bt", >+ "dom": '<"dt-info"><"top pager"<"table_controls"B>>t', > "paging": false, > "autoWidth": false, >- initComplete: function( settings) { >- moveColumnsButton( settings.nTable.id ); >- } > }, fines_columns); >+ } > >- }); >+ if( autoprint ){ >+ window.onbeforeprint = initTables(); >+ } else { >+ $(document).ready(function(){ >+ initTables(); >+ }); >+ } > </script> > [% END %] > >-- >2.46.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 36475
:
167859
|
170196
| 170535