How to modify the template that generates PDFs from the Reports module?

How do I modify the default template used in the "Action → Download PDF” action of the Reports module? Currently the PDFs all look the same, with our logo on top, the name of the report, and the report table. I would simply like to add a run date.

You can check these code files.

  1. SuiteCRM/modules/AOR_Reports/AOR_Report.php at hotfix · SuiteCRM/SuiteCRM · GitHub

  2. SuiteCRM/modules/AOR_Reports/controller.php at hotfix · SuiteCRM/SuiteCRM · GitHub

1 Like

That was helpful, thank you. Modifying the controller.php file directly works fine, but I am getting an error if I copy the file to custom/modules/AOR_Reports/controller.php. I’ll need to investigate further.

When you copy modules/AOR_Reports/controller.php to custom/modules/AOR_Reports/controller.php, you must rename the class to follow the naming convention for custom controllers.


Ensure your new custom class extends the original one so you don’t have to duplicate all the core code. Your file should look like this:

<?php
if (!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

require_once 'modules/AOR_Reports/controller.php';

class CustomAOR_ReportsController extends AOR_ReportsController
{
    // Override only the specific methods you need to change
}


After making these changes, SuiteCRM needs to rebuild its class map to recognize the new file.

Run Quick Repair and Rebuild


Reference doc:


Note: please mark as :white_check_mark: solution one of the responses. Also, you can share your code changes; it will be helpful to others.