Bug 30837

Summary: Fix table width on 'Print summary'
Product: Koha Reporter: Martin Renvoize (ashimema) <martin.renvoize>
Component: Label/patron card printingAssignee: Magnus Enger <magnus>
Status: CLOSED FIXED QA Contact: Martin Renvoize (ashimema) <martin.renvoize>
Severity: normal    
Priority: P5 - low CC: arthur.suzuki, david, fridolin.somers, jonathan.druart, lucas, magnus, pierre.genty, tomascohen, victor
Version: unspecified   
Hardware: All   
OS: All   
Change sponsored?: --- Patch complexity: Trivial patch
Documentation contact: Documentation submission:
Text to go in the release notes:
This fixes the width of the table for the print summary so that it fits the width of the page.
Version(s) released in:
22.11.00, 22.05.04, 21.11.11
Circulation function:
Attachments: Bug 30837 - Fix table width on 'Print summary'
Bug 30837 - Fix table width on 'Print summary'
Bug 30837: Fix table width on 'Print summary'

Description Martin Renvoize (ashimema) 2022-05-24 09:10:16 UTC
The tables present on the 'Print summary' option are incredibly wide and unwieldy. This leads to prints getting truncated or defaulting to landscape and a tiny zoom level.

We should be able to make these tables fit more manageable onto the print page.
Comment 1 Magnus Enger 2022-05-24 09:45:05 UTC
It looks to me like the table gets a fixed width when the page is rendered, and that width is kept both when you resize the browser window, and when the page is printed. 

When the browser window is at full width, I see this in the "developer tools" view of the page:

<table id="print-summary-checkouts" class="dataTable" role="grid" style="width: 1923px;">
<thead>
<tr role="row">
<th class="sorting_asc" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Title: activate to sort column descending" style="width: 740.5px;">Title</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Author: activate to sort column ascending" style="width: 211.5px;">Author</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Call number: activate to sort column ascending" style="width: 192.5px;">Call number</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Item type: activate to sort column ascending" style="width: 280.5px;">Item type</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Date due: activate to sort column ascending" style="width: 148.5px;">Date due</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Barcode: activate to sort column ascending" style="width: 190.5px;">Barcode</th>
</tr>

If i resize the window, the numbers are different:

<table id="print-summary-checkouts" class="dataTable" role="grid" style="width: 1152px;">
<thead>
<tr role="row"><th class="sorting_asc" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-sort="ascending" aria-label="Title: activate to sort column descending" style="width: 432.5px;">Title</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Author: activate to sort column ascending" style="width: 116.5px;">Author</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Call number: activate to sort column ascending" style="width: 104.5px;">Call number</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Item type: activate to sort column ascending" style="width: 157.5px;">Item type</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Date due: activate to sort column ascending" style="width: 78.5px;">Date due</th>
<th class="sorting" tabindex="0" aria-controls="print-summary-checkouts" rowspan="1" colspan="1" aria-label="Barcode: activate to sort column ascending" style="width: 103.5px;">Barcode</th>
</tr>

I checked a site running 21.05.05 and it looks better there. The table looks like a "regular" table, without the "Columns" link next to the title, and without sortable columns. Maybe related to bug 28450?
Comment 2 Magnus Enger 2022-05-24 12:18:13 UTC Comment hidden (obsolete)
Comment 3 Magnus Enger 2022-05-24 12:19:02 UTC
Thanks to Owen for suggesting the fix!
Comment 4 Martin Renvoize (ashimema) 2022-05-24 13:25:48 UTC Comment hidden (obsolete)
Comment 5 Martin Renvoize (ashimema) 2022-05-24 13:26:30 UTC
Wow, I was trying to get way too clever with this.. nice one Magnus!

Straight PQA, trivial and effective fix.
Comment 6 Tomás Cohen Arazi (tcohen) 2022-05-31 12:09:41 UTC
Pushed to master for 22.11, thanks!
Comment 7 Fridolin Somers 2022-06-02 06:29:50 UTC
Dont forget to format commit message not like Bug report :
https://wiki.koha-community.org/wiki/Commit_messages#Subject_line

Should be :
Bug 30837: Fix table width on 'Print summary'
Comment 8 Lucas Gass (lukeg) 2022-06-06 15:12:59 UTC
Magnus,

If you'd like this one in 22.05.x I'm happy to backport it. Could you fix the commit title first?
Comment 9 Fridolin Somers 2022-08-12 01:16:37 UTC
Please backport until 21.11.x
Comment 10 Magnus Enger 2022-08-12 09:16:55 UTC
Created attachment 139044 [details] [review]
Bug 30837: Fix table width on 'Print summary'

To reproduce:
- Make sure you have a patron with at least one checkout,
  one hold and one fine
- On the detail page for that patron, go to Print > Print
  summary
- Observe the tables are too wide to fit on a printed page

To test:
- Apply this patch
- Repeat the steps above
- Observe the table now fits on the page

Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com>
Comment 11 Magnus Enger 2022-08-12 09:18:54 UTC
Lucas, the title should be fixed now.
Comment 12 Lucas Gass (lukeg) 2022-08-12 14:26:43 UTC
Backported to 22.05.x for 22.05.04
Comment 13 Arthur Suzuki 2022-08-16 08:28:45 UTC
pushed to 21.11.x for 21.11.11
Comment 14 Victor Grousset/tuxayo 2022-08-18 03:28:35 UTC
Not backported to oldoldstable (21.05.x). Feel free to ask if it's needed.

Nothing to document, marking resolved.
Comment 15 Fridolin Somers 2022-08-18 05:33:16 UTC
(In reply to Arthur Suzuki from comment #13)
> pushed to 21.11.x for 21.11.11

Great thanks Arthur.
It will make happy librarians ^^