ChurchCRM / CRM

ChurchCRM is an OpenSource Church CRM & Management Software.
https://ChurchCRM.io
MIT License
636 stars 445 forks source link

Bug: People directory outputs in Legal page size when Letter page size is selected #6980

Closed jasondunsmore closed 6 months ago

jasondunsmore commented 6 months ago

Description

When generating a PDF people directory, if a user selects the Letter page size, the report is generated with Legal page size instead.

I reproduced this with version 5.7.0 on the demo site: https://demos6.softaculous.com/ChurchCRMll4mjungns/DirectoryReports.php

Steps To Reproduce

Steps to reproduce the behavior:

Navigate to "People" -> "Dashboard" -> "People Directory" (under "Reports"). Select "Letter" Paper Size and click "Create Directory". A report is generated with the "Legal" paper size.

Expected behavior

The report should be generated with the selected "Letter" paper size.

Screenshots and/or logs

image image

respencer commented 6 months ago

Confirmed via further testing with the demo:

~$ pdfinfo Directory-20240502-31943.pdf
Producer:        FPDF 1.86
CreationDate:    Thu May  2 09:19:43 2024 SAST
Custom Metadata: no
Metadata Stream: no
Tagged:          no
UserProperties:  no
Suspects:        no
Form:            none
JavaScript:      no
Pages:           1
Encrypted:       no
Page size:       612 x 1008 pts
Page rot:        0
File size:       1725 bytes
Optimized:       no
PDF version:     1.3

Further testing shows that the page size selector does not change the result for any of the page sizes options available.

respencer commented 6 months ago

This line somehow always results in a zero value:

https://github.com/ChurchCRM/CRM/blob/351183aac36c9809708bb3d7f960c8c212520350/src/Reports/DirectoryReport.php#L83

And so this always defaults to 'legal':

https://github.com/ChurchCRM/CRM/blob/351183aac36c9809708bb3d7f960c8c212520350/src/Reports/DirectoryReport.php#L87-L89